X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=apps%2Fapp_rand.c;h=b7b6128c1eb901a383f5e0bfb07c32ba52d130ed;hp=1146f9f7f38ad986a38296cc68567569a41dafe6;hb=d8770f3ece3bef28eb749af6d5854b38e6c15e4e;hpb=cf7fa82897a143a9c9b6cefb7c456cee03b0e543 diff --git a/apps/app_rand.c b/apps/app_rand.c index 1146f9f7f3..b7b6128c1e 100644 --- a/apps/app_rand.c +++ b/apps/app_rand.c @@ -124,7 +124,7 @@ int app_RAND_load_file(const char *file, BIO *bio_e, int dont_warn) int consider_randfile = (file == NULL); char buffer[200]; -#ifdef WINDOWS +#ifdef OPENSSL_SYS_WINDOWS BIO_printf(bio_e,"Loading 'screen' into random state -"); BIO_flush(bio_e); RAND_screen(); @@ -142,18 +142,21 @@ int app_RAND_load_file(const char *file, BIO *bio_e, int dont_warn) } if (file == NULL || !RAND_load_file(file, -1)) { - if (RAND_status() == 0 && !dont_warn) + if (RAND_status() == 0) { - BIO_printf(bio_e,"unable to load 'random state'\n"); - BIO_printf(bio_e,"This means that the random number generator has not been seeded\n"); - BIO_printf(bio_e,"with much random data.\n"); - if (consider_randfile) /* explanation does not apply when a file is explicitly named */ + if (!dont_warn) { - BIO_printf(bio_e,"Consider setting the RANDFILE environment variable to point at a file that\n"); - BIO_printf(bio_e,"'random' data can be kept in (the file will be overwritten).\n"); + BIO_printf(bio_e,"unable to load 'random state'\n"); + BIO_printf(bio_e,"This means that the random number generator has not been seeded\n"); + BIO_printf(bio_e,"with much random data.\n"); + if (consider_randfile) /* explanation does not apply when a file is explicitly named */ + { + BIO_printf(bio_e,"Consider setting the RANDFILE environment variable to point at a file that\n"); + BIO_printf(bio_e,"'random' data can be kept in (the file will be overwritten).\n"); + } } + return 0; } - return 0; } seeded = 1; return 1; @@ -177,8 +180,10 @@ long app_RAND_load_files(char *name) if (*n == '\0') break; egd=RAND_egd(n); - if (egd > 0) tot+=egd; - tot+=RAND_load_file(n,-1); + if (egd > 0) + tot+=egd; + else + tot+=RAND_load_file(n,-1); if (last) break; } if (tot > 512)