From: Richard Levitte Date: Mon, 2 Aug 2004 14:15:07 +0000 (+0000) Subject: Let's lock a write lock when changing values, shall we? X-Git-Tag: OpenSSL_0_9_7e~37 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=eb7bb5847190cfdeed5a61ef5ec1fbea3f815e38;p=openssl Let's lock a write lock when changing values, shall we? Thanks to Dr Stephen Henson for making me aware of this error. --- diff --git a/crypto/cryptlib.c b/crypto/cryptlib.c index d1851b3085..b8e700ce52 100644 --- a/crypto/cryptlib.c +++ b/crypto/cryptlib.c @@ -551,13 +551,13 @@ int fips_set_owning_thread(void) if (fips_is_started()) { - CRYPTO_r_lock(CRYPTO_LOCK_FIPS2); + CRYPTO_w_lock(CRYPTO_LOCK_FIPS2); if (fips_thread == 0) { fips_thread = CRYPTO_thread_id(); ret = 1; } - CRYPTO_r_unlock(CRYPTO_LOCK_FIPS2); + CRYPTO_w_unlock(CRYPTO_LOCK_FIPS2); } return ret; } @@ -568,13 +568,13 @@ int fips_clear_owning_thread(void) if (fips_is_started()) { - CRYPTO_r_lock(CRYPTO_LOCK_FIPS2); + CRYPTO_w_lock(CRYPTO_LOCK_FIPS2); if (fips_thread == CRYPTO_thread_id()) { fips_thread = 0; ret = 1; } - CRYPTO_r_unlock(CRYPTO_LOCK_FIPS2); + CRYPTO_w_unlock(CRYPTO_LOCK_FIPS2); } return ret; }