]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Ensure that the fake rand is initialized
authorTomas Mraz <tomas@openssl.org>
Wed, 24 Feb 2021 11:32:40 +0000 (12:32 +0100)
committerTomas Mraz <tomas@openssl.org>
Thu, 25 Feb 2021 13:01:54 +0000 (14:01 +0100)
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14299)

test/testutil/fake_random.c

index 95a3023cd49c69fc7bb4cdb43a17e2fae1ea027f..710e707234d6f6f0ff58cca86a64e3bd8eee7f41 100644 (file)
@@ -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;
 }