From: Jiasheng Jiang Date: Sat, 5 Feb 2022 10:00:51 +0000 (+0800) Subject: rsa: add check after calling BN_BLINDING_lock X-Git-Tag: openssl-3.2.0-alpha1~2962 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aefbcde29166caf851cf388361d70fd0dcf17d87;p=thirdparty%2Fopenssl.git rsa: add check after calling BN_BLINDING_lock 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 Reviewed-by: Paul Dale Reviewed-by: Matt Caswell Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/17642) --- diff --git a/crypto/rsa/rsa_ossl.c b/crypto/rsa/rsa_ossl.c index c417a4b8f6d..de4a580032d 100644 --- a/crypto/rsa/rsa_ossl.c +++ b/crypto/rsa/rsa_ossl.c @@ -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);