From: Ulf Möller Date: Mon, 28 Feb 2000 20:19:39 +0000 (+0000) Subject: Switch for turning on the predictable "random" number generator. X-Git-Tag: OpenSSL_0_9_5a-beta1~147 X-Git-Url: https://git.openssl.org/?a=commitdiff_plain;h=e64dceab743f0c2f4aef5dbc2b0e479c07bd2049;p=openssl.git Switch for turning on the predictable "random" number generator. --- diff --git a/crypto/rand/md_rand.c b/crypto/rand/md_rand.c index 6b158f0349..583fc137d8 100644 --- a/crypto/rand/md_rand.c +++ b/crypto/rand/md_rand.c @@ -130,6 +130,10 @@ #include +#ifdef BN_DEBUG +# define PREDICT +#endif + /* #define NORAND 1 */ /* #define PREDICT 1 */ @@ -141,6 +145,10 @@ static long md_count[2]={0,0}; static double entropy=0; static int initialized=0; +#ifdef PREDICT +int rand_predictable=0; +#endif + const char *RAND_version="RAND" OPENSSL_VERSION_PTEXT; static void ssleay_rand_cleanup(void); @@ -306,6 +314,10 @@ static void ssleay_rand_initialize(void) FILE *fh; #endif +#ifdef NORAND + return; +#endif + CRYPTO_w_unlock(CRYPTO_LOCK_RAND); /* put in some default random data, we need more than just this */ #ifndef GETPID_IS_MEANINGLESS @@ -354,13 +366,14 @@ static int ssleay_rand_bytes(unsigned char *buf, int num) #endif #ifdef PREDICT - { - static unsigned char val=0; + if (rand_predictable) + { + static unsigned char val=0; - for (i=0; i