]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
rsa: add check after calling BN_BLINDING_lock
authorJiasheng Jiang <jiasheng@iscas.ac.cn>
Sat, 5 Feb 2022 10:00:51 +0000 (18:00 +0800)
committerTomas Mraz <tomas@openssl.org>
Tue, 8 Feb 2022 14:22:35 +0000 (15:22 +0100)
As the potential failure of getting lock, we need to check the return
value of the BN_BLINDING_lock() in order to avoid the dirty data.

Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17642)

crypto/rsa/rsa_ossl.c

index c417a4b8f6dd8071f9a3d80f27fe83e30c1b4275..de4a580032d5f3ccda7a5334665365b71527d7ce 100644 (file)
@@ -213,7 +213,9 @@ static int rsa_blinding_convert(BN_BLINDING *b, BIGNUM *f, BIGNUM *unblind,
          */
         int ret;
 
-        BN_BLINDING_lock(b);
+        if (!BN_BLINDING_lock(b))
+            return 0;
+
         ret = BN_BLINDING_convert_ex(f, unblind, b, ctx);
         BN_BLINDING_unlock(b);