Skip to content

Commit

Permalink
rand_lib: RAND_poll: Reseed in non-"no-deprecated" builds.
Browse files Browse the repository at this point in the history
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 #21167)
  • Loading branch information
mkasick authored and paulidale committed Jun 13, 2023
1 parent 050dddb commit cc343d0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions crypto/rand/rand_lib.c
Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit cc343d0

Please sign in to comment.