summaryrefslogtreecommitdiffstats
path: root/crypto/rand
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2017-04-07 16:26:10 +0200
committerRichard Levitte <levitte@openssl.org>2017-04-07 16:34:40 +0200
commit8d8cae7d3028de123a081196897b0ccedf921c6f (patch)
treeb505a4650a99792465129684a7c05dad7bdd788a /crypto/rand
parentdf13eb7ae70073de8c95ca3c7d2f587037582470 (diff)
Fix rand_lib.c for no-engine configuration
When configured no-engine, we still refered to rand_engine_lock. Rework the lock init code to avoid that. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3145) (cherry picked from commit 2f881d2d9065342454fe352eac9e835cefa0ba90)
Diffstat (limited to 'crypto/rand')
-rw-r--r--crypto/rand/rand_lib.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/crypto/rand/rand_lib.c b/crypto/rand/rand_lib.c
index 9939540fe8..c1373e5942 100644
--- a/crypto/rand/rand_lib.c
+++ b/crypto/rand/rand_lib.c
@@ -31,11 +31,14 @@ static CRYPTO_ONCE rand_lock_init = CRYPTO_ONCE_STATIC_INIT;
DEFINE_RUN_ONCE_STATIC(do_rand_lock_init)
{
+ int ret = 1;
#ifndef OPENSSL_NO_ENGINE
rand_engine_lock = CRYPTO_THREAD_lock_new();
+ ret &= rand_engine_lock != NULL;
#endif
rand_meth_lock = CRYPTO_THREAD_lock_new();
- return rand_engine_lock != NULL && rand_meth_lock != NULL;
+ ret &= rand_meth_lock != NULL;
+ return ret;
}
int RAND_set_rand_method(const RAND_METHOD *meth)