Don't ever set 'seeded' if RAND_status() returned 0
[openssl.git] / apps / app_rand.c
index c5d66a3b5fafedf22a705d04629c361638e971ad..2126fd5aa1981d9795454eeb8cb407f511ec7bf5 100644 (file)
@@ -142,15 +142,18 @@ 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;
                        }