Rename implementations of method functions so that they match
[openssl.git] / crypto / bn / exptest.c
index d64905df1b59c70f92463d987b0d3117b212a9f2..5ca570d1a8a23daa3846ba16af5dc6c71cc9329c 100644 (file)
 #include <openssl/bn.h>
 #include <openssl/rand.h>
 #include <openssl/err.h>
-#ifdef WINDOWS
+#ifdef OPENSSL_SYS_WINDOWS
 #include "../bio/bss_file.c"
 #endif
 
 #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();
@@ -167,6 +173,7 @@ int main(int argc, char *argv[])
        BN_free(b);
        BN_free(m);
        BN_CTX_free(ctx);
+       ERR_remove_state(0);
        CRYPTO_mem_leaks(out);
        BIO_free(out);
        printf(" done\n");