Whamcloud - gitweb
Revert "LU-1201 checksum: add libcfs crypto hash"
[fs/lustre-release.git] / libcfs / libcfs / posix / posix-adler.c
diff --git a/libcfs/libcfs/posix/posix-adler.c b/libcfs/libcfs/posix/posix-adler.c
deleted file mode 100644 (file)
index 36931d4..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*   Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-        claim that you wrote the original software. If you use this software
-        in a product, an acknowledgment in the product documentation would be
-        appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-        misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jean-loup Gailly     Mark Adler
-  jloup@gzip.org         madler@alumni.caltech.edu
-
-
-  The data format used by the zlib library is described by RFCs (Request for
-  Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt
-  (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
-*/
-#include <libcfs/libcfs.h>
-
-
-#define BASE 65521L /* largest prime smaller than 65536 */
-#define NMAX 5552
-/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
-
-#define DO1(buf, i)  {s1 += buf[i]; s2 += s1; }
-#define DO2(buf, i)  DO1(buf, i); DO1(buf, i + 1);
-#define DO4(buf, i)  DO2(buf, i); DO2(buf, i + 2);
-#define DO8(buf, i)  DO4(buf, i); DO4(buf, i + 4);
-#define DO16(buf)      DO8(buf, 0); DO8(buf, 8);
-
-/* ========================================================================= */
-/*
-        Update a running Adler-32 checksum with the bytes buf[0..len-1] and
-   return the updated checksum. If buf is NULL, this function returns
-   the required initial value for the checksum.
-   An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
-   much faster. Usage example:
-
-        uLong adler = adler32(0L, NULL, 0);
-
-        while (read_buffer(buffer, length) != EOF) {
-          adler = adler32(adler, buffer, length);
-        }
-        if (adler != original_adler) error();
-*/
-unsigned long zlib_adler32(unsigned long adler,
-                          const unsigned char *buf,
-                          unsigned int len)
-{
-       unsigned long s1 = adler & 0xffff;
-       unsigned long s2 = (adler >> 16) & 0xffff;
-       int k;
-
-       if (buf == NULL)
-               return 1L;
-
-       while (len > 0) {
-               k = len < NMAX ? len : NMAX;
-               len -= k;
-               while (k >= 16) {
-                       DO16(buf);
-                       buf += 16;
-                       k -= 16;
-               }
-               if (k != 0)
-                       do {
-                               s1 += *buf++;
-                               s2 += s1;
-                       } while (--k);
-               s1 %= BASE;
-               s2 %= BASE;
-       }
-       return (s2 << 16) | s1;
-}