From: Tomas Mraz Date: Wed, 24 Feb 2021 11:32:40 +0000 (+0100) Subject: Ensure that the fake rand is initialized X-Git-Tag: openssl-3.0.0-alpha13~185 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0c84139c98bf81de2ec8e5aba8aef428ce6e1079;p=thirdparty%2Fopenssl.git Ensure that the fake rand is initialized Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/14299) --- diff --git a/test/testutil/fake_random.c b/test/testutil/fake_random.c index 95a3023cd49..710e707234d 100644 --- a/test/testutil/fake_random.c +++ b/test/testutil/fake_random.c @@ -177,6 +177,14 @@ OSSL_PROVIDER *fake_rand_start(OSSL_LIB_CTX *libctx) || !TEST_true(RAND_set_DRBG_type(libctx, "fake", NULL, NULL, NULL)) || !TEST_ptr(p = OSSL_PROVIDER_try_load(libctx, "fake-rand", 1))) return NULL; + + /* Ensure that the fake rand is initialized. */ + if (!TEST_ptr(RAND_get0_private(libctx)) + || !TEST_ptr(RAND_get0_public(libctx))) { + OSSL_PROVIDER_unload(p); + return NULL; + } + return p; }