Instantiate when RAND_status() checks
authorRich Salz <rsalz@openssl.org>
Sat, 12 Aug 2017 22:19:50 +0000 (18:19 -0400)
committerRich Salz <rsalz@openssl.org>
Sun, 13 Aug 2017 19:52:30 +0000 (15:52 -0400)
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/4150)

crypto/rand/drbg_lib.c

index e9502db90d9de9a315fe1f281a29620a3b6148e4..0da4d48f55a95aab44e7ea187ba184295e639068 100644 (file)
@@ -403,6 +403,8 @@ static int drbg_status(void)
     int ret;
 
     CRYPTO_THREAD_write_lock(rand_drbg.lock);
+    if (rand_drbg.state == DRBG_UNINITIALISED)
+        RAND_DRBG_instantiate(&rand_drbg, NULL, 0);
     ret = rand_drbg.state == DRBG_READY ? 1 : 0;
     CRYPTO_THREAD_unlock(rand_drbg.lock);
     return ret;