From: Mike Kasick Date: Fri, 9 Jun 2023 17:40:16 +0000 (-0400) Subject: rand_lib: RAND_poll: Reseed in non-"no-deprecated" builds. X-Git-Tag: openssl-3.1.2~67 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=06ae946a41859afa67a0d62873bbb527da546c7b;p=thirdparty%2Fopenssl.git rand_lib: RAND_poll: Reseed in non-"no-deprecated" builds. 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 Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/21167) (cherry picked from commit cc343d047c147e0a395fb101efbe9dedf458aa17) --- diff --git a/crypto/rand/rand_lib.c b/crypto/rand/rand_lib.c index 68924eccdf8..7c1c89ab701 100644 --- a/crypto/rand/rand_lib.c +++ b/crypto/rand/rand_lib.c @@ -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