summaryrefslogtreecommitdiff
path: root/beecrypt
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2004-08-02 02:23:27 +0000
committerjbj <devnull@localhost>2004-08-02 02:23:27 +0000
commit6626798a65dcf66c7268d4dca95a32e140b01c40 (patch)
tree4fe9e07012d7e244812ca23fefc05fa34a912794 /beecrypt
parent538aa3a481e0886ba1d255785ab38a720fc70c35 (diff)
downloadlibrpm-tizen-6626798a65dcf66c7268d4dca95a32e140b01c40.tar.gz
librpm-tizen-6626798a65dcf66c7268d4dca95a32e140b01c40.tar.bz2
librpm-tizen-6626798a65dcf66c7268d4dca95a32e140b01c40.zip
Add system.h and debug.h, remove internal include path structure.
CVS patchset: 7376 CVS date: 2004/08/02 02:23:27
Diffstat (limited to 'beecrypt')
-rw-r--r--beecrypt/aes.c14
-rw-r--r--beecrypt/base64.c14
-rw-r--r--beecrypt/beecrypt.c32
-rw-r--r--beecrypt/blockmode.c8
-rw-r--r--beecrypt/blockpad.c8
-rw-r--r--beecrypt/blowfish.c10
-rw-r--r--beecrypt/debug.h13
-rw-r--r--beecrypt/dhaes.c14
-rw-r--r--beecrypt/dldp.c12
-rw-r--r--beecrypt/dlkp.c8
-rw-r--r--beecrypt/dlpk.c8
-rw-r--r--beecrypt/dlsvdp-dh.c8
-rw-r--r--beecrypt/dsa.c10
-rw-r--r--beecrypt/elgamal.c10
-rw-r--r--beecrypt/endianness.c8
-rw-r--r--beecrypt/entropy.c32
-rw-r--r--beecrypt/fips186.c8
-rw-r--r--beecrypt/hmac.c10
-rw-r--r--beecrypt/hmacmd5.c8
-rw-r--r--beecrypt/hmacsha1.c8
-rw-r--r--beecrypt/hmacsha256.c8
-rw-r--r--beecrypt/java/javaglue.c23
-rw-r--r--beecrypt/md5.c10
-rw-r--r--beecrypt/memchunk.c8
-rw-r--r--beecrypt/mp.c10
-rw-r--r--beecrypt/mpbarrett.c14
-rw-r--r--beecrypt/mpnumber.c8
-rw-r--r--beecrypt/mpprime.c8
-rw-r--r--beecrypt/mtprng.c8
-rw-r--r--beecrypt/pkcs1.c6
-rw-r--r--beecrypt/pkcs12.c6
-rw-r--r--beecrypt/python/_bc-py.c8
-rw-r--r--beecrypt/python/debug-py.c6
-rw-r--r--beecrypt/python/mpw-py.c9
-rw-r--r--beecrypt/python/rng-py.c7
-rw-r--r--beecrypt/rsa.c8
-rw-r--r--beecrypt/rsakp.c10
-rw-r--r--beecrypt/rsapk.c8
-rw-r--r--beecrypt/sha1.c10
-rw-r--r--beecrypt/sha256.c10
-rw-r--r--beecrypt/system.h89
-rw-r--r--beecrypt/tests/benchbc.c4
-rw-r--r--beecrypt/tests/benchhf.c4
-rw-r--r--beecrypt/tests/benchme.c4
-rw-r--r--beecrypt/tests/testaes.c4
-rw-r--r--beecrypt/tests/testblowfish.c4
-rw-r--r--beecrypt/tests/testconv.c4
-rw-r--r--beecrypt/tests/testdldp.c4
-rw-r--r--beecrypt/tests/testdsa.c4
-rw-r--r--beecrypt/tests/testhmacmd5.c4
-rw-r--r--beecrypt/tests/testhmacsha1.c4
-rw-r--r--beecrypt/tests/testmd5.c4
-rw-r--r--beecrypt/tests/testmp.c4
-rw-r--r--beecrypt/tests/testmpinv.c4
-rw-r--r--beecrypt/tests/testrsa.c4
-rw-r--r--beecrypt/tests/testsha1.c4
-rw-r--r--beecrypt/tests/testsha256.c4
-rw-r--r--beecrypt/tests/testutil.c4
-rw-r--r--beecrypt/timestamp.c19
59 files changed, 323 insertions, 281 deletions
diff --git a/beecrypt/aes.c b/beecrypt/aes.c
index 2d7377678..959f0fc70 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 789eba165..3f99d0a36 100644
--- a/beecrypt/base64.c
+++ b/beecrypt/base64.c
@@ -22,18 +22,12 @@
* \author Bob Deblier <bob.deblier@pandora.be>
*/
-#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 <ctype.h>
-#endif
+#include "debug.h"
static const char* to_b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
diff --git a/beecrypt/beecrypt.c b/beecrypt/beecrypt.c
index b8bc97463..1a7a1b310 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 6a19ed52b..6ec12c9a7 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 9bc73f1d7..c5e4c6b8c 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 47eca2a30..6611d1372 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 000000000..19376c043
--- /dev/null
+++ b/beecrypt/debug.h
@@ -0,0 +1,13 @@
+/**
+ * To be included after all other includes.
+ */
+#ifndef H_DEBUG
+#define H_DEBUG
+
+#include <assert.h>
+
+#ifdef DMALLOC
+#include <dmalloc.h>
+#endif
+
+#endif /* H_DEBUG */
diff --git a/beecrypt/dhaes.c b/beecrypt/dhaes.c
index 994cd6f36..1c84f6bc1 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 51f32e6ae..e32e346f6 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 65dc185a2..6ff310210 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 02dc62293..2efc83a0b 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 9f1cb68f7..5f5636495 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 291392f81..4772a279e 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 73d824ef1..d9ddf420c 100644
--- a/beecrypt/elgamal.c
+++ b/beecrypt/elgamal.c
@@ -22,14 +22,12 @@
* \author Bob Deblier <bob.deblier@pandora.be>
*/
-#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 750403de2..bd1342b01 100644
--- a/beecrypt/endianness.c
+++ b/beecrypt/endianness.c
@@ -22,13 +22,11 @@
* \author Bob Deblier <bob.deblier@pandora.be>
*/
-#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 958c8c410..9e972e674 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 <mmsystem.h>
@@ -39,20 +35,6 @@
# if HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
# endif
-# if HAVE_SYS_STAT_H
-# include <sys/types.h>
-# include <sys/stat.h>
-# endif
-# if TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-# else
-# if HAVE_SYS_TIME_H
-# include <sys/time.h>
-# elif HAVE_TIME_H
-# include <time.h>
-# endif
-# endif
# if HAVE_SYS_AUDIOIO_H
# include <sys/audioio.h>
# endif
@@ -75,12 +57,8 @@
# include <aio.h>
# endif
#endif
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-#if HAVE_ERRNO_H
-# include <errno.h>
-#endif
+
+#include "debug.h"
#if WIN32
static HINSTANCE entropy_instance = (HINSTANCE) 0;
diff --git a/beecrypt/fips186.c b/beecrypt/fips186.c
index 0fc138554..d5e244c9c 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 c28770a05..7d4723198 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 8977ef415..33de1b559 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 f201a45f0..031d70845 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 c20b95c85..5bf2da7fc 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 316550e4d..0a2a31c1b 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 <stdlib.h>
-#endif
-#if HAVE_MALLOC_H
-# include <malloc.h>
-#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 dd76607bf..7159c1a38 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 c18295792..325c1ca56 100644
--- a/beecrypt/memchunk.c
+++ b/beecrypt/memchunk.c
@@ -21,13 +21,11 @@
* \author Bob Deblier <bob.deblier@pandora.be>
*/
-#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 82d272c17..6ae4e88e1 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 6a92b2323..90668a05a 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 94c03785b..e35bf3ca7 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 c21287a7d..3a3172735 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 2f4c0a8bf..d5fc06cd1 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 d6804259f..40900b5d7 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 b11fe1c77..95a0cc960 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 d0aadb7e1..2074d1c55 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 ce2f8e6f7..62c322b37 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 ec2443cc2..998fbcb3b 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 6252ede33..1b465169f 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 9674be17c..bcf64fc57 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 a00fac308..a752c4a39 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 570db1887..922e06ed6 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 a0265fd0a..265946843 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 a3ee355f4..55aa61436 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 000000000..625579684
--- /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 <sys/types.h>
+# include <sys/stat.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+
+#if HAVE_TIME_H
+# include <time.h>
+#endif
+
+#ifdef HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if HAVE_ERRNO_H
+# include <errno.h>
+#endif
+
+#if HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+
+#ifdef HAVE_FCNTL_H
+# include <fcntl.h>
+#else
+# include <sys/file.h>
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+
+#if HAVE_MALLOC_H && !defined(__LCLINT__)
+# include <malloc.h>
+#endif
+
+#endif /* H_SYSTEM */
diff --git a/beecrypt/tests/benchbc.c b/beecrypt/tests/benchbc.c
index f0191e1bf..955483158 100644
--- a/beecrypt/tests/benchbc.c
+++ b/beecrypt/tests/benchbc.c
@@ -22,10 +22,12 @@
* \author Bob Deblier <bob.deblier@pandora.be>
*/
+#include "system.h"
+
#include "beecrypt.h"
#include "timestamp.h"
-#include <stdio.h>
+#include "debug.h"
#define SECONDS 10
diff --git a/beecrypt/tests/benchhf.c b/beecrypt/tests/benchhf.c
index 8a3fb76a0..29adcc2ae 100644
--- a/beecrypt/tests/benchhf.c
+++ b/beecrypt/tests/benchhf.c
@@ -22,10 +22,12 @@
* \author Bob Deblier <bob.deblier@pandora.be>
*/
+#include "system.h"
+
#include "beecrypt.h"
#include "timestamp.h"
-#include <stdio.h>
+#include "debug.h"
#define SECONDS 10
diff --git a/beecrypt/tests/benchme.c b/beecrypt/tests/benchme.c
index b32ed0c24..4439c490c 100644
--- a/beecrypt/tests/benchme.c
+++ b/beecrypt/tests/benchme.c
@@ -22,11 +22,13 @@
* \author Bob Deblier <bob.deblier@pandora.be>
*/
+#include "system.h"
+
#include "beecrypt.h"
#include "dldp.h"
#include "timestamp.h"
-#include <stdio.h>
+#include "debug.h"
#define SECONDS 10
diff --git a/beecrypt/tests/testaes.c b/beecrypt/tests/testaes.c
index 04b706b37..303095a5e 100644
--- a/beecrypt/tests/testaes.c
+++ b/beecrypt/tests/testaes.c
@@ -23,10 +23,12 @@
* \ingroup UNIT_m
*/
-#include <stdio.h>
+#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 f5bc73d54..bd2fa4121 100644
--- a/beecrypt/tests/testblowfish.c
+++ b/beecrypt/tests/testblowfish.c
@@ -23,10 +23,12 @@
* \ingroup UNIT_m
*/
-#include <stdio.h>
+#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 c8f8914ca..9f806ef05 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 1fce545d4..027956ff8 100644
--- a/beecrypt/tests/testdldp.c
+++ b/beecrypt/tests/testdldp.c
@@ -23,11 +23,13 @@
* \ingroup UNIT_m
*/
-#include <stdio.h>
+#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 b8f904599..7834d42fa 100644
--- a/beecrypt/tests/testdsa.c
+++ b/beecrypt/tests/testdsa.c
@@ -23,12 +23,14 @@
* \ingroup UNIT_m
*/
-#include <stdio.h>
+#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 3b2d0a033..1db1a97bb 100644
--- a/beecrypt/tests/testhmacmd5.c
+++ b/beecrypt/tests/testhmacmd5.c
@@ -24,10 +24,12 @@
* \ingroup UNIT_m
*/
-#include <stdio.h>
+#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 93d80b507..fe8e84db9 100644
--- a/beecrypt/tests/testhmacsha1.c
+++ b/beecrypt/tests/testhmacsha1.c
@@ -24,10 +24,12 @@
* \ingroup UNIT_m
*/
-#include <stdio.h>
+#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 1fe29d8f6..5137912ac 100644
--- a/beecrypt/tests/testmd5.c
+++ b/beecrypt/tests/testmd5.c
@@ -24,10 +24,12 @@
* \ingroup UNIT_m
*/
-#include <stdio.h>
+#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 a4d1d829d..0a6bb527e 100644
--- a/beecrypt/tests/testmp.c
+++ b/beecrypt/tests/testmp.c
@@ -1,8 +1,10 @@
-#include <stdio.h>
+#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 f1c10af15..5389333c7 100644
--- a/beecrypt/tests/testmpinv.c
+++ b/beecrypt/tests/testmpinv.c
@@ -23,11 +23,13 @@
* \ingroup UNIT_m
*/
-#include <stdio.h>
+#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 c5e756f30..63a436fa8 100644
--- a/beecrypt/tests/testrsa.c
+++ b/beecrypt/tests/testrsa.c
@@ -23,11 +23,13 @@
* \ingroup UNIT_m
*/
-#include <stdio.h>
+#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 d65e7eb16..33c1f6026 100644
--- a/beecrypt/tests/testsha1.c
+++ b/beecrypt/tests/testsha1.c
@@ -24,11 +24,13 @@
* \ingroup UNIT_m
*/
-#include <stdio.h>
+#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 da3670d27..1b60959c7 100644
--- a/beecrypt/tests/testsha256.c
+++ b/beecrypt/tests/testsha256.c
@@ -21,10 +21,12 @@
*
*/
-#include <stdio.h>
+#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 4fe5ac9eb..875474455 100644
--- a/beecrypt/tests/testutil.c
+++ b/beecrypt/tests/testutil.c
@@ -17,9 +17,11 @@
*
*/
+#include "system.h"
+
#include "beecrypt.h"
-#include <string.h>
+#include "debug.h"
int fromhex(byte* data, const char* hexdata)
{
diff --git a/beecrypt/timestamp.c b/beecrypt/timestamp.c
index 093e22127..258922bbc 100644
--- a/beecrypt/timestamp.c
+++ b/beecrypt/timestamp.c
@@ -22,24 +22,11 @@
* \author Bob Deblier <bob.deblier@pandora.be>
*/
-#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 <sys/time.h>
-# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-# include <sys/time.h>
-# elif HAVE_TIME_H
-# include <time.h>
-# endif
-#endif
+#include "debug.h"
javalong timestamp()
{