diff options
author | Bodo Möller <bodo@openssl.org> | 2001-07-24 12:33:41 +0000 |
---|---|---|
committer | Bodo Möller <bodo@openssl.org> | 2001-07-24 12:33:41 +0000 |
commit | c6719ffb7747607ca38df0fbf4b54d6d85e40674 (patch) | |
tree | 522e40583063793d55281e029734dddf179269f2 /crypto/rand | |
parent | 16fdf5b9046765873b589988b1a6a34b8668deaa (diff) |
Avoid race condition.
Submitted by: Travis Vitek <vitek@roguewave.com>
Diffstat (limited to 'crypto/rand')
-rw-r--r-- | crypto/rand/md_rand.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/crypto/rand/md_rand.c b/crypto/rand/md_rand.c index 04b9d695b0..0db87d4510 100644 --- a/crypto/rand/md_rand.c +++ b/crypto/rand/md_rand.c @@ -361,8 +361,8 @@ static int ssleay_rand_bytes(unsigned char *buf, int num) CRYPTO_w_lock(CRYPTO_LOCK_RAND); /* prevent ssleay_rand_bytes() from trying to obtain the lock again */ - crypto_lock_rand = 1; locking_thread = CRYPTO_thread_id(); + crypto_lock_rand = 1; if (!initialized) { @@ -435,7 +435,6 @@ static int ssleay_rand_bytes(unsigned char *buf, int num) /* before unlocking, we must clear 'crypto_lock_rand' */ crypto_lock_rand = 0; - locking_thread = 0; CRYPTO_w_unlock(CRYPTO_LOCK_RAND); while (num > 0) @@ -528,8 +527,8 @@ static int ssleay_rand_status(void) CRYPTO_w_lock(CRYPTO_LOCK_RAND); /* prevent ssleay_rand_bytes() from trying to obtain the lock again */ - crypto_lock_rand = 1; locking_thread = CRYPTO_thread_id(); + crypto_lock_rand = 1; } if (!initialized) @@ -544,7 +543,6 @@ static int ssleay_rand_status(void) { /* before unlocking, we must clear 'crypto_lock_rand' */ crypto_lock_rand = 0; - locking_thread = 0; CRYPTO_w_unlock(CRYPTO_LOCK_RAND); } |