summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2021-02-24 12:32:40 +0100
committerTomas Mraz <tomas@openssl.org>2021-02-25 14:01:54 +0100
commit0c84139c98bf81de2ec8e5aba8aef428ce6e1079 (patch)
tree455553c560f87b3e528a5666b6f39a78e63a2ee9 /test
parent75de54363506e2b2480fc6baf0cd45b1f7fc8816 (diff)
downloadopenssl-new-0c84139c98bf81de2ec8e5aba8aef428ce6e1079.tar.gz
Ensure that the fake rand is initialized
Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14299)
Diffstat (limited to 'test')
-rw-r--r--test/testutil/fake_random.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/testutil/fake_random.c b/test/testutil/fake_random.c
index 95a3023cd4..710e707234 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;
}