#include <openssl/rand.h>
+#ifdef BN_DEBUG
+# define PREDICT
+#endif
+
/* #define NORAND 1 */
/* #define PREDICT 1 */
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);
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
#endif
#ifdef PREDICT
- {
- static unsigned char val=0;
+ if (rand_predictable)
+ {
+ static unsigned char val=0;
- for (i=0; i<num; i++)
- buf[i]=val++;
- return(1);
- }
+ for (i=0; i<num; i++)
+ buf[i]=val++;
+ return(1);
+ }
#endif
/*
buf[1] = 255;
write(fd, buf, 2);
if (read(fd, buf, 1) != 1) goto err;
- if (buf[0] == 0) goto err;
+ if (buf[0] == 0) goto err;
num = read(fd, buf, 255);
if (num < 1) goto err;
RAND_seed(buf, num);