rand_lib: RAND_poll: Reseed in non-"no-deprecated" builds.
authorMike Kasick <mike@kasick.org>
Fri, 9 Jun 2023 17:40:16 +0000 (13:40 -0400)
committerPauli <pauli@openssl.org>
Tue, 13 Jun 2023 23:03:14 +0000 (09:03 +1000)
In a non-"no-deprecated" libcrypto build with a default configuration,
RAND_get_rand_method() == RAND_OpenSSL() and so needs to fall through to
the RAND_seed call (used in "no-deprecated" builds) to perform a reseed.

CLA: trivial

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21167)

crypto/rand/rand_lib.c

index 9b1b5999cf0499bdcd3bd435e35c386a4832c225..d3e156700a2c6521aa2f8799135b9cae9835c99c 100644 (file)
@@ -121,6 +121,8 @@ void RAND_keep_random_devices_open(int keep)
  */
 int RAND_poll(void)
 {
+    static const char salt[] = "polling";
+
 # ifndef OPENSSL_NO_DEPRECATED_3_0
     const RAND_METHOD *meth = RAND_get_rand_method();
     int ret = meth == RAND_OpenSSL();
@@ -149,14 +151,12 @@ int RAND_poll(void)
         ret = 1;
      err:
         ossl_rand_pool_free(pool);
+        return ret;
     }
-    return ret;
-# else
-    static const char salt[] = "polling";
+# endif
 
     RAND_seed(salt, sizeof(salt));
     return 1;
-# endif
 }
 
 # ifndef OPENSSL_NO_DEPRECATED_3_0