diff options
author | jbj <devnull@localhost> | 2003-06-02 17:01:41 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2003-06-02 17:01:41 +0000 |
commit | c3d235daaf15afad506160cade5e52ed6939b454 (patch) | |
tree | cb262551151503451eb46fae391a3c2cc2b3cf94 /beecrypt | |
parent | 3ea8d7b1979c3bb88bffece0087f858b7a4678a7 (diff) | |
download | librpm-tizen-c3d235daaf15afad506160cade5e52ed6939b454.tar.gz librpm-tizen-c3d235daaf15afad506160cade5e52ed6939b454.tar.bz2 librpm-tizen-c3d235daaf15afad506160cade5e52ed6939b454.zip |
Yet another beecrypt-3.0.0 merge.
CVS patchset: 6882
CVS date: 2003/06/02 17:01:41
Diffstat (limited to 'beecrypt')
-rw-r--r-- | beecrypt/BENCHMARKS | 35 | ||||
-rw-r--r-- | beecrypt/README | 3 | ||||
-rw-r--r-- | beecrypt/acinclude.m4 | 2 | ||||
-rw-r--r-- | beecrypt/base64.c | 4 | ||||
-rw-r--r-- | beecrypt/beecrypt.gnu.h.in | 2 | ||||
-rw-r--r-- | beecrypt/beecrypt.h | 32 | ||||
-rw-r--r-- | beecrypt/beecrypt.win.h | 1 | ||||
-rw-r--r-- | beecrypt/blockpad.c | 4 | ||||
-rw-r--r-- | beecrypt/blowfish.c | 2 | ||||
-rw-r--r-- | beecrypt/configure.ac | 19 | ||||
-rw-r--r-- | beecrypt/dhaes.h | 8 | ||||
-rw-r--r-- | beecrypt/endianness.h | 2 | ||||
-rw-r--r-- | beecrypt/fips186.h | 2 | ||||
-rw-r--r-- | beecrypt/gas/aesopt.ppc.m4 | 2 | ||||
-rw-r--r-- | beecrypt/gas/blowfishopt.ppc.m4 | 6 | ||||
-rw-r--r-- | beecrypt/hmac.c | 2 | ||||
-rw-r--r-- | beecrypt/md5.c | 6 | ||||
-rw-r--r-- | beecrypt/md5.h | 2 | ||||
-rw-r--r-- | beecrypt/mp.c | 6 | ||||
-rw-r--r-- | beecrypt/sha1.c | 6 | ||||
-rw-r--r-- | beecrypt/sha1.h | 2 | ||||
-rw-r--r-- | beecrypt/sha256.c | 6 | ||||
-rw-r--r-- | beecrypt/sha256.h | 2 |
23 files changed, 86 insertions, 70 deletions
diff --git a/beecrypt/BENCHMARKS b/beecrypt/BENCHMARKS index eee4b2a4b..9eed9b1fd 100644 --- a/beecrypt/BENCHMARKS +++ b/beecrypt/BENCHMARKS @@ -1,4 +1,4 @@ -BeeCrypt 3.0.0 | gcc-3.3 | SuSE Linux 8.2 | Pentium 3 600 | 512 MB: 1447 (--with-arch=pentium3) +Note: timings are average values and may vary under different conditions, i.e. the amount of free memory, swapped memory, amount of cpu cache, etc. I've tried to make them as accurate as possible, within limits. @@ -10,30 +10,35 @@ Linux - I'm just a little cramped for space... BENCHmark Modular Exponentation (more is better): -BeeCrypt 3.0.0 | gcc-3.2.2 | Debian Linux 3.0 | Itanium 2 900 | 12 GB: 7317 () -BeeCrypt 3.0.0 | gcc-3.3 | RedHat AS 2.1 | P4 Xeon 2400 | 4 GB: 6920 (--with-arch=pentium4) -BeeCrypt 3.0.0 | gcc-2.95.4 | Debian Linux 3.0 | Alpha EV6.7 666 | 2 GB: 5742 () -BeeCrypt 3.0.0 | gcc-2.96 | RedHat AS 2.1 | P4 Xeon 2400 | 4 GB: 3280 (--with-arch=pentiumpro) -BeeCrypt 3.0.0 | gcc-3.2.2 | AIX 5.1 | POWER3-II 333 | 512 MB: 1782 (--with-arch=powerpc64) -BeeCrypt 3.0.0 | gcc-3.3 | SuSE Linux 8.2 | Pentium 3 600 | 512 MB: 1447 (--with-arch=pentium3) -BeeCrypt 3.0.0 | gcc-3.2.2 | AIX 5.1 | POWER3-II 333 | 512 MB: 756 () -BeeCrypt 3.0.0 | Forte C 5.1 | Solaris 8 | UltraSparc II 400 | 4 GB: 425 (--with-arch=sparcv8plus) -BeeCrypt 3.0.0 | | Debian Linux 3.0 | StrongARM 1110 128 | 32 MB: 341 () -BeeCrypt 3.0.0 | gcc-2.95.4 | Debian Linux 3.0r1 | M68030 25 | 36 MB: 8 () +BeeCrypt 3.0.0 | gcc-3.x | RedHat Linux | Opteron MP 1600 | : 17230 +BeeCrypt 3.0.0 | gcc-3.2.2 | Debian Linux 3.0 | Itanium 2 900 | 12 GB: 7317 +BeeCrypt 3.0.0 | gcc-3.3 | RedHat AS 2.1 | P4 Xeon 2400 | 4 GB: 6920 [--with-arch=pentium4] +BeeCrypt 3.0.0 | gcc-2.95.4 | Debian Linux 3.0 | Alpha EV6.7 666 | 2 GB: 5742 +BeeCrypt 3.0.0 | gcc-2.96 | RedHat AS 2.1 | P4 Xeon 2400 | 4 GB: 3280 [--with-arch=pentiumpro] +BeeCrypt 3.0.0 | gcc-3.x | RedHat Linux | POWER4+ 1200 | : 2592 +BeeCrypt 3.0.0 | gcc-3.x | RedHat Linux | P3 Xeon 900 | : 2169 +BeeCrypt 3.0.0 | gcc-3.2.2 | AIX 5.1 | POWER3-II 333 | 512 MB: 1782 [--with-arch=powerpc64] +BeeCrypt 3.0.0 | gcc-3.x | RedHat Linux | zSeries 900 | : 1687 (s390x) +BeeCrypt 3.0.0 | gcc-3.3 | SuSE Linux 8.2 | Pentium 3 600 | 512 MB: 1447 [--with-arch=pentium3] +BeeCrypt 3.0.0 | gcc-3.2.2 | AIX 5.1 | POWER3-II 333 | 512 MB: 756 +BeeCrypt 3.0.0 | Forte C 5.1 | Solaris 8 | UltraSparc II 400 | 4 GB: 425 [--with-arch=sparcv8plus] +BeeCrypt 3.0.0 | | Debian Linux 3.0 | StrongARM 1110 128 | 32 MB: 341 +BeeCrypt 3.0.0 | gcc-2.95.4 | Debian Linux 3.0r1 | M68040 33 | 52 MB: 24 +BeeCrypt 3.0.0 | gcc-2.95.4 | Debian Linux 3.0r1 | M68030 25 | 36 MB: 8 BENCHmark Hash Function (more is better): MD5 -BeeCrypt 3.0.0 | gcc-2.96 | RedHat AS 2.1 | P4 Xeon 2400 | 4 GB: 137.0 MB/s (--with-arch=pentiumpro) +BeeCrypt 3.0.0 | gcc-2.96 | RedHat AS 2.1 | P4 Xeon 2400 | 4 GB: 137.0 MB/s [--with-arch=pentiumpro] SHA-1 -BeeCrypt 3.0.0 | gcc-2.96 | RedHat AS 2.1 | P4 Xeon 2400 | 4 GB: 77.0 MB/s (--with-arch=pentiumpro) +BeeCrypt 3.0.0 | gcc-2.96 | RedHat AS 2.1 | P4 Xeon 2400 | 4 GB: 77.0 MB/s [--with-arch=pentiumpro] SHA-256 -BeeCrypt 3.0.0 | gcc-2.96 | RedHat AS 2.1 | P4 Xeon 2400 | 4 GB: 37.8 MB/s (--with-arch=pentiumpro) +BeeCrypt 3.0.0 | gcc-2.96 | RedHat AS 2.1 | P4 Xeon 2400 | 4 GB: 37.8 MB/s [--with-arch=pentiumpro] BENCHmark Block Cipher (more is better): AES, 128 bits -BLowfish, 128 bits +Blowfish, 128 bits diff --git a/beecrypt/README b/beecrypt/README index ed9f487cb..affc4288e 100644 --- a/beecrypt/README +++ b/beecrypt/README @@ -1,6 +1,7 @@ Welcome to the BeeCrypt crypto library! -Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002 Virtual Unlimited B.V. +Copyright (c) 1997, 1998, 1999, 2000, 2001 Virtual Unlimited B.V. +Copyright (c) 2002, 2003, Bob Deblier (for certain parts) Author: Bob Deblier <bob.deblier@pandora.be> diff --git a/beecrypt/acinclude.m4 b/beecrypt/acinclude.m4 index ae46b17f8..0de192d81 100644 --- a/beecrypt/acinclude.m4 +++ b/beecrypt/acinclude.m4 @@ -280,7 +280,7 @@ AC_DEFUN(BEECRYPT_GNU_CC,[ fi if test "$ac_enable_debug" = yes; then BEECRYPT_CFLAGS_REM([-O2]) - CFLAGS="$CFLAGS -Wall" + CFLAGS="$CFLAGS -Wall -pedantic" else # Generic optimizations, including cpu tuning BEECRYPT_CFLAGS_REM([-g]) diff --git a/beecrypt/base64.c b/beecrypt/base64.c index 4628d5bd0..ba5334bd2 100644 --- a/beecrypt/base64.c +++ b/beecrypt/base64.c @@ -252,7 +252,7 @@ char * b64encode (const void * data, size_t ns) if (s == NULL) return NULL; if (*s == '\0') return calloc(1, sizeof(*t)); - if (ns == 0) ns = strlen(s); + if (ns == 0) ns = strlen((const char*) s); nt = ((ns + 2) / 3) * 4; /* Add additional bytes necessary for eol string(s). */ @@ -316,7 +316,7 @@ fprintf(stderr, "%7u %02x %02x %02x -> %02x %02x %02x %02x\n", } /*@-mustfree -compdef @*/ - return t; + return (char *) t; /*@=mustfree =compdef @*/ } /*@=globs =internalglobs =modfilesys @*/ diff --git a/beecrypt/beecrypt.gnu.h.in b/beecrypt/beecrypt.gnu.h.in index 824fd0d42..0b1afeeaf 100644 --- a/beecrypt/beecrypt.gnu.h.in +++ b/beecrypt/beecrypt.gnu.h.in @@ -24,9 +24,11 @@ @INCLUDE_STDINT_H@ @INCLUDE_SYNCH_H@ @INCLUDE_PTHREAD_H@ +@INCLUDE_STDIO_H@ @INCLUDE_STDLIB_H@ @INCLUDE_MALLOC_H@ @INCLUDE_STRING_H@ +@INCLUDE_UNISTD_H@ @TYPEDEF_BC_LOCK_T@ diff --git a/beecrypt/beecrypt.h b/beecrypt/beecrypt.h index e7f0bae75..c0bb34cc8 100644 --- a/beecrypt/beecrypt.h +++ b/beecrypt/beecrypt.h @@ -187,7 +187,7 @@ typedef struct { /*@observer@*/ const char* name; /*!< random generator name */ - const unsigned int paramsize; + const size_t paramsize; const randomGeneratorSetup setup; const randomGeneratorSeed seed; const randomGeneratorNext next; @@ -334,9 +334,9 @@ typedef struct { /*@observer@*/ const char* name; /*!< hash function name */ - const unsigned int paramsize; /*!< in bytes */ - const unsigned int blocksize; /*!< in bytes */ - const unsigned int digestsize; /*!< in bytes */ + const size_t paramsize; /*!< in bytes */ + const size_t blocksize; /*!< in bytes */ + const size_t digestsize; /*!< in bytes */ const hashFunctionReset reset; const hashFunctionUpdate update; const hashFunctionDigest digest; @@ -535,12 +535,12 @@ typedef struct { /*@observer@*/ const char* name; /*!< keyed hash function name */ - const unsigned int paramsize; /*!< in bytes */ - const unsigned int blocksize; /*!< in bytes */ - const unsigned int digestsize; /*!< in bytes */ - const unsigned int keybitsmin; /*!< min keysize in bits */ - const unsigned int keybitsmax; /*!< max keysize in bits */ - const unsigned int keybitsinc; /*!< keysize increment in bits */ + const size_t paramsize; /*!< in bytes */ + const size_t blocksize; /*!< in bytes */ + const size_t digestsize; /*!< in bytes */ + const size_t keybitsmin; /*!< min keysize in bits */ + const size_t keybitsmax; /*!< max keysize in bits */ + const size_t keybitsinc; /*!< keysize increment in bits */ const keyedHashFunctionSetup setup; const keyedHashFunctionReset reset; const keyedHashFunctionUpdate update; @@ -750,16 +750,16 @@ typedef struct { /*@observer@*/ const char* name; /*!< block cipher name */ - const unsigned int paramsize; /*!< in bytes */ - const unsigned int blocksize; /*!< in bytes */ - const unsigned int keybitsmin; /*!< min keysize in bits */ - const unsigned int keybitsmax; /*!< max keysize in bits */ - const unsigned int keybitsinc; /*!< keysize increment in bits */ + const size_t paramsize; /*!< in bytes */ + const size_t blocksize; /*!< in bytes */ + const size_t keybitsmin; /*!< min keysize in bits */ + const size_t keybitsmax; /*!< max keysize in bits */ + const size_t keybitsinc; /*!< keysize increment in bits */ const blockCipherSetup setup; const blockCipherSetIV setiv; const blockCipherEncrypt encrypt; const blockCipherDecrypt decrypt; - const blockCipherFeedback getfb; + const blockCipherFeedback getfb; } blockCipher; #ifdef __cplusplus diff --git a/beecrypt/beecrypt.win.h b/beecrypt/beecrypt.win.h index a3f97bba4..234384d98 100644 --- a/beecrypt/beecrypt.win.h +++ b/beecrypt/beecrypt.win.h @@ -52,6 +52,7 @@ #endif #if defined(_MSC_VER) || __MWERKS__ +#include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/beecrypt/blockpad.c b/beecrypt/blockpad.c index 429de138c..3e2fe73ee 100644 --- a/beecrypt/blockpad.c +++ b/beecrypt/blockpad.c @@ -47,7 +47,7 @@ memchunk* pkcs5Unpad(size_t blockbytes, memchunk* tmp) if (tmp) { byte padvalue; - int i; + unsigned int i; /*@-usedef@*/ /* LCL: tmp->{data,size} not initialized? */ if (tmp->data == (byte*) 0) @@ -95,7 +95,7 @@ memchunk* pkcs5UnpadCopy(/*@unused@*/ size_t blockbytes, const memchunk* src) { memchunk* tmp; byte padvalue; - int i; + unsigned int i; if (src == (memchunk*) 0) return (memchunk*) 0; diff --git a/beecrypt/blowfish.c b/beecrypt/blowfish.c index b7cb73eb6..45cb62f71 100644 --- a/beecrypt/blowfish.c +++ b/beecrypt/blowfish.c @@ -323,7 +323,7 @@ int blowfishSetup(blowfishParam* bp, const byte* key, size_t keybits, cipherOper { register uint32_t* p = bp->p; register uint32_t* s = bp->s; - register int i, j, k; + register unsigned int i, j, k; uint32_t tmp, work[2]; diff --git a/beecrypt/configure.ac b/beecrypt/configure.ac index 1e49aca9b..21e960fd8 100644 --- a/beecrypt/configure.ac +++ b/beecrypt/configure.ac @@ -309,13 +309,9 @@ esac AH_TEMPLATE([HAVE_CTYPE_H],[.]) AH_TEMPLATE([HAVE_ERRNO_H],[.]) AH_TEMPLATE([HAVE_FCNTL_H],[.]) -AH_TEMPLATE([HAVE_MALLOC_H],[.]) -AH_TEMPLATE([HAVE_STDLIB_H],[.]) -AH_TEMPLATE([HAVE_STRING_H],[.]) AH_TEMPLATE([HAVE_TERMIO_H],[.]) AH_TEMPLATE([HAVE_TERMIOS_H],[.]) AH_TEMPLATE([HAVE_TIME_H],[.]) -AH_TEMPLATE([HAVE_UNISTD_H],[.]) AH_TEMPLATE([HAVE_SYS_AUDIOIO_H],[.]) AH_TEMPLATE([HAVE_SYS_IOCTL_H],[.]) @@ -330,7 +326,6 @@ AH_TEMPLATE([HAVE_SYNCH_H],[.]) AH_TEMPLATE([HAVE_SEMAPHORE_H],[.]) AH_TEMPLATE([HAVE_AIO_H],[.]) -AH_TEMPLATE([HAVE_MTMALLOC_H],[.]) AH_TEMPLATE([HAVE_DEV_AUDIO],[Define to 1 if your system has device /dev/audio]) AH_TEMPLATE([HAVE_DEV_DSP],[Define to 1 if your system has device /dev/dsp]) @@ -357,12 +352,17 @@ AH_BOTTOM([ AC_HEADER_STDC AC_CHECK_HEADERS([time.h sys/time.h]) AC_HEADER_TIME -AC_CHECK_HEADERS([ctype.h errno.h fcntl.h malloc.h termio.h termios.h]) -AC_CHECK_HEADERS([sys/ioctl sys/audioio.h sys/soundcard.h]) +AC_CHECK_HEADERS([stdio.h ctype.h errno.h fcntl.h malloc.h termio.h termios.h]) +AC_CHECK_HEADERS([sys/ioctl.h sys/audioio.h sys/soundcard.h]) +bc_include_stdio_h= bc_include_stdlib_h= bc_include_malloc_h= bc_include_string_h= +bc_include_unistd_h= +if test "$ac_cv_header_stdio_h" = yes; then + bc_include_stdio_h="#include <stdio.h>" +fi if test "$ac_cv_header_stdlib_h" = yes; then bc_include_stdlib_h="#include <stdlib.h>" elif test "$ac_cv_header_malloc_h" = yes; then @@ -378,9 +378,14 @@ fi if test "$ac_cv_header_string_h" = yes; then bc_include_string_h="#include <string.h>" fi +if test "$ac_cv_header_unistd_h" = yes; then + bc_include_unistd_h="#include <unistd.h>" +fi +AC_SUBST(INCLUDE_STDIO_H,$bc_include_stdio_h) AC_SUBST(INCLUDE_STDLIB_H,$bc_include_stdlib_h) AC_SUBST(INCLUDE_MALLOC_H,$bc_include_malloc_h) AC_SUBST(INCLUDE_STRING_H,$bc_include_string_h) +AC_SUBST(INCLUDE_UNISTD_H,$bc_include_unistd_h) if test "$ac_enable_threads" = yes; then AC_CHECK_HEADERS([thread.h pthread.h synch.h semaphore.h]) diff --git a/beecrypt/dhaes.h b/beecrypt/dhaes.h index aca8da2f3..5ae3683ce 100644 --- a/beecrypt/dhaes.h +++ b/beecrypt/dhaes.h @@ -44,8 +44,8 @@ typedef struct const hashFunction* hash; const blockCipher* cipher; const keyedHashFunction* mac; - int cipherkeybits; - int mackeybits; + size_t cipherkeybits; + size_t mackeybits; } dhaes_pParameters; /** @@ -58,8 +58,8 @@ typedef struct hashFunctionContext hash; blockCipherContext cipher; keyedHashFunctionContext mac; - int cipherkeybits; - int mackeybits; + size_t cipherkeybits; + size_t mackeybits; } dhaes_pContext; #ifdef __cplusplus diff --git a/beecrypt/endianness.h b/beecrypt/endianness.h index 1fa2418b6..df9942e7c 100644 --- a/beecrypt/endianness.h +++ b/beecrypt/endianness.h @@ -26,8 +26,6 @@ #include "beecrypt.h" -#include <stdio.h> - #ifdef __cplusplus inline int16_t swap16(int16_t n) { diff --git a/beecrypt/fips186.h b/beecrypt/fips186.h index 46dfcd8c6..423e09797 100644 --- a/beecrypt/fips186.h +++ b/beecrypt/fips186.h @@ -51,7 +51,7 @@ typedef struct sha1Param param; mpw state[FIPS186_STATE_SIZE]; byte digest[20]; - int digestremain; + unsigned char digestremain; } fips186Param; #ifdef __cplusplus diff --git a/beecrypt/gas/aesopt.ppc.m4 b/beecrypt/gas/aesopt.ppc.m4 index f81f3a50a..92994050c 100644 --- a/beecrypt/gas/aesopt.ppc.m4 +++ b/beecrypt/gas/aesopt.ppc.m4 @@ -1,6 +1,6 @@ dnl aesopt.ppc.m4 dnl -dnl NOTE: Only works for big-endian PowerPC! +dnl NOTE: Only tested for big-endian PowerPC! dnl dnl Copyright (c) 2003 Bob Deblier dnl diff --git a/beecrypt/gas/blowfishopt.ppc.m4 b/beecrypt/gas/blowfishopt.ppc.m4 index 74214aa9c..09c64e663 100644 --- a/beecrypt/gas/blowfishopt.ppc.m4 +++ b/beecrypt/gas/blowfishopt.ppc.m4 @@ -1,5 +1,7 @@ dnl blowfishopt.ppc.m4 dnl +dnl Note: Only tested on big-endian PowerPC! +dnl dnl Copyright (c) 2003 Bob Deblier dnl dnl Author: Bob Deblier <bob.deblier@pandora.be> @@ -101,7 +103,7 @@ ifelse(ASM_BIGENDIAN,yes,` li r0,0 lwbrx r7,r5,r0 li r0,4 - lwbrx r7,r5,r0 + lwbrx r8,r5,r0 ') eblock @@ -113,7 +115,7 @@ ifelse(ASM_BIGENDIAN,yes,` li r0,4 stwbrx r7,r4,r0 li r0,0 - stwbrx r7,r4,r0 + stwbrx r8,r4,r0 ') li r3,0 diff --git a/beecrypt/hmac.c b/beecrypt/hmac.c index c8934d73d..448d86f9c 100644 --- a/beecrypt/hmac.c +++ b/beecrypt/hmac.c @@ -42,7 +42,7 @@ int hmacSetup(byte* kxi, byte* kxo, const hashFunction* hash, hashFunctionParam* param, const byte* key, size_t keybits) { - register unsigned i; + register unsigned int i; size_t keybytes = keybits >> 3; /* if the key is too large, hash it first */ diff --git a/beecrypt/md5.c b/beecrypt/md5.c index 73f2e55c5..ecef23ff3 100644 --- a/beecrypt/md5.c +++ b/beecrypt/md5.c @@ -174,7 +174,7 @@ void md5Process(md5Param* mp) int md5Update(md5Param* mp, const byte* data, size_t size) { - register int proclength; + register unsigned short proclength; #if (MP_WBITS == 64) mpw add[1]; @@ -193,13 +193,13 @@ int md5Update(md5Param* mp, const byte* data, size_t size) /*@-type@*/ while (size > 0) { - proclength = ((mp->offset + size) > 64) ? (64 - mp->offset) : size; + proclength = ((mp->offset + size) > 64U) ? (64U - mp->offset) : size; memmove(((byte *) mp->data) + mp->offset, data, proclength); size -= proclength; data += proclength; mp->offset += proclength; - if (mp->offset == 64) + if (mp->offset == 64U) { md5Process(mp); mp->offset = 0; diff --git a/beecrypt/md5.h b/beecrypt/md5.h index 40dcf41c3..1205ea9df 100644 --- a/beecrypt/md5.h +++ b/beecrypt/md5.h @@ -41,7 +41,7 @@ typedef struct #else # error #endif - short offset; + unsigned short offset; } md5Param; #ifdef __cplusplus diff --git a/beecrypt/mp.c b/beecrypt/mp.c index b4685f055..03c0945f0 100644 --- a/beecrypt/mp.c +++ b/beecrypt/mp.c @@ -1028,7 +1028,7 @@ size_t mprshiftlsz(size_t size, mpw* data) /* count 'all zero' words and move src pointer */ while (size--) { - /* test if we a non-zero word */ + /* test if we have a non-zero word */ if ((carry = *(slide--))) { /* count 'least signification zero bits and set zbits counter */ @@ -1042,6 +1042,9 @@ size_t mprshiftlsz(size_t size, mpw* data) zwords++; } + if ((rbits == 0) && (zwords == 0)) + return 0; + /* shouldn't happen, but let's test anyway */ if (size == 0) return 0; @@ -1096,7 +1099,6 @@ void mpgcd_w(size_t size, const mpw* xdata, const mpw* ydata, mpw* result, mpw* /* get the smallest returned values, and set shift to that */ shift = mprshiftlsz(size, wksp); - temp = mprshiftlsz(size, result); if (shift > temp) diff --git a/beecrypt/sha1.c b/beecrypt/sha1.c index 69ccbf65c..8af1c8d65 100644 --- a/beecrypt/sha1.c +++ b/beecrypt/sha1.c @@ -201,7 +201,7 @@ void sha1Process(sha1Param* sp) int sha1Update(sha1Param* sp, const byte* data, size_t size) { - register int proclength; + register unsigned short proclength; #if (MP_WBITS == 64) mpw add[1]; @@ -220,13 +220,13 @@ int sha1Update(sha1Param* sp, const byte* data, size_t size) /*@-type@*/ while (size > 0) { - proclength = ((sp->offset + size) > 64) ? (64 - sp->offset) : size; + proclength = ((sp->offset + size) > 64U) ? (64U - sp->offset) : size; memmove(((byte *) sp->data) + sp->offset, data, proclength); size -= proclength; data += proclength; sp->offset += proclength; - if (sp->offset == 64) + if (sp->offset == 64U) { sha1Process(sp); sp->offset = 0; diff --git a/beecrypt/sha1.h b/beecrypt/sha1.h index 0e6c7bc27..1729e663a 100644 --- a/beecrypt/sha1.h +++ b/beecrypt/sha1.h @@ -41,7 +41,7 @@ typedef struct #else # error #endif - short offset; + unsigned short offset; } sha1Param; #ifdef __cplusplus diff --git a/beecrypt/sha256.c b/beecrypt/sha256.c index c96ca78cb..574d02311 100644 --- a/beecrypt/sha256.c +++ b/beecrypt/sha256.c @@ -191,7 +191,7 @@ void sha256Process(sha256Param* sp) int sha256Update(sha256Param* sp, const byte* data, size_t size) { - register int proclength; + register unsigned short proclength; #if (MP_WBITS == 64) mpw add[1]; @@ -210,13 +210,13 @@ int sha256Update(sha256Param* sp, const byte* data, size_t size) /*@-type@*/ while (size > 0) { - proclength = ((sp->offset + size) > 64) ? (64 - sp->offset) : size; + proclength = ((sp->offset + size) > 64U) ? (64U - sp->offset) : size; memmove(((byte *) sp->data) + sp->offset, data, proclength); size -= proclength; data += proclength; sp->offset += proclength; - if (sp->offset == 64) + if (sp->offset == 64U) { sha256Process(sp); sp->offset = 0; diff --git a/beecrypt/sha256.h b/beecrypt/sha256.h index 390d228e9..e2d83e77c 100644 --- a/beecrypt/sha256.h +++ b/beecrypt/sha256.h @@ -41,7 +41,7 @@ typedef struct #else # error #endif - short offset; + unsigned short offset; } sha256Param; #ifdef __cplusplus |