From 6626798a65dcf66c7268d4dca95a32e140b01c40 Mon Sep 17 00:00:00 2001 From: jbj Date: Mon, 2 Aug 2004 02:23:27 +0000 Subject: [PATCH] Add system.h and debug.h, remove internal include path structure. CVS patchset: 7376 CVS date: 2004/08/02 02:23:27 --- beecrypt/aes.c | 14 +++---- beecrypt/base64.c | 14 ++----- beecrypt/beecrypt.c | 32 ++++++++-------- beecrypt/blockmode.c | 8 ++-- beecrypt/blockpad.c | 8 ++-- beecrypt/blowfish.c | 10 ++--- beecrypt/debug.h | 13 +++++++ beecrypt/dhaes.c | 14 +++---- beecrypt/dldp.c | 12 +++--- beecrypt/dlkp.c | 8 ++-- beecrypt/dlpk.c | 8 ++-- beecrypt/dlsvdp-dh.c | 8 ++-- beecrypt/dsa.c | 10 ++--- beecrypt/elgamal.c | 10 ++--- beecrypt/endianness.c | 8 ++-- beecrypt/entropy.c | 32 +++------------- beecrypt/fips186.c | 8 ++-- beecrypt/hmac.c | 10 ++--- beecrypt/hmacmd5.c | 8 ++-- beecrypt/hmacsha1.c | 8 ++-- beecrypt/hmacsha256.c | 8 ++-- beecrypt/java/javaglue.c | 23 ++++------- beecrypt/md5.c | 10 ++--- beecrypt/memchunk.c | 8 ++-- beecrypt/mp.c | 10 ++--- beecrypt/mpbarrett.c | 14 +++---- beecrypt/mpnumber.c | 8 ++-- beecrypt/mpprime.c | 8 ++-- beecrypt/mtprng.c | 8 ++-- beecrypt/pkcs1.c | 6 ++- beecrypt/pkcs12.c | 6 ++- beecrypt/python/_bc-py.c | 8 ++-- beecrypt/python/debug-py.c | 6 ++- beecrypt/python/mpw-py.c | 9 +++-- beecrypt/python/rng-py.c | 7 +++- beecrypt/rsa.c | 8 ++-- beecrypt/rsakp.c | 10 ++--- beecrypt/rsapk.c | 8 ++-- beecrypt/sha1.c | 10 ++--- beecrypt/sha256.c | 10 ++--- beecrypt/system.h | 89 +++++++++++++++++++++++++++++++++++++++++++ beecrypt/tests/benchbc.c | 4 +- beecrypt/tests/benchhf.c | 4 +- beecrypt/tests/benchme.c | 4 +- beecrypt/tests/testaes.c | 4 +- beecrypt/tests/testblowfish.c | 4 +- beecrypt/tests/testconv.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/testmp.c | 4 +- beecrypt/tests/testmpinv.c | 4 +- beecrypt/tests/testrsa.c | 4 +- beecrypt/tests/testsha1.c | 4 +- beecrypt/tests/testsha256.c | 4 +- beecrypt/tests/testutil.c | 4 +- beecrypt/timestamp.c | 19 ++------- 59 files changed, 323 insertions(+), 281 deletions(-) create mode 100644 beecrypt/debug.h create mode 100644 beecrypt/system.h diff --git a/beecrypt/aes.c b/beecrypt/aes.c index 2d73776..959f0fc 100644 --- a/beecrypt/aes.c +++ b/beecrypt/aes.c @@ -27,13 +27,9 @@ * \ingroup BC_aes_m BC_m */ -#define BEECRYPT_DLL_EXPORT +#include "system.h" -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include "beecrypt/aes.h" +#include "aes.h" #if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && defined(LITTLE_ENDIAN) # if (BYTE_ORDER != BIG_ENDIAN) && (BYTE_ORDER != LITTLE_ENDIAN) @@ -42,11 +38,13 @@ #endif #if WORDS_BIGENDIAN -# include "beecrypt/aes_be.h" +# include "aes_be.h" #else -# include "beecrypt/aes_le.h" +# include "aes_le.h" #endif +#include "debug.h" + #ifdef ASM_AESENCRYPTECB extern int aesEncryptECB(aesParam*, uint32_t*, const uint32_t*, unsigned int); #endif diff --git a/beecrypt/base64.c b/beecrypt/base64.c index 789eba1..3f99d0a 100644 --- a/beecrypt/base64.c +++ b/beecrypt/base64.c @@ -22,18 +22,12 @@ * \author Bob Deblier */ -#define BEECRYPT_DLL_EXPORT +#include "system.h" -#if HAVE_CONFIG_H -# include "config.h" -#endif +#include "base64.h" +#include "endianness.h" -#include "beecrypt/base64.h" -#include "beecrypt/endianness.h" - -#if HAVE_CTYPE_H -# include -#endif +#include "debug.h" static const char* to_b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; diff --git a/beecrypt/beecrypt.c b/beecrypt/beecrypt.c index b8bc974..1a7a1b3 100644 --- a/beecrypt/beecrypt.c +++ b/beecrypt/beecrypt.c @@ -22,30 +22,28 @@ * \ingroup ES_m PRNG_m HASH_m HMAC_m BC_m */ -#define BEECRYPT_DLL_EXPORT +#include "system.h" -#if HAVE_CONFIG_H -# include "config.h" -#endif +#include "beecrypt.h" -#include "beecrypt/beecrypt.h" +#include "entropy.h" -#include "beecrypt/entropy.h" +#include "fips186.h" +#include "mtprng.h" -#include "beecrypt/fips186.h" -#include "beecrypt/mtprng.h" +#include "md5.h" +#include "sha1.h" +#include "sha256.h" -#include "beecrypt/md5.h" -#include "beecrypt/sha1.h" -#include "beecrypt/sha256.h" +#include "hmacmd5.h" +#include "hmacsha1.h" +#include "hmacsha256.h" -#include "beecrypt/hmacmd5.h" -#include "beecrypt/hmacsha1.h" -#include "beecrypt/hmacsha256.h" +#include "aes.h" +#include "blowfish.h" +#include "blockmode.h" -#include "beecrypt/aes.h" -#include "beecrypt/blowfish.h" -#include "beecrypt/blockmode.h" +#include "debug.h" static entropySource entropySourceList[] = { diff --git a/beecrypt/blockmode.c b/beecrypt/blockmode.c index 6a19ed5..6ec12c9 100644 --- a/beecrypt/blockmode.c +++ b/beecrypt/blockmode.c @@ -23,13 +23,11 @@ * \ingroup BC_m */ -#define BEECRYPT_DLL_EXPORT +#include "system.h" -#if HAVE_CONFIG_H -# include "config.h" -#endif +#include "blockmode.h" -#include "beecrypt/blockmode.h" +#include "debug.h" int blockEncryptECB(const blockCipher* bc, blockCipherParam* bp, uint32_t* dst, const uint32_t* src, unsigned int nblocks) { diff --git a/beecrypt/blockpad.c b/beecrypt/blockpad.c index 9bc73f1..c5e4c6b 100644 --- a/beecrypt/blockpad.c +++ b/beecrypt/blockpad.c @@ -23,13 +23,11 @@ * \ingroup BC_m */ -#define BEECRYPT_DLL_EXPORT +#include "system.h" -#if HAVE_CONFIG_H -# include "config.h" -#endif +#include "blockpad.h" -#include "beecrypt/blockpad.h" +#include "debug.h" memchunk* pkcs5Pad(size_t blockbytes, memchunk* tmp) { diff --git a/beecrypt/blowfish.c b/beecrypt/blowfish.c index 47eca2a..6611d13 100644 --- a/beecrypt/blowfish.c +++ b/beecrypt/blowfish.c @@ -23,14 +23,12 @@ * \ingroup BC_m BC_blowfish_m */ -#define BEECRYPT_DLL_EXPORT +#include "system.h" -#if HAVE_CONFIG_H -# include "config.h" -#endif +#include "blowfish.h" +#include "endianness.h" -#include "beecrypt/blowfish.h" -#include "beecrypt/endianness.h" +#include "debug.h" #ifdef ASM_BLOWFISHENCRYPTECB extern int blowfishEncryptECB(blowfishparam*, uint32_t*, const uint32_t*, unsigned int); diff --git a/beecrypt/debug.h b/beecrypt/debug.h new file mode 100644 index 0000000..19376c0 --- /dev/null +++ b/beecrypt/debug.h @@ -0,0 +1,13 @@ +/** + * To be included after all other includes. + */ +#ifndef H_DEBUG +#define H_DEBUG + +#include + +#ifdef DMALLOC +#include +#endif + +#endif /* H_DEBUG */ diff --git a/beecrypt/dhaes.c b/beecrypt/dhaes.c index 994cd6f..1c84f6b 100644 --- a/beecrypt/dhaes.c +++ b/beecrypt/dhaes.c @@ -23,16 +23,14 @@ * \ingroup DL_m DL_dh_m */ -#define BEECRYPT_DLL_EXPORT +#include "system.h" -#if HAVE_CONFIG_H -# include "config.h" -#endif +#include "dhaes.h" +#include "dlsvdp-dh.h" +#include "blockmode.h" +#include "blockpad.h" -#include "beecrypt/dhaes.h" -#include "beecrypt/dlsvdp-dh.h" -#include "beecrypt/blockmode.h" -#include "beecrypt/blockpad.h" +#include "debug.h" /* * Good combinations will be: diff --git a/beecrypt/dldp.c b/beecrypt/dldp.c index 51f32e6..e32e346 100644 --- a/beecrypt/dldp.c +++ b/beecrypt/dldp.c @@ -23,15 +23,13 @@ * \ingroup DL_m */ -#define BEECRYPT_DLL_EXPORT +#include "system.h" -#if HAVE_CONFIG_H -# include "config.h" -#endif +#include "dldp.h" +#include "mp.h" +#include "mpprime.h" -#include "beecrypt/dldp.h" -#include "beecrypt/mp.h" -#include "beecrypt/mpprime.h" +#include "debug.h" /*!\addtogroup DL_m * \{ diff --git a/beecrypt/dlkp.c b/beecrypt/dlkp.c index 65dc185..6ff3102 100644 --- a/beecrypt/dlkp.c +++ b/beecrypt/dlkp.c @@ -23,13 +23,11 @@ * \ingroup DL_m */ -#define BEECRYPT_DLL_EXPORT +#include "system.h" -#if HAVE_CONFIG_H -# include "config.h" -#endif +#include "dlkp.h" -#include "beecrypt/dlkp.h" +#include "debug.h" int dlkp_pPair(dlkp_p* kp, randomGeneratorContext* rgc, const dldp_p* param) { diff --git a/beecrypt/dlpk.c b/beecrypt/dlpk.c index 02dc622..2efc83a 100644 --- a/beecrypt/dlpk.c +++ b/beecrypt/dlpk.c @@ -23,13 +23,11 @@ * \ingroup DL_m */ -#define BEECRYPT_DLL_EXPORT +#include "system.h" -#if HAVE_CONFIG_H -# include "config.h" -#endif +#include "dlpk.h" -#include "beecrypt/dlpk.h" +#include "debug.h" /*!\addtogroup DL_m * \{ diff --git a/beecrypt/dlsvdp-dh.c b/beecrypt/dlsvdp-dh.c index 9f1cb68..5f56364 100644 --- a/beecrypt/dlsvdp-dh.c +++ b/beecrypt/dlsvdp-dh.c @@ -27,13 +27,11 @@ * \ingroup DL_m DL_dh_m */ -#define BEECRYPT_DLL_EXPORT +#include "system.h" -#if HAVE_CONFIG_H -# include "config.h" -#endif +#include "dlsvdp-dh.h" -#include "beecrypt/dlsvdp-dh.h" +#include "debug.h" /*!\addtogroup DL_dh_m * \{ diff --git a/beecrypt/dsa.c b/beecrypt/dsa.c index 291392f..4772a27 100644 --- a/beecrypt/dsa.c +++ b/beecrypt/dsa.c @@ -22,14 +22,12 @@ * \ingroup DL_m DL_dsa_m */ -#define BEECRYPT_DLL_EXPORT +#include "system.h" -#if HAVE_CONFIG_H -# include "config.h" -#endif +#include "dsa.h" +#include "dldp.h" -#include "beecrypt/dsa.h" -#include "beecrypt/dldp.h" +#include "debug.h" int dsasign(const mpbarrett* p, const mpbarrett* q, const mpnumber* g, randomGeneratorContext* rgc, const mpnumber* hm, const mpnumber* x, mpnumber* r, mpnumber* s) { diff --git a/beecrypt/elgamal.c b/beecrypt/elgamal.c index 73d824e..d9ddf42 100644 --- a/beecrypt/elgamal.c +++ b/beecrypt/elgamal.c @@ -22,14 +22,12 @@ * \author Bob Deblier */ -#define BEECRYPT_DLL_EXPORT +#include "system.h" -#if HAVE_CONFIG_H -# include "config.h" -#endif +#include "elgamal.h" +#include "dldp.h" -#include "beecrypt/elgamal.h" -#include "beecrypt/dldp.h" +#include "debug.h" int elgv1sign(const mpbarrett* p, const mpbarrett* n, const mpnumber* g, randomGeneratorContext* rgc, const mpnumber* hm, const mpnumber* x, mpnumber* r, mpnumber* s) { diff --git a/beecrypt/endianness.c b/beecrypt/endianness.c index 750403d..bd1342b 100644 --- a/beecrypt/endianness.c +++ b/beecrypt/endianness.c @@ -22,13 +22,11 @@ * \author Bob Deblier */ -#define BEECRYPT_DLL_EXPORT +#include "system.h" -#if HAVE_CONFIG_H -# include "config.h" -#endif +#include "endianness.h" -#include "beecrypt/endianness.h" +#include "debug.h" int16_t swap16(int16_t n) { diff --git a/beecrypt/entropy.c b/beecrypt/entropy.c index 958c8c4..9e972e6 100644 --- a/beecrypt/entropy.c +++ b/beecrypt/entropy.c @@ -22,14 +22,10 @@ * \ingroup ES_m ES_audio_m ES_dsp_m ES_random_m ES_urandom_m ES_tty_m */ -#define BEECRYPT_DLL_EXPORT +#include "system.h" -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include "beecrypt/entropy.h" -#include "beecrypt/endianness.h" +#include "entropy.h" +#include "endianness.h" #if WIN32 # include @@ -39,20 +35,6 @@ # if HAVE_SYS_IOCTL_H # include # endif -# if HAVE_SYS_STAT_H -# include -# include -# endif -# if TIME_WITH_SYS_TIME -# include -# include -# else -# if HAVE_SYS_TIME_H -# include -# elif HAVE_TIME_H -# include -# endif -# endif # if HAVE_SYS_AUDIOIO_H # include # endif @@ -75,12 +57,8 @@ # include # endif #endif -#if HAVE_FCNTL_H -# include -#endif -#if HAVE_ERRNO_H -# include -#endif + +#include "debug.h" #if WIN32 static HINSTANCE entropy_instance = (HINSTANCE) 0; diff --git a/beecrypt/fips186.c b/beecrypt/fips186.c index 0fc1385..d5e244c 100644 --- a/beecrypt/fips186.c +++ b/beecrypt/fips186.c @@ -23,13 +23,11 @@ * \ingroup PRNG_m PRNG_fips186_m */ -#define BEECRYPT_DLL_EXPORT +#include "system.h" -#if HAVE_CONFIG_H -# include "config.h" -#endif +#include "fips186.h" -#include "beecrypt/fips186.h" +#include "debug.h" /*!\addtogroup PRNG_fips186_m * \{ diff --git a/beecrypt/hmac.c b/beecrypt/hmac.c index c28770a..7d47231 100644 --- a/beecrypt/hmac.c +++ b/beecrypt/hmac.c @@ -27,14 +27,12 @@ * \ingroup HMAC_m */ -#define BEECRYPT_DLL_EXPORT +#include "system.h" -#if HAVE_CONFIG_H -# include "config.h" -#endif +#include "hmac.h" +#include "endianness.h" -#include "beecrypt/hmac.h" -#include "beecrypt/endianness.h" +#include "debug.h" /*!\addtogroup HMAC_m * \{ diff --git a/beecrypt/hmacmd5.c b/beecrypt/hmacmd5.c index 8977ef4..33de1b5 100644 --- a/beecrypt/hmacmd5.c +++ b/beecrypt/hmacmd5.c @@ -27,13 +27,11 @@ * \ingroup HMAC_m HMAC_md5_m */ -#define BEECRYPT_DLL_EXPORT +#include "system.h" -#if HAVE_CONFIG_H -# include "config.h" -#endif +#include "hmacmd5.h" -#include "beecrypt/hmacmd5.h" +#include "debug.h" /*!\addtogroup HMAC_md5_m * \{ diff --git a/beecrypt/hmacsha1.c b/beecrypt/hmacsha1.c index f201a45..031d708 100644 --- a/beecrypt/hmacsha1.c +++ b/beecrypt/hmacsha1.c @@ -27,13 +27,11 @@ * \ingroup HMAC_m HMAC_sha1_m */ -#define BEECRYPT_DLL_EXPORT +#include "system.h" -#if HAVE_CONFIG_H -# include "config.h" -#endif +#include "hmacsha1.h" -#include "beecrypt/hmacsha1.h" +#include "debug.h" /*!\addtogroup HMAC_sha1_m * \{ diff --git a/beecrypt/hmacsha256.c b/beecrypt/hmacsha256.c index c20b95c..5bf2da7 100644 --- a/beecrypt/hmacsha256.c +++ b/beecrypt/hmacsha256.c @@ -23,13 +23,11 @@ * \ingroup HMAC_m HMAC_sha256_m */ -#define BEECRYPT_DLL_EXPORT +#include "system.h" -#if HAVE_CONFIG_H -# include "config.h" -#endif +#include "hmacsha256.h" -#include "beecrypt/hmacsha256.h" +#include "debug.h" /*!\addtogroup HMAC_sha256_m * \{ diff --git a/beecrypt/java/javaglue.c b/beecrypt/java/javaglue.c index 316550e..0a2a31c 100644 --- a/beecrypt/java/javaglue.c +++ b/beecrypt/java/javaglue.c @@ -1,25 +1,16 @@ -#define BEECRYPT_DLL_EXPORT +#include "system.h" -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include "beecrypt/beecrypt.h" -#include "beecrypt/blockmode.h" -#include "beecrypt/mpnumber.h" -#include "beecrypt/mpbarrett.h" +#include "beecrypt.h" +#include "blockmode.h" +#include "mpnumber.h" +#include "mpbarrett.h" #if JAVAGLUE -#if HAVE_STDLIB_H -# include -#endif -#if HAVE_MALLOC_H -# include -#endif - #include "javaglue.h" +#include "debug.h" + static const char* JAVA_OUT_OF_MEMORY_ERROR = "java/lang/OutOfMemoryError"; static const char* JAVA_PROVIDER_EXCEPTION = "java/security/ProviderException"; static const char* JAVA_INVALID_KEY_EXCEPTION = "java/security/InvalidKeyException"; diff --git a/beecrypt/md5.c b/beecrypt/md5.c index dd76607..7159c1a 100644 --- a/beecrypt/md5.c +++ b/beecrypt/md5.c @@ -23,14 +23,12 @@ * \ingroup HASH_m HASH_md5_m */ -#define BEECRYPT_DLL_EXPORT +#include "system.h" -#if HAVE_CONFIG_H -# include "config.h" -#endif +#include "md5.h" +#include "endianness.h" -#include "beecrypt/md5.h" -#include "beecrypt/endianness.h" +#include "debug.h" /*!\addtogroup HASH_md5_m * \{ diff --git a/beecrypt/memchunk.c b/beecrypt/memchunk.c index c182957..325c1ca 100644 --- a/beecrypt/memchunk.c +++ b/beecrypt/memchunk.c @@ -21,13 +21,11 @@ * \author Bob Deblier */ -#define BEECRYPT_DLL_EXPORT +#include "system.h" -#if HAVE_CONFIG_H -# include "config.h" -#endif +#include "memchunk.h" -#include "beecrypt/memchunk.h" +#include "debug.h" memchunk* memchunkAlloc(size_t size) { diff --git a/beecrypt/mp.c b/beecrypt/mp.c index 82d272c..6ae4e88 100644 --- a/beecrypt/mp.c +++ b/beecrypt/mp.c @@ -23,14 +23,12 @@ * \ingroup MP_m */ -#define BEECRYPT_DLL_EXPORT +#include "system.h" -#if HAVE_CONFIG_H -# include "config.h" -#endif +#include "mp.h" +#include "mpopt.h" -#include "beecrypt/mp.h" -#include "beecrypt/mpopt.h" +#include "debug.h" #ifndef ASM_MPZERO void mpzero(size_t size, mpw* data) diff --git a/beecrypt/mpbarrett.c b/beecrypt/mpbarrett.c index 6a92b23..90668a0 100644 --- a/beecrypt/mpbarrett.c +++ b/beecrypt/mpbarrett.c @@ -27,16 +27,14 @@ * \ingroup MP__m */ -#define BEECRYPT_DLL_EXPORT +#include "system.h" -#if HAVE_CONFIG_H -# include "config.h" -#endif +#include "beecrypt.h" +#include "mpprime.h" +#include "mpnumber.h" +#include "mpbarrett.h" -#include "beecrypt/beecrypt.h" -#include "beecrypt/mpprime.h" -#include "beecrypt/mpnumber.h" -#include "beecrypt/mpbarrett.h" +#include "debug.h" /* * mpbzero diff --git a/beecrypt/mpnumber.c b/beecrypt/mpnumber.c index 94c0378..e35bf3c 100644 --- a/beecrypt/mpnumber.c +++ b/beecrypt/mpnumber.c @@ -23,13 +23,11 @@ * \ingroup MP_m */ -#define BEECRYPT_DLL_EXPORT +#include "system.h" -#if HAVE_CONFIG_H -# include "config.h" -#endif +#include "mpnumber.h" -#include "beecrypt/mpnumber.h" +#include "debug.h" void mpnzero(mpnumber* n) { diff --git a/beecrypt/mpprime.c b/beecrypt/mpprime.c index c21287a..3a31727 100644 --- a/beecrypt/mpprime.c +++ b/beecrypt/mpprime.c @@ -23,13 +23,11 @@ * \ingroup MP_m */ -#define BEECRYPT_DLL_EXPORT +#include "system.h" -#if HAVE_CONFIG_H -# include "config.h" -#endif +#include "mpprime.h" -#include "beecrypt/mpprime.h" +#include "debug.h" /* * A word of explanation here on what this table accomplishes: diff --git a/beecrypt/mtprng.c b/beecrypt/mtprng.c index 2f4c0a8..d5fc06c 100644 --- a/beecrypt/mtprng.c +++ b/beecrypt/mtprng.c @@ -32,13 +32,11 @@ * \ingroup PRNG_m */ -#define BEECRYPT_DLL_EXPORT +#include "system.h" -#if HAVE_CONFIG_H -# include "config.h" -#endif +#include "mtprng.h" -#include "beecrypt/mtprng.h" +#include "debug.h" #define hiBit(a) ((a) & 0x80000000U) #define loBit(a) ((a) & 0x1U) diff --git a/beecrypt/pkcs1.c b/beecrypt/pkcs1.c index d680425..40900b5 100644 --- a/beecrypt/pkcs1.c +++ b/beecrypt/pkcs1.c @@ -1,6 +1,8 @@ -#define BEECRYPT_DLL_EXPORT +#include "system.h" -#include "beecrypt/pkcs1.h" +#include "pkcs1.h" + +#include "debug.h" const byte EMSA_MD5_DIGESTINFO[18] = { 0x30,0x20,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x05,0x05,0x00, diff --git a/beecrypt/pkcs12.c b/beecrypt/pkcs12.c index b11fe1c..95a0cc9 100644 --- a/beecrypt/pkcs12.c +++ b/beecrypt/pkcs12.c @@ -1,6 +1,8 @@ -#define BEECRYPT_DLL_EXPORT +#include "system.h" -#include "beecrypt/pkcs12.h" +#include "pkcs12.h" + +#include "debug.h" int pkcs12_derive_key(const hashFunction* h, byte id, const byte* pdata, size_t psize, const byte* sdata, size_t ssize, size_t iterationcount, byte* ndata, size_t nsize) { diff --git a/beecrypt/python/_bc-py.c b/beecrypt/python/_bc-py.c index d0aadb7..2074d1c 100644 --- a/beecrypt/python/_bc-py.c +++ b/beecrypt/python/_bc-py.c @@ -3,7 +3,7 @@ */ #define _REENTRANT 1 /* XXX config.h collides with pyconfig.h */ -#include "config.h" +#include "system.h" #include "Python.h" #ifdef __LCLINT__ @@ -11,8 +11,10 @@ #define PyObject_HEAD int _PyObjectHead; #endif -#include "beecrypt/python/mpw-py.h" -#include "beecrypt/python/rng-py.h" +#include "mpw-py.h" +#include "rng-py.h" + +#include "debug.h" #ifdef __LCLINT__ #undef PyObject_HEAD diff --git a/beecrypt/python/debug-py.c b/beecrypt/python/debug-py.c index ce2f8e6..62c322b 100644 --- a/beecrypt/python/debug-py.c +++ b/beecrypt/python/debug-py.c @@ -6,8 +6,10 @@ extern PyTypeObject PyDictIter_Type; /*@unchecked@*/ extern PyTypeObject PyFrame_Type; -#include "beecrypt/python/mpw-py.h" /* XXX debug only */ -#include "beecrypt/python/rng-py.h" /* XXX debug only */ +#include "mpw-py.h" /* XXX debug only */ +#include "rng-py.h" /* XXX debug only */ + +#include "debug.h" /** */ diff --git a/beecrypt/python/mpw-py.c b/beecrypt/python/mpw-py.c index ec2443c..998fbcb 100644 --- a/beecrypt/python/mpw-py.c +++ b/beecrypt/python/mpw-py.c @@ -4,7 +4,8 @@ #define _REENTRANT 1 /* XXX config.h collides with pyconfig.h */ #define _GNU_SOURCE /* XXX pick up stpcpy et al */ -#include "config.h" + +#include "system.h" #include "Python.h" #include "longintrepr.h" @@ -14,11 +15,13 @@ #define PyObject_HEAD int _PyObjectHead; #endif -#include "beecrypt/python/mpw-py.h" -#include "beecrypt/python/rng-py.h" +#include "mpw-py.h" +#include "rng-py.h" #include "debug-py.c" +#include "debug.h" + #define ABS(_x) ((_x) < 0 ? -(_x) : (_x)) #if !defined(MAX) #define MAX(x, y) ((x) < (y) ? (y) : (x)) diff --git a/beecrypt/python/rng-py.c b/beecrypt/python/rng-py.c index 6252ede..1b46516 100644 --- a/beecrypt/python/rng-py.c +++ b/beecrypt/python/rng-py.c @@ -3,7 +3,8 @@ */ #define _REENTRANT 1 /* XXX config.h collides with pyconfig.h */ -#include "config.h" + +#include "system.h" #include "Python.h" #ifdef __LCLINT__ @@ -11,10 +12,12 @@ #define PyObject_HEAD int _PyObjectHead; #endif -#include "beecrypt/python/rng-py.h" +#include "rng-py.h" #include "debug-py.c" +#include "debug.h" + /*@unchecked@*/ static int _rng_debug = 0; diff --git a/beecrypt/rsa.c b/beecrypt/rsa.c index 9674be1..bcf64fc 100644 --- a/beecrypt/rsa.c +++ b/beecrypt/rsa.c @@ -23,13 +23,11 @@ * \ingroup IF_m IF_rsa_m */ -#define BEECRYPT_DLL_EXPORT +#include "system.h" -#if HAVE_CONFIG_H -# include "config.h" -#endif +#include "rsa.h" -#include "beecrypt/rsa.h" +#include "debug.h" int rsapub(const mpbarrett* n, const mpnumber* e, const mpnumber* m, mpnumber* c) diff --git a/beecrypt/rsakp.c b/beecrypt/rsakp.c index a00fac3..a752c4a 100644 --- a/beecrypt/rsakp.c +++ b/beecrypt/rsakp.c @@ -23,14 +23,12 @@ * \ingroup IF_m IF_rsa_m */ -#define BEECRYPT_DLL_EXPORT +#include "system.h" -#if HAVE_CONFIG_H -# include "config.h" -#endif +#include "rsakp.h" +#include "mpprime.h" -#include "beecrypt/rsakp.h" -#include "beecrypt/mpprime.h" +#include "debug.h" /*!\addtogroup IF_rsa_m * \{ diff --git a/beecrypt/rsapk.c b/beecrypt/rsapk.c index 570db18..922e06e 100644 --- a/beecrypt/rsapk.c +++ b/beecrypt/rsapk.c @@ -23,13 +23,11 @@ * \ingroup IF_m IF_rsa_m */ -#define BEECRYPT_DLL_EXPORT +#include "system.h" -#if HAVE_CONFIG_H -# include "config.h" -#endif +#include "rsapk.h" -#include "beecrypt/rsapk.h" +#include "debug.h" /*!\addtogroup IF_rsa_m * \{ diff --git a/beecrypt/sha1.c b/beecrypt/sha1.c index a0265fd..2659468 100644 --- a/beecrypt/sha1.c +++ b/beecrypt/sha1.c @@ -23,14 +23,12 @@ * \ingroup HASH_m HASH_sha1_m */ -#define BEECRYPT_DLL_EXPORT +#include "system.h" -#if HAVE_CONFIG_H -# include "config.h" -#endif +#include "sha1.h" +#include "endianness.h" -#include "beecrypt/sha1.h" -#include "beecrypt/endianness.h" +#include "debug.h" /*!\addtogroup HASH_sha1_m * \{ diff --git a/beecrypt/sha256.c b/beecrypt/sha256.c index a3ee355..55aa614 100644 --- a/beecrypt/sha256.c +++ b/beecrypt/sha256.c @@ -23,14 +23,12 @@ * \ingroup HASH_m HASH_sha256_m */ -#define BEECRYPT_DLL_EXPORT +#include "system.h" -#if HAVE_CONFIG_H -# include "config.h" -#endif +#include "sha256.h" +#include "endianness.h" -#include "beecrypt/sha256.h" -#include "beecrypt/endianness.h" +#include "debug.h" /*!\addtogroup HASH_sha256_m * \{ diff --git a/beecrypt/system.h b/beecrypt/system.h new file mode 100644 index 0000000..6255796 --- /dev/null +++ b/beecrypt/system.h @@ -0,0 +1,89 @@ +/** + * \file beecrypt/system.h + */ + +#ifndef H_SYSTEM +#define H_SYSTEM + +#define BEECRYPT_DLL_EXPORT + +#if defined(_WIN32) && !defined(WIN32) +# define WIN32 1 +#endif + +#if WIN32 && !__CYGWIN32__ +# include "win.h" +#else +# ifdef HAVE_CONFIG_H +# include "config.h" +# endif +#endif + +#if defined(__LCLINT__) +/* XXX from /usr/include/bits/sigset.h in glibc-2.2.4 */ +/*@-sizeoftype@*/ +# define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int))) +/*@-redef@*/ +typedef struct + { + unsigned long int __val[_SIGSET_NWORDS]; + } __sigset_t; +/*@=redef@*/ +/*@=sizeoftype@*/ +#endif + +#include "gnu.h" + +#if HAVE_SYS_STAT_H +# include +# include +#endif + +#include + +#ifdef HAVE_UNISTD_H +# include +#endif + +#if TIME_WITH_SYS_TIME +# include +# include +#else +# if HAVE_SYS_TIME_H +# include +# else +# include +# endif +#endif + +#if HAVE_TIME_H +# include +#endif + +#ifdef HAVE_STRING_H +# include +#endif + +#if HAVE_ERRNO_H +# include +#endif + +#if HAVE_STDLIB_H +# include +#endif + +#ifdef HAVE_FCNTL_H +# include +#else +# include +#endif + +#if HAVE_CTYPE_H +# include +#endif + +#if HAVE_MALLOC_H && !defined(__LCLINT__) +# include +#endif + +#endif /* H_SYSTEM */ diff --git a/beecrypt/tests/benchbc.c b/beecrypt/tests/benchbc.c index f0191e1..9554831 100644 --- a/beecrypt/tests/benchbc.c +++ b/beecrypt/tests/benchbc.c @@ -22,10 +22,12 @@ * \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 8a3fb76..29adcc2 100644 --- a/beecrypt/tests/benchhf.c +++ b/beecrypt/tests/benchhf.c @@ -22,10 +22,12 @@ * \author Bob Deblier */ +#include "system.h" + #include "beecrypt.h" #include "timestamp.h" -#include +#include "debug.h" #define SECONDS 10 diff --git a/beecrypt/tests/benchme.c b/beecrypt/tests/benchme.c index b32ed0c..4439c49 100644 --- a/beecrypt/tests/benchme.c +++ b/beecrypt/tests/benchme.c @@ -22,11 +22,13 @@ * \author Bob Deblier */ +#include "system.h" + #include "beecrypt.h" #include "dldp.h" #include "timestamp.h" -#include +#include "debug.h" #define SECONDS 10 diff --git a/beecrypt/tests/testaes.c b/beecrypt/tests/testaes.c index 04b706b..303095a 100644 --- a/beecrypt/tests/testaes.c +++ b/beecrypt/tests/testaes.c @@ -23,10 +23,12 @@ * \ingroup UNIT_m */ -#include +#include "system.h" #include "aes.h" +#include "debug.h" + extern int fromhex(byte*, const char*); struct vector diff --git a/beecrypt/tests/testblowfish.c b/beecrypt/tests/testblowfish.c index f5bc73d..bd2fa41 100644 --- a/beecrypt/tests/testblowfish.c +++ b/beecrypt/tests/testblowfish.c @@ -23,10 +23,12 @@ * \ingroup UNIT_m */ -#include +#include "system.h" #include "blowfish.h" +#include "debug.h" + extern int fromhex(byte*, const char*); struct vector diff --git a/beecrypt/tests/testconv.c b/beecrypt/tests/testconv.c index c8f8914..9f806ef 100644 --- a/beecrypt/tests/testconv.c +++ b/beecrypt/tests/testconv.c @@ -1,5 +1,9 @@ +#include "system.h" + #include "mp.h" +#include "debug.h" + void hexdump(byte* b, int count) { int i; diff --git a/beecrypt/tests/testdldp.c b/beecrypt/tests/testdldp.c index 1fce545..027956f 100644 --- a/beecrypt/tests/testdldp.c +++ b/beecrypt/tests/testdldp.c @@ -23,11 +23,13 @@ * \ingroup UNIT_m */ -#include +#include "system.h" #include "beecrypt.h" #include "dldp.h" +#include "debug.h" + int main() { int failures = 0; diff --git a/beecrypt/tests/testdsa.c b/beecrypt/tests/testdsa.c index b8f9045..7834d42 100644 --- a/beecrypt/tests/testdsa.c +++ b/beecrypt/tests/testdsa.c @@ -23,12 +23,14 @@ * \ingroup UNIT_m */ -#include +#include "system.h" #include "beecrypt.h" #include "dlkp.h" #include "dsa.h" +#include "debug.h" + struct vector { const char* p; diff --git a/beecrypt/tests/testhmacmd5.c b/beecrypt/tests/testhmacmd5.c index 3b2d0a0..1db1a97 100644 --- a/beecrypt/tests/testhmacmd5.c +++ b/beecrypt/tests/testhmacmd5.c @@ -24,10 +24,12 @@ * \ingroup UNIT_m */ -#include +#include "system.h" #include "hmacmd5.h" +#include "debug.h" + struct vector { int keybits; diff --git a/beecrypt/tests/testhmacsha1.c b/beecrypt/tests/testhmacsha1.c index 93d80b5..fe8e84d 100644 --- a/beecrypt/tests/testhmacsha1.c +++ b/beecrypt/tests/testhmacsha1.c @@ -24,10 +24,12 @@ * \ingroup UNIT_m */ -#include +#include "system.h" #include "hmacsha1.h" +#include "debug.h" + struct vector { int keybits; diff --git a/beecrypt/tests/testmd5.c b/beecrypt/tests/testmd5.c index 1fe29d8..5137912 100644 --- a/beecrypt/tests/testmd5.c +++ b/beecrypt/tests/testmd5.c @@ -24,10 +24,12 @@ * \ingroup UNIT_m */ -#include +#include "system.h" #include "md5.h" +#include "debug.h" + struct vector { int input_size; diff --git a/beecrypt/tests/testmp.c b/beecrypt/tests/testmp.c index a4d1d82..0a6bb52 100644 --- a/beecrypt/tests/testmp.c +++ b/beecrypt/tests/testmp.c @@ -1,8 +1,10 @@ -#include +#include "system.h" #include "beecrypt.h" #include "mp.h" +#include "debug.h" + #define INIT 0xdeadbeefU; static const mpw Z[4] = { 0U, 0U, 0U, 0U }; diff --git a/beecrypt/tests/testmpinv.c b/beecrypt/tests/testmpinv.c index f1c10af..5389333 100644 --- a/beecrypt/tests/testmpinv.c +++ b/beecrypt/tests/testmpinv.c @@ -23,11 +23,13 @@ * \ingroup UNIT_m */ -#include +#include "system.h" #include "beecrypt.h" #include "mpnumber.h" +#include "debug.h" + struct vector { const char* m; diff --git a/beecrypt/tests/testrsa.c b/beecrypt/tests/testrsa.c index c5e756f..63a436f 100644 --- a/beecrypt/tests/testrsa.c +++ b/beecrypt/tests/testrsa.c @@ -23,11 +23,13 @@ * \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"; static const char* rsa_p = "eecfae81b1b9b3c908810b10a1b5600199eb9f44aef4fda493b81a9e3d84f632124ef0236e5d1e3b7e28fae7aa040a2d5b252176459d1f397541ba2a58fb6599"; diff --git a/beecrypt/tests/testsha1.c b/beecrypt/tests/testsha1.c index d65e7eb..33c1f60 100644 --- a/beecrypt/tests/testsha1.c +++ b/beecrypt/tests/testsha1.c @@ -24,11 +24,13 @@ * \ingroup UNIT_m */ -#include +#include "system.h" #include "sha1.h" #include "memchunk.h" +#include "debug.h" + struct vector { int input_size; diff --git a/beecrypt/tests/testsha256.c b/beecrypt/tests/testsha256.c index da3670d..1b60959 100644 --- a/beecrypt/tests/testsha256.c +++ b/beecrypt/tests/testsha256.c @@ -21,10 +21,12 @@ * */ -#include +#include "system.h" #include "sha256.h" +#include "debug.h" + struct vector { int input_size; diff --git a/beecrypt/tests/testutil.c b/beecrypt/tests/testutil.c index 4fe5ac9..8754744 100644 --- a/beecrypt/tests/testutil.c +++ b/beecrypt/tests/testutil.c @@ -17,9 +17,11 @@ * */ +#include "system.h" + #include "beecrypt.h" -#include +#include "debug.h" int fromhex(byte* data, const char* hexdata) { diff --git a/beecrypt/timestamp.c b/beecrypt/timestamp.c index 093e221..258922b 100644 --- a/beecrypt/timestamp.c +++ b/beecrypt/timestamp.c @@ -22,24 +22,11 @@ * \author Bob Deblier */ -#define BEECRYPT_DLL_EXPORT +#include "system.h" -#if HAVE_CONFIG_H -# include "config.h" -#endif +#include "timestamp.h" -#include "beecrypt/timestamp.h" - -#if TIME_WITH_SYS_TIME -# include -# include -#else -# if HAVE_SYS_TIME_H -# include -# elif HAVE_TIME_H -# include -# endif -#endif +#include "debug.h" javalong timestamp() { -- 2.7.4