RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  [EMAIL PROTECTED]
  Module: rpm                              Date:   14-Oct-2008 20:23:29
  Branch: rpm-5_1                          Handle: 2008101418232801

  Added files:              (Branch: rpm-5_1)
    rpm/rpmio               crc.c crc.h
  Modified files:           (Branch: rpm-5_1)
    rpm                     CHANGES
    rpm/rpmio               Makefile.am digest.c

  Log:
    - jbj: include crc routines in a standalone file.

  Summary:
    Revision    Changes     Path
    1.2288.2.130+1  -0      rpm/CHANGES
    1.162.2.9   +5  -4      rpm/rpmio/Makefile.am
    1.1.2.1     +397 -0     rpm/rpmio/crc.c
    1.1.2.1     +49 -0      rpm/rpmio/crc.h
    2.38.2.2    +7  -180    rpm/rpmio/digest.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.2288.2.129 -r1.2288.2.130 CHANGES
  --- rpm/CHANGES       13 Oct 2008 21:39:40 -0000      1.2288.2.129
  +++ rpm/CHANGES       14 Oct 2008 18:23:28 -0000      1.2288.2.130
  @@ -1,4 +1,5 @@
   5.1.5 -> 5.1.6:
  +    - jbj: include crc routines in a standalone file.
       - jbj: use a switch on errno to make leakage pathology filtering easier.
       - jbj: use Stat(2) for --rpmiodebug tracing.
       - jbj: fix: resurrect cpuinfo() probe, hack-o-rounds for both /proc & 
libio.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/Makefile.am
  ============================================================================
  $ cvs diff -u -r1.162.2.8 -r1.162.2.9 Makefile.am
  --- rpm/rpmio/Makefile.am     28 Sep 2008 20:13:21 -0000      1.162.2.8
  +++ rpm/rpmio/Makefile.am     14 Oct 2008 18:23:29 -0000      1.162.2.9
  @@ -59,7 +59,7 @@
        rpmnss.h rpmpgp.h rpmsq.h rpmssl.h rpmsw.h rpmurl.h rpmxar.h \
        stringbuf.h ugid.h rpmuuid.h
   noinst_HEADERS = \
  -     ar.h cpio.h fnmatch.h glob.h iosm.h \
  +     ar.h cpio.h crc.h fnmatch.h glob.h iosm.h \
        md2.h md4.h poptIO.h rmd128.h rmd160.h rmd256.h rmd320.h sha224.h \
        salsa10.h salsa20.h tar.h tiger.h \
        rpmhook.h rpmio_internal.h rpmlua.h
  @@ -67,9 +67,10 @@
   usrlibdir = $(libdir)
   usrlib_LTLIBRARIES = librpmio.la
   librpmio_la_SOURCES = \
  -     ar.c argv.c bzdio.c cpio.c digest.c fnmatch.c fts.c getdate.c getpass.c 
\
  -     glob.c gzdio.c iosm.c lzdio.c macro.c mire.c mount.c \
  -     md2.c md4.c poptIO.c rmd128.c rmd160.c rmd256.c rmd320.c sha224.c \
  +     ar.c argv.c bzdio.c cpio.c crc.c digest.c fnmatch.c fts.c \
  +     getdate.c getpass.c glob.c gzdio.c iosm.c lzdio.c \
  +     macro.c mire.c mount.c poptIO.c \
  +     md2.c md4.c rmd128.c rmd160.c rmd256.c rmd320.c sha224.c \
        salsa10.c salsa20.c tiger.c \
        rpmbc.c rpmdav.c rpmgc.c rpmhash.c rpmhook.c rpmio.c rpmio-stub.c \
        rpmlog.c rpmlua.c rpmmalloc.c rpmmg.c rpmnss.c rpmpgp.c \
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/crc.c
  ============================================================================
  $ cvs diff -u -r0 -r1.1.2.1 crc.c
  --- /dev/null 2008-10-14 20:22:00 +0200
  +++ crc.c     2008-10-14 20:23:29 +0200
  @@ -0,0 +1,397 @@
  +/** \ingroup signature
  + * \file rpmio/crc.c
  + */
  +
  +#include "system.h"
  +#include "crc.h"
  +#include "debug.h"
  +
  +/* ========================================================================= 
*/
  +uint32_t __crc32(uint32_t crc, const uint8_t * data, size_t size)
  +{
  +    static uint32_t polynomial = 0xedb88320;    /* reflected 0x04c11db7 */
  +    static uint32_t xorout = 0xffffffff;
  +    static uint32_t table[256];
  +
  +    crc ^= xorout;
  +
  +    if (data == NULL) {
  +     /* generate the table of CRC remainders for all possible bytes */
  +     uint32_t c;
  +     uint32_t i, j;
  +     for (i = 0;  i < 256;  i++) {
  +         c = i;
  +         for (j = 0;  j < 8;  j++) {
  +             if (c & 1)
  +                 c = polynomial ^ (c >> 1);
  +             else
  +                 c = (c >> 1);
  +         }
  +         table[i] = c;
  +     }
  +    } else
  +    while (size) {
  +     crc = table[(crc ^ *data) & 0xff] ^ (crc >> 8);
  +     size--;
  +     data++;
  +    }
  +
  +    crc ^= xorout;
  +
  +    return crc;
  +
  +}
  +
  +/*
  + * Swiped from zlib, using uint32_t rather than unsigned long computation.
  + */
  +/[EMAIL PROTECTED]@*/
  +static int gf2_dim32 = 32;
  +
  +/**
  + */
  +static uint32_t gf2_matrix_times32(uint32_t *mat, uint32_t vec)
  +     /[EMAIL PROTECTED]/
  +{
  +    uint32_t sum;
  +
  +    sum = 0;
  +    while (vec) {
  +        if (vec & 1)
  +            sum ^= *mat;
  +        vec >>= 1;
  +        mat++;
  +    }
  +    return sum;
  +}
  +
  +/**
  + */
  +static void gf2_matrix_square32(/[EMAIL PROTECTED]@*/ uint32_t *square, 
uint32_t *mat)
  +     /[EMAIL PROTECTED] square @*/
  +{
  +    int n;
  +
  +    for (n = 0; n < gf2_dim32; n++)
  +        square[n] = gf2_matrix_times32(mat, mat[n]);
  +}
  +
  +uint32_t __crc32_combine(uint32_t crc1, uint32_t crc2, size_t len2)
  +{
  +    int n;
  +    uint32_t row;
  +    size_t nb = gf2_dim32 * sizeof(row);
  +    uint32_t * even = alloca(nb);    /* even-power-of-two zeros operator */
  +    uint32_t * odd = alloca(nb);     /* odd-power-of-two zeros operator */
  +
  +    /* degenerate case */
  +    if (len2 == 0)
  +        return crc1;
  +
  +    /* put operator for one zero bit in odd */
  +    odd[0] = 0xedb88320UL;   /* CRC-32 polynomial */
  +    row = 1;
  +    for (n = 1; n < gf2_dim32; n++) {
  +        odd[n] = row;
  +        row <<= 1;
  +    }
  +
  +    /* put operator for two zero bits in even */
  +    gf2_matrix_square32(even, odd);
  +
  +    /* put operator for four zero bits in odd */
  +    gf2_matrix_square32(odd, even);
  +
  +    /* apply len2 zeros to crc1 (first square will put the operator for one
  +       zero byte, eight zero bits, in even) */
  +    do {
  +        /* apply zeros operator for this bit of len2 */
  +        gf2_matrix_square32(even, odd);
  +        if (len2 & 1)
  +            crc1 = gf2_matrix_times32(even, crc1);
  +        len2 >>= 1;
  +
  +        /* if no more bits set, then done */
  +        if (len2 == 0)
  +            break;
  +
  +        /* another iteration of the loop with odd and even swapped */
  +        gf2_matrix_square32(odd, even);
  +        if (len2 & 1)
  +            crc1 = gf2_matrix_times32(odd, crc1);
  +        len2 >>= 1;
  +
  +        /* if no more bits set, then done */
  +    } while (len2 != 0);
  +
  +    /* return combined crc */
  +    crc1 ^= crc2;
  +    return crc1;
  +}
  +
  +/* ========================================================================= 
*/
  +/*
  + * ECMA-182 polynomial, see
  + *     
http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-182.pdf
  + */
  +uint64_t __crc64(uint64_t crc, const uint8_t * data, size_t size)
  +{
  +    static uint64_t polynomial =
  +     0xc96c5795d7870f42ULL;  /* reflected 0x42f0e1eba9ea3693ULL */
  +    static uint64_t xorout = 0xffffffffffffffffULL;
  +    static uint64_t table[256];
  +
  +    crc ^= xorout;
  +
  +    if (data == NULL) {
  +     /* generate the table of CRC remainders for all possible bytes */
  +     uint64_t c;
  +     uint32_t i, j;
  +     for (i = 0;  i < 256;  i++) {
  +         c = i;
  +         for (j = 0;  j < 8;  j++) {
  +             if (c & 1)
  +                 c = polynomial ^ (c >> 1);
  +             else
  +                 c = (c >> 1);
  +         }
  +         table[i] = c;
  +     }
  +    } else
  +    while (size) {
  +     crc = table[(crc ^ *data) & 0xff] ^ (crc >> 8);
  +     size--;
  +     data++;
  +    }
  +
  +    crc ^= xorout;
  +
  +    return crc;
  +
  +}
  +
  +/*
  + * Swiped from zlib, using uint64_t rather than unsigned long computation.
  + */
  +/[EMAIL PROTECTED]@*/
  +static int gf2_dim64 = 64;
  +
  +/**
  + */
  +static uint64_t gf2_matrix_times64(uint64_t *mat, uint64_t vec)
  +     /[EMAIL PROTECTED]/
  +{
  +    uint64_t sum;
  +
  +    sum = 0;
  +    while (vec) {
  +        if (vec & 1)
  +            sum ^= *mat;
  +        vec >>= 1;
  +        mat++;
  +    }
  +    return sum;
  +}
  +
  +/**
  + */
  +static void gf2_matrix_square64(/[EMAIL PROTECTED]@*/ uint64_t *square, 
uint64_t *mat)
  +     /[EMAIL PROTECTED] square @*/
  +{
  +    int n;
  +
  +    for (n = 0; n < gf2_dim64; n++)
  +        square[n] = gf2_matrix_times64(mat, mat[n]);
  +}
  +
  +uint64_t __crc64_combine(uint64_t crc1, uint64_t crc2, size_t len2)
  +{
  +    int n;
  +    uint64_t row;
  +    size_t nb = gf2_dim64 * sizeof(row);
  +    uint64_t * even = alloca(nb);    /* even-power-of-two zeros operator */
  +    uint64_t * odd = alloca(nb);     /* odd-power-of-two zeros operator */
  +
  +    /* degenerate case */
  +    if (len2 == 0)
  +        return crc1;
  +
  +    /* put operator for one zero bit in odd */
  +    odd[0] = 0xc96c5795d7870f42ULL;  /* reflected 0x42f0e1eba9ea3693ULL */
  +    row = 1;
  +    for (n = 1; n < gf2_dim64; n++) {
  +        odd[n] = row;
  +        row <<= 1;
  +    }
  +
  +    /* put operator for two zero bits in even */
  +    gf2_matrix_square64(even, odd);
  +
  +    /* put operator for four zero bits in odd */
  +    gf2_matrix_square64(odd, even);
  +
  +    /* apply len2 zeros to crc1 (first square will put the operator for one
  +       zero byte, eight zero bits, in even) */
  +    do {
  +        /* apply zeros operator for this bit of len2 */
  +        gf2_matrix_square64(even, odd);
  +        if (len2 & 1)
  +            crc1 = gf2_matrix_times64(even, crc1);
  +        len2 >>= 1;
  +
  +        /* if no more bits set, then done */
  +        if (len2 == 0)
  +            break;
  +
  +        /* another iteration of the loop with odd and even swapped */
  +        gf2_matrix_square64(odd, even);
  +        if (len2 & 1)
  +            crc1 = gf2_matrix_times64(odd, crc1);
  +        len2 >>= 1;
  +
  +        /* if no more bits set, then done */
  +    } while (len2 != 0);
  +
  +    /* return combined crc */
  +    crc1 ^= crc2;
  +    return crc1;
  +}
  +
  +/* ========================================================================= 
*/
  +/* adler32.c -- compute the Adler-32 checksum of a data stream
  + * Copyright (C) 1995-2004 Mark Adler
  + * For conditions of distribution and use, see copyright notice in zlib.h
  + */
  +
  +#define BASE 65521UL    /* 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)  {adler += (uint32_t) (buf)[i]; sum2 += adler;}
  +#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);
  +
  +/* use NO_DIVIDE if your processor does not do division in hardware */
  +#ifdef NO_DIVIDE
  +#  define MOD(a) \
  +    do { \
  +        if (a >= (BASE << 16)) a -= (BASE << 16); \
  +        if (a >= (BASE << 15)) a -= (BASE << 15); \
  +        if (a >= (BASE << 14)) a -= (BASE << 14); \
  +        if (a >= (BASE << 13)) a -= (BASE << 13); \
  +        if (a >= (BASE << 12)) a -= (BASE << 12); \
  +        if (a >= (BASE << 11)) a -= (BASE << 11); \
  +        if (a >= (BASE << 10)) a -= (BASE << 10); \
  +        if (a >= (BASE << 9)) a -= (BASE << 9); \
  +        if (a >= (BASE << 8)) a -= (BASE << 8); \
  +        if (a >= (BASE << 7)) a -= (BASE << 7); \
  +        if (a >= (BASE << 6)) a -= (BASE << 6); \
  +        if (a >= (BASE << 5)) a -= (BASE << 5); \
  +        if (a >= (BASE << 4)) a -= (BASE << 4); \
  +        if (a >= (BASE << 3)) a -= (BASE << 3); \
  +        if (a >= (BASE << 2)) a -= (BASE << 2); \
  +        if (a >= (BASE << 1)) a -= (BASE << 1); \
  +        if (a >= BASE) a -= BASE; \
  +    } while (0)
  +#  define MOD4(a) \
  +    do { \
  +        if (a >= (BASE << 4)) a -= (BASE << 4); \
  +        if (a >= (BASE << 3)) a -= (BASE << 3); \
  +        if (a >= (BASE << 2)) a -= (BASE << 2); \
  +        if (a >= (BASE << 1)) a -= (BASE << 1); \
  +        if (a >= BASE) a -= BASE; \
  +    } while (0)
  +#else
  +#  define MOD(a) a %= BASE
  +#  define MOD4(a) a %= BASE
  +#endif
  +
  +uint32_t __adler32(uint32_t adler, const uint8_t * buf, uint32_t len)
  +{
  +    uint32_t sum2;
  +    unsigned n;
  +
  +    /* split Adler-32 into component sums */
  +    sum2 = (adler >> 16) & 0xffff;
  +    adler &= 0xffff;
  +
  +    /* in case user likes doing a byte at a time, keep it fast */
  +    if (len == 1) {
  +        adler += (uint32_t) buf[0];
  +        if (adler >= BASE)
  +            adler -= BASE;
  +        sum2 += adler;
  +        if (sum2 >= BASE)
  +            sum2 -= BASE;
  +        return adler | (sum2 << 16);
  +    }
  +
  +    /* initial Adler-32 value (deferred check for len == 1 speed) */
  +    if (buf == NULL)
  +        return 1UL;
  +
  +    /* in case short lengths are provided, keep it somewhat fast */
  +    if (len < 16) {
  +        while (len--) {
  +            adler += (uint32_t) *buf++;
  +            sum2 += adler;
  +        }
  +        if (adler >= BASE)
  +            adler -= BASE;
  +        MOD4(sum2);             /* only added so many BASE's */
  +        return adler | (sum2 << 16);
  +    }
  +
  +    /* do length NMAX blocks -- requires just one modulo operation */
  +    while (len >= NMAX) {
  +        len -= NMAX;
  +        n = NMAX / 16;          /* NMAX is divisible by 16 */
  +        do {
  +            DO16(buf);          /* 16 sums unrolled */
  +            buf += 16;
  +        } while (--n);
  +        MOD(adler);
  +        MOD(sum2);
  +    }
  +
  +    /* do remaining bytes (less than NMAX, still just one modulo) */
  +    if (len) {                  /* avoid modulos if none remaining */
  +        while (len >= 16) {
  +            len -= 16;
  +            DO16(buf);
  +            buf += 16;
  +        }
  +        while (len--) {
  +            adler += (uint32_t) *buf++;
  +            sum2 += adler;
  +        }
  +        MOD(adler);
  +        MOD(sum2);
  +    }
  +
  +    /* return recombined sums */
  +    return adler | (sum2 << 16);
  +}
  +
  +uint32_t __adler32_combine(uint32_t adler1, uint32_t adler2, size_t len2)
  +     /[EMAIL PROTECTED]/
  +{
  +    uint32_t sum1;
  +    uint32_t sum2;
  +    unsigned rem;
  +
  +    /* the derivation of this formula is left as an exercise for the reader 
*/
  +    rem = (unsigned)(len2 % BASE);
  +    sum1 = adler1 & 0xffff;
  +    sum2 = rem * sum1;
  +    MOD(sum2);
  +    sum1 += (adler2 & 0xffff) + BASE - 1;
  +    sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - 
rem;
  +    if (sum1 > BASE) sum1 -= BASE;
  +    if (sum1 > BASE) sum1 -= BASE;
  +    if (sum2 > (BASE << 1)) sum2 -= (BASE << 1);
  +    if (sum2 > BASE) sum2 -= BASE;
  +    return sum1 | (sum2 << 16);
  +}
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/crc.h
  ============================================================================
  $ cvs diff -u -r0 -r1.1.2.1 crc.h
  --- /dev/null 2008-10-14 20:22:00 +0200
  +++ crc.h     2008-10-14 20:23:29 +0200
  @@ -0,0 +1,49 @@
  +/*!\file crc.h
  + * \brief CRC32, CRC64 and ADLER32 checksums.
  + */
  +
  +#include <sys/types.h>
  +#include <stdint.h>
  +
  +#ifndef  _CRC_H
  +#define  _CRC_H
  +
  +#ifdef __cplusplus
  +extern "C" {
  +#endif
  +
  +/**
  + */
  +uint32_t __crc32(uint32_t crc, const uint8_t * data, size_t size)
  +        /[EMAIL PROTECTED]/;
  +
  +/**
  + */
  +uint32_t __crc32_combine(uint32_t crc1, uint32_t crc2, size_t len2)
  +        /[EMAIL PROTECTED]/;
  +
  +/**
  + */
  +uint64_t __crc64(uint64_t crc, const uint8_t * data, size_t size)
  +        /[EMAIL PROTECTED]/;
  +
  +/**
  + */
  +uint64_t __crc64_combine(uint64_t crc1, uint64_t crc2, size_t len2)
  +        /[EMAIL PROTECTED]/;
  +
  +/**
  + */
  +uint32_t __adler32(uint32_t adler, const uint8_t * buf, uint32_t len)
  +        /[EMAIL PROTECTED]/;
  +
  +/**
  + */
  +uint32_t __adler32_combine(uint32_t adler1, uint32_t adler2, size_t len2)
  +        /[EMAIL PROTECTED]/;
  +
  +#ifdef __cplusplus
  +}
  +#endif
  +
  +#endif       /* _CRC_H */
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/digest.c
  ============================================================================
  $ cvs diff -u -r2.38.2.1 -r2.38.2.2 digest.c
  --- rpm/rpmio/digest.c        19 Aug 2008 15:31:41 -0000      2.38.2.1
  +++ rpm/rpmio/digest.c        14 Oct 2008 18:23:29 -0000      2.38.2.2
  @@ -10,6 +10,7 @@
   
   #include <rpmbc.h>
   
  +#include "crc.h"
   #include "md2.h"
   #include "md4.h"
   #include "sha224.h"
  @@ -29,48 +30,6 @@
   #define      DPRINTF(_a)
   #endif
   
  -#if !defined(ZLIB_H) || defined(__LCLINT__)
  -/**
  - */
  -/[EMAIL PROTECTED]@*/
  -static uint32_t crc32(uint32_t crc, const byte * data, size_t size)
  -     /[EMAIL PROTECTED]/
  -{
  -    static uint32_t polynomial = 0xedb88320;    /* reflected 0x04c11db7 */
  -    static uint32_t xorout = 0xffffffff;
  -    static uint32_t table[256];
  -
  -    crc ^= xorout;
  -
  -    if (data == NULL) {
  -     /* generate the table of CRC remainders for all possible bytes */
  -     uint32_t c;
  -     uint32_t i, j;
  -     for (i = 0;  i < 256;  i++) {
  -         c = i;
  -         for (j = 0;  j < 8;  j++) {
  -             if (c & 1)
  -                 c = polynomial ^ (c >> 1);
  -             else
  -                 c = (c >> 1);
  -         }
  -         table[i] = c;
  -     }
  -    } else
  -    while (size) {
  -     crc = table[(crc ^ *data) & 0xff] ^ (crc >> 8);
  -     size--;
  -     data++;
  -    }
  -
  -    crc ^= xorout;
  -
  -    return crc;
  -
  -}
  -/[EMAIL PROTECTED]@*/
  -#endif
  -
   /* Include Bob Jenkins lookup3 hash */
   #define      _JLU3_jlu32l
   #include "lookup3.c"
  @@ -120,138 +79,6 @@
        return 0;
   }
   
  -/*
  - * ECMA-182 polynomial, see
  - *     
http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-182.pdf
  - */
  -/**
  - */
  -static uint64_t crc64(uint64_t crc, const byte * data, size_t size)
  -     /[EMAIL PROTECTED]/
  -{
  -    static uint64_t polynomial =
  -     0xc96c5795d7870f42ULL;  /* reflected 0x42f0e1eba9ea3693ULL */
  -    static uint64_t xorout = 0xffffffffffffffffULL;
  -    static uint64_t table[256];
  -
  -    crc ^= xorout;
  -
  -    if (data == NULL) {
  -     /* generate the table of CRC remainders for all possible bytes */
  -     uint64_t c;
  -     uint32_t i, j;
  -     for (i = 0;  i < 256;  i++) {
  -         c = i;
  -         for (j = 0;  j < 8;  j++) {
  -             if (c & 1)
  -                 c = polynomial ^ (c >> 1);
  -             else
  -                 c = (c >> 1);
  -         }
  -         table[i] = c;
  -     }
  -    } else
  -    while (size) {
  -     crc = table[(crc ^ *data) & 0xff] ^ (crc >> 8);
  -     size--;
  -     data++;
  -    }
  -
  -    crc ^= xorout;
  -
  -    return crc;
  -
  -}
  -
  -/*
  - * Swiped from zlib, using uint64_t rather than unsigned long computation.
  - * Use at your own risk, uint64_t problems with compilers may exist.
  - */
  -#define      GF2_DIM 64
  -
  -/**
  - */
  -static uint64_t gf2_matrix_times(uint64_t *mat, uint64_t vec)
  -     /[EMAIL PROTECTED]/
  -{
  -    uint64_t sum;
  -
  -    sum = 0;
  -    while (vec) {
  -        if (vec & 1)
  -            sum ^= *mat;
  -        vec >>= 1;
  -        mat++;
  -    }
  -    return sum;
  -}
  -
  -/**
  - */
  -static void gf2_matrix_square(/[EMAIL PROTECTED]@*/ uint64_t *square, 
uint64_t *mat)
  -     /[EMAIL PROTECTED] square @*/
  -{
  -    int n;
  -
  -    for (n = 0; n < GF2_DIM; n++)
  -        square[n] = gf2_matrix_times(mat, mat[n]);
  -}
  -
  -/**
  - */
  -static uint64_t crc64_combine(uint64_t crc1, uint64_t crc2, size_t len2)
  -     /[EMAIL PROTECTED]/
  -{
  -    int n;
  -    uint64_t row;
  -    uint64_t even[GF2_DIM];    /* even-power-of-two zeros operator */
  -    uint64_t odd[GF2_DIM];     /* odd-power-of-two zeros operator */
  -
  -    /* degenerate case */
  -    if (len2 == 0)
  -        return crc1;
  -
  -    /* put operator for one zero bit in odd */
  -    odd[0] = 0xc96c5795d7870f42ULL;  /* reflected 0x42f0e1eba9ea3693ULL */
  -    row = 1;
  -    for (n = 1; n < GF2_DIM; n++) {
  -        odd[n] = row;
  -        row <<= 1;
  -    }
  -
  -    /* put operator for two zero bits in even */
  -    gf2_matrix_square(even, odd);
  -
  -    /* put operator for four zero bits in odd */
  -    gf2_matrix_square(odd, even);
  -
  -    /* apply len2 zeros to crc1 (first square will put the operator for one
  -       zero byte, eight zero bits, in even) */
  -    do {
  -        /* apply zeros operator for this bit of len2 */
  -        gf2_matrix_square(even, odd);
  -        if (len2 & 1)
  -            crc1 = gf2_matrix_times(even, crc1);
  -        len2 >>= 1;
  -
  -        /* if no more bits set, then done */
  -        if (len2 == 0)
  -            break;
  -
  -        /* another iteration of the loop with odd and even swapped */
  -        gf2_matrix_square(odd, even);
  -        if (len2 & 1)
  -            crc1 = gf2_matrix_times(odd, crc1);
  -        len2 >>= 1;
  -
  -        /* if no more bits set, then done */
  -    } while (len2 != 0);
  -
  -    /* return combined crc */
  -    crc1 ^= crc2;
  -    return crc1;
  -}
  -
   /**
    */
   typedef struct {
  @@ -500,10 +327,10 @@
        ctx->datasize = 8;
        {   sum32Param * mp = xcalloc(1, sizeof(*mp));
   /[EMAIL PROTECTED] @*/
  -         mp->update = (uint32_t (*)(uint32_t, const byte *, size_t)) crc32;
  +         mp->update = (uint32_t (*)(uint32_t, const uint8_t *, size_t)) 
__crc32;
   #if defined(ZLIB_H)
   #if defined(HAVE_ZLIB_CRC32_COMBINE)
  -         mp->combine = (uint32_t (*)(uint32_t, uint32_t, size_t)) 
crc32_combine;
  +         mp->combine = (uint32_t (*)(uint32_t, uint32_t, size_t)) 
__crc32_combine;
   #endif
   #endif
   /[EMAIL PROTECTED] @*/
  @@ -523,9 +350,9 @@
        {   sum32Param * mp = xcalloc(1, sizeof(*mp));
   /[EMAIL PROTECTED] @*/
   #if defined(ZLIB_H)
  -         mp->update = (uint32_t (*)(uint32_t, const byte *, size_t)) adler32;
  +         mp->update = (uint32_t (*)(uint32_t, const uint8_t *, size_t)) 
__adler32;
   #if defined(HAVE_ZLIB_ADLER32_COMBINE)
  -         mp->combine = (uint32_t (*)(uint32_t, uint32_t, size_t)) 
adler32_combine;
  +         mp->combine = (uint32_t (*)(uint32_t, uint32_t, size_t)) 
__adler32_combine;
   #endif
   #endif
   /[EMAIL PROTECTED] @*/
  @@ -561,8 +388,8 @@
        ctx->datasize = 8;
        {   sum64Param * mp = xcalloc(1, sizeof(*mp));
   /[EMAIL PROTECTED]@*/
  -         mp->update = (uint64_t (*)(uint64_t, const byte *, size_t)) crc64;
  -         mp->combine = (uint64_t (*)(uint64_t, uint64_t, size_t)) 
crc64_combine;
  +         mp->update = (uint64_t (*)(uint64_t, const uint8_t *, size_t)) 
__crc64;
  +         mp->combine = (uint64_t (*)(uint64_t, uint64_t, size_t)) 
__crc64_combine;
   /[EMAIL PROTECTED]@*/
            ctx->paramsize = sizeof(*mp);
            ctx->param = mp;
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to