From b841e0acd856b3ab72b34f89d282b402d10b967f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bodo=20M=C3=B6ller?= Date: Thu, 30 Mar 2000 06:11:54 +0000 Subject: [PATCH] 'entropy >= ENTROPY_NEEDED' should be evaluated while the variables are locked. --- crypto/rand/md_rand.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crypto/rand/md_rand.c b/crypto/rand/md_rand.c index 79e3484b4d..da4258c479 100644 --- a/crypto/rand/md_rand.c +++ b/crypto/rand/md_rand.c @@ -559,14 +559,17 @@ static int ssleay_rand_pseudo_bytes(unsigned char *buf, int num) static int ssleay_rand_status(void) { + int ret; + CRYPTO_w_lock(CRYPTO_LOCK_RAND); if (!initialized) ssleay_rand_initialize(); + ret = entropy >= ENTROPY_NEEDED; CRYPTO_w_unlock(CRYPTO_LOCK_RAND); - return (entropy >= ENTROPY_NEEDED); + return ret; } #ifdef WINDOWS -- 2.25.1