protect BN_BLINDING_invert with a write lock and BN_BLINDING_convert
authorNils Larsch <nils@openssl.org>
Thu, 22 Sep 2005 23:37:37 +0000 (23:37 +0000)
committerNils Larsch <nils@openssl.org>
Thu, 22 Sep 2005 23:37:37 +0000 (23:37 +0000)
with a read lock

Submitted by: Leandro Santi <lesanti@fiuba7504.com.ar>

crypto/rsa/rsa_eay.c

index 620ac5544b78cb0d0f202aed02ee03d151feb009..56da944845996ee6655028a2e7715a68599504a1 100644 (file)
@@ -283,9 +283,9 @@ static int rsa_blinding_convert(BN_BLINDING *b, int local, BIGNUM *f,
        else
                {
                int ret;
-               CRYPTO_w_lock(CRYPTO_LOCK_RSA_BLINDING);
+               CRYPTO_r_lock(CRYPTO_LOCK_RSA_BLINDING);
                ret = BN_BLINDING_convert_ex(f, r, b, ctx);
-               CRYPTO_w_unlock(CRYPTO_LOCK_RSA_BLINDING);
+               CRYPTO_r_unlock(CRYPTO_LOCK_RSA_BLINDING);
                return ret;
                }
 }
@@ -298,9 +298,9 @@ static int rsa_blinding_invert(BN_BLINDING *b, int local, BIGNUM *f,
        else
                {
                int ret;
-               CRYPTO_r_lock(CRYPTO_LOCK_RSA_BLINDING);
+               CRYPTO_w_lock(CRYPTO_LOCK_RSA_BLINDING);
                ret = BN_BLINDING_invert_ex(f, r, b, ctx);
-               CRYPTO_r_unlock(CRYPTO_LOCK_RSA_BLINDING);
+               CRYPTO_w_unlock(CRYPTO_LOCK_RSA_BLINDING);
                return ret;
                }
 }