From ac36dd47499046706dc9c464bc1df398fe6a578b Mon Sep 17 00:00:00 2001 From: jbj Date: Wed, 30 Apr 2003 00:11:40 +0000 Subject: [PATCH] beecrypt-3.0.0 merge: entropy_noise_gather converts bits-tp-bytes, not words. CVS patchset: 6791 CVS date: 2003/04/30 00:11:40 --- beecrypt/autogen.sh | 2 +- beecrypt/base64.c | 1 + beecrypt/beecrypt.c | 2 -- beecrypt/dhaes.c | 4 ++-- beecrypt/entropy.c | 2 +- beecrypt/fips186.c | 1 + beecrypt/mtprng.c | 2 +- beecrypt/tests/Makefile.am | 4 ++++ beecrypt/tests/beetest.c | 17 +++-------------- beecrypt/tests/benchbc.c | 4 ++-- beecrypt/tests/benchhf.c | 4 ++-- beecrypt/tests/benchme.c | 4 ++-- beecrypt/tests/openpgp.c | 17 ++--------------- beecrypt/tests/testblowfish.c | 4 ++-- beecrypt/tests/testdldp.c | 4 ++-- beecrypt/tests/testdsa.c | 4 ++-- beecrypt/tests/testhmacmd5.c | 4 ++-- beecrypt/tests/testhmacsha1.c | 4 ++-- beecrypt/tests/testmd5.c | 4 ++-- beecrypt/tests/testrsa.c | 4 ++-- beecrypt/tests/testsha1.c | 4 ++-- beecrypt/tests/testsha256.c | 4 ++-- 22 files changed, 40 insertions(+), 60 deletions(-) diff --git a/beecrypt/autogen.sh b/beecrypt/autogen.sh index b35834f..13965a1 100755 --- a/beecrypt/autogen.sh +++ b/beecrypt/autogen.sh @@ -38,7 +38,7 @@ if [ X"$@" = X -a "X`uname -s`" = "XLinux" ]; then mandir=/usr/man infodir=/usr/info fi - ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --infodir=${infodir} --mandir=${mandir} --enable-static "$@" + CPPFLAGS="-Wall -g" ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --infodir=${infodir} --mandir=${mandir} --enable-static "$@" else ./configure "$@" fi diff --git a/beecrypt/base64.c b/beecrypt/base64.c index 07150a3..306ed3d 100644 --- a/beecrypt/base64.c +++ b/beecrypt/base64.c @@ -24,6 +24,7 @@ #include "system.h" #include "base64.h" +#include "endianness.h" /* XXX swapu32 for crc */ #include "debug.h" /*@unchecked@*/ diff --git a/beecrypt/beecrypt.c b/beecrypt/beecrypt.c index 031db70..6ce1f90 100644 --- a/beecrypt/beecrypt.c +++ b/beecrypt/beecrypt.c @@ -214,8 +214,6 @@ int randomGeneratorContextInit(randomGeneratorContext* ctxt, const randomGenerat return -1; ctxt->rng = rng; - if (ctxt->param) /* XXX error? */ - free(ctxt->param); ctxt->param = (randomGeneratorParam*) calloc(rng->paramsize, 1); /*@-nullstate@*/ /* FIX: ctxt->param may be NULL */ diff --git a/beecrypt/dhaes.c b/beecrypt/dhaes.c index d341bee..ecc4a0b 100644 --- a/beecrypt/dhaes.c +++ b/beecrypt/dhaes.c @@ -203,10 +203,10 @@ static int dhaes_pContextSetup(dhaes_pContext* ctxt, const mpnumber* privkey, co } /* compute the hash of the message (ephemeral public) key and the shared secret */ - (void) hashFunctionContextReset (&ctxt->hash); + (void) hashFunctionContextReset (&ctxt->hash); (void) hashFunctionContextUpdateMP(&ctxt->hash, message); (void) hashFunctionContextUpdateMP(&ctxt->hash, &secret); - (void) hashFunctionContextDigest (&ctxt->hash, &digest); + (void) hashFunctionContextDigest (&ctxt->hash, digest); /* we don't need the secret anymore */ mpnwipe(&secret); diff --git a/beecrypt/entropy.c b/beecrypt/entropy.c index d90518f..f7bfee0 100644 --- a/beecrypt/entropy.c +++ b/beecrypt/entropy.c @@ -344,7 +344,7 @@ static int entropy_noise_gather(int fd, int samplesize, int channels, int swap, /*@modifies data, errno, fileSystem @*/ #endif { - size_t randombits = ((unsigned)size) << 5; + size_t randombits = size << 3; byte temp = 0; int rc, i; diff --git a/beecrypt/fips186.c b/beecrypt/fips186.c index 18b11ee..b1f0a2e 100644 --- a/beecrypt/fips186.c +++ b/beecrypt/fips186.c @@ -25,6 +25,7 @@ #include "system.h" #include "beecrypt.h" +#include "endianness.h" /* XXX for encodeInts */ #include "fips186.h" #include "mpopt.h" #include "mp.h" diff --git a/beecrypt/mtprng.c b/beecrypt/mtprng.c index aa3ef18..b01d4ac 100644 --- a/beecrypt/mtprng.c +++ b/beecrypt/mtprng.c @@ -96,7 +96,7 @@ int mtprngSetup(mtprngParam* mp) mp->left = 0; - return entropyGatherNext(mp->state, N+1); + return entropyGatherNext((byte*)mp->state, N+1); } return -1; } diff --git a/beecrypt/tests/Makefile.am b/beecrypt/tests/Makefile.am index 74cd44d..b973c93 100644 --- a/beecrypt/tests/Makefile.am +++ b/beecrypt/tests/Makefile.am @@ -27,6 +27,8 @@ LDADD = $(top_builddir)/libbeecrypt.la TESTS = testmd5 testsha1 testsha256 testhmacmd5 testhmacsha1 testblowfish testrsa testdldp +staticLDFLAGS = -all-static + check_PROGRAMS = testmd5 testsha1 testsha256 testhmacmd5 testhmacsha1 testblowfish testrsa testdldp testmd5_SOURCES = testmd5.c @@ -44,6 +46,8 @@ testblowfish_SOURCES = testblowfish.c testrsa_SOURCES = testrsa.c testdldp_SOURCES = testdldp.c +#testdldp_LDADD = $(LDADD) -lpthread +#testdldp_LDFLAGS = $(staticLDFLAGS) EXTRA_PROGRAMS = benchme benchhf benchbc diff --git a/beecrypt/tests/beetest.c b/beecrypt/tests/beetest.c index 86ecd6a..8636194 100644 --- a/beecrypt/tests/beetest.c +++ b/beecrypt/tests/beetest.c @@ -23,6 +23,8 @@ * */ +#include "system.h" + #include "beecrypt.h" #include "blockmode.h" #include "aes.h" @@ -39,20 +41,7 @@ #include "sha256.h" #include "mp.h" -#if HAVE_STDLIB_H -# include -#endif -#if HAVE_STRING_H -# include -#endif -#if HAVE_ERRNO_H -# include -#endif -#if HAVE_TIME_H -# include -#endif - -#include +#include "debug.h" /*@unchecked@*/ /*@observer@*/ static const char* dsa_p = "8df2a494492276aa3d25759bb06869cbeac0d83afb8d0cf7cbb8324f0d7882e5d0762fc5b7210eafc2e9adac32ab7aac49693dfbf83724c2ec0736ee31c80291"; diff --git a/beecrypt/tests/benchbc.c b/beecrypt/tests/benchbc.c index f0191e1..f99cfc1 100644 --- a/beecrypt/tests/benchbc.c +++ b/beecrypt/tests/benchbc.c @@ -22,10 +22,10 @@ * \author Bob Deblier */ +#include "system.h" #include "beecrypt.h" #include "timestamp.h" - -#include +#include "debug.h" #define SECONDS 10 diff --git a/beecrypt/tests/benchhf.c b/beecrypt/tests/benchhf.c index 3998c48..479e13d 100644 --- a/beecrypt/tests/benchhf.c +++ b/beecrypt/tests/benchhf.c @@ -22,10 +22,10 @@ * \author Bob Deblier */ -#include - +#include "system.h" #include "beecrypt.h" #include "timestamp.h" +#include "debug.h" #define SECONDS 10 diff --git a/beecrypt/tests/benchme.c b/beecrypt/tests/benchme.c index cb6d0ce..f42df0d 100644 --- a/beecrypt/tests/benchme.c +++ b/beecrypt/tests/benchme.c @@ -22,11 +22,11 @@ * \author Bob Deblier */ -#include - +#include "system.h" #include "beecrypt.h" #include "dldp.h" #include "timestamp.h" +#include "debug.h" #define SECONDS 10 diff --git a/beecrypt/tests/openpgp.c b/beecrypt/tests/openpgp.c index fdebccf..9339998 100644 --- a/beecrypt/tests/openpgp.c +++ b/beecrypt/tests/openpgp.c @@ -4,22 +4,9 @@ static int _debug = 0; +#include "system.h" #include "base64.h" - -#if HAVE_STDLIB_H -# include -#endif -#if HAVE_STRING_H -# include -#endif -#if HAVE_ERRNO_H -# include -#endif -#if HAVE_TIME_H -# include -#endif - -#include +#include "debug.h" static inline int grab(const byte *s, int nbytes) { diff --git a/beecrypt/tests/testblowfish.c b/beecrypt/tests/testblowfish.c index a13533d..5b1bbb1 100644 --- a/beecrypt/tests/testblowfish.c +++ b/beecrypt/tests/testblowfish.c @@ -23,9 +23,9 @@ * \ingroup UNIT_m */ -#include - +#include "system.h" #include "blowfish.h" +#include "debug.h" struct vector { diff --git a/beecrypt/tests/testdldp.c b/beecrypt/tests/testdldp.c index 4ad5bfc..a6e8c27 100644 --- a/beecrypt/tests/testdldp.c +++ b/beecrypt/tests/testdldp.c @@ -23,10 +23,10 @@ * \ingroup UNIT_m */ -#include - +#include "system.h" #include "beecrypt.h" #include "dldp.h" +#include "debug.h" int main() { diff --git a/beecrypt/tests/testdsa.c b/beecrypt/tests/testdsa.c index b11226a..d42c431 100644 --- a/beecrypt/tests/testdsa.c +++ b/beecrypt/tests/testdsa.c @@ -23,11 +23,11 @@ * \ingroup UNIT_m */ -#include - +#include "system.h" #include "beecrypt.h" #include "dlkp.h" #include "dsa.h" +#include "debug.h" static const char* dsa_p = "8df2a494492276aa3d25759bb06869cbeac0d83afb8d0cf7cbb8324f0d7882e5d0762fc5b7210eafc2e9adac32ab7aac49693dfbf83724c2ec0736ee31c80291"; static const char* dsa_q = "c773218c737ec8ee993b4f2ded30f48edace915f"; diff --git a/beecrypt/tests/testhmacmd5.c b/beecrypt/tests/testhmacmd5.c index 8c3ac01..a1e2ee2 100644 --- a/beecrypt/tests/testhmacmd5.c +++ b/beecrypt/tests/testhmacmd5.c @@ -24,9 +24,9 @@ * \ingroup UNIT_m */ -#include - +#include "system.h" #include "hmacmd5.h" +#include "debug.h" struct vector { diff --git a/beecrypt/tests/testhmacsha1.c b/beecrypt/tests/testhmacsha1.c index dd50094..1020c19 100644 --- a/beecrypt/tests/testhmacsha1.c +++ b/beecrypt/tests/testhmacsha1.c @@ -24,9 +24,9 @@ * \ingroup UNIT_m */ -#include - +#include "system.h" #include "hmacsha1.h" +#include "debug.h" struct vector { diff --git a/beecrypt/tests/testmd5.c b/beecrypt/tests/testmd5.c index ae89d62..b7776ef 100644 --- a/beecrypt/tests/testmd5.c +++ b/beecrypt/tests/testmd5.c @@ -24,9 +24,9 @@ * \ingroup UNIT_m */ -#include - +#include "system.h" #include "md5.h" +#include "debug.h" struct vector { diff --git a/beecrypt/tests/testrsa.c b/beecrypt/tests/testrsa.c index 1dd034b..07952b3 100644 --- a/beecrypt/tests/testrsa.c +++ b/beecrypt/tests/testrsa.c @@ -23,10 +23,10 @@ * \ingroup UNIT_m */ -#include - +#include "system.h" #include "beecrypt.h" #include "rsa.h" +#include "debug.h" static const char* rsa_n = "bbf82f090682ce9c2338ac2b9da871f7368d07eed41043a440d6b6f07454f51fb8dfbaaf035c02ab61ea48ceeb6fcd4876ed520d60e1ec4619719d8a5b8b807fafb8e0a3dfc737723ee6b4b7d93a2584ee6a649d060953748834b2454598394ee0aab12d7b61a51f527a9a41f6c1687fe2537298ca2a8f5946f8e5fd091dbdcb"; static const char* rsa_e = "11"; diff --git a/beecrypt/tests/testsha1.c b/beecrypt/tests/testsha1.c index af96d1c..1f00faf 100644 --- a/beecrypt/tests/testsha1.c +++ b/beecrypt/tests/testsha1.c @@ -24,10 +24,10 @@ * \ingroup UNIT_m */ -#include - +#include "system.h" #include "sha1.h" #include "memchunk.h" +#include "debug.h" struct vector { diff --git a/beecrypt/tests/testsha256.c b/beecrypt/tests/testsha256.c index 2ed871c..871e0a7 100644 --- a/beecrypt/tests/testsha256.c +++ b/beecrypt/tests/testsha256.c @@ -21,9 +21,9 @@ * */ -#include - +#include "system.h" #include "sha256.h" +#include "debug.h" struct vector { -- 2.7.4