- Pseudo-seed the PRNG in programs used for "make test"
[openssl.git] / crypto / bn / exptest.c
index d64905df1b59c70f92463d987b0d3117b212a9f2..b6c7b18a3a82022e330ae1ec8e093ef233f23b5d 100644 (file)
@@ -69,6 +69,8 @@
 
 #define NUM_BITS       (BN_BITS*2)
 
+static const char rnd_seed[] = "string to make the random number generator think it has entropy";
+
 int main(int argc, char *argv[])
        {
        BN_CTX *ctx;
@@ -77,6 +79,10 @@ int main(int argc, char *argv[])
        unsigned char c;
        BIGNUM *r_mont,*r_recp,*r_simple,*a,*b,*m;
 
+       RAND_seed(rnd_seed, sizeof rnd_seed); /* or BN_rand may fail, and we don't
+                                              * even check its return value
+                                              * (which we should) */
+
        ERR_load_BN_strings();
 
        ctx=BN_CTX_new();