'entropy >= ENTROPY_NEEDED' should be evaluated while the
[openssl.git] / crypto / rand / md_rand.c
index 79e3484b4dec1012957cb6691ff731a83e74b1e4..da4258c479ca1a23c009e34a5efc1d231e147131 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