'entropy >= ENTROPY_NEEDED' should be evaluated while the
authorBodo Möller <bodo@openssl.org>
Thu, 30 Mar 2000 06:11:54 +0000 (06:11 +0000)
committerBodo Möller <bodo@openssl.org>
Thu, 30 Mar 2000 06:11:54 +0000 (06:11 +0000)
variables are locked.

crypto/rand/md_rand.c

index 79e3484..da4258c 100644 (file)
@@ -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