From: Pauli Date: Tue, 31 Jul 2018 03:11:00 +0000 (+1000) Subject: Check return from BN_sub X-Git-Tag: OpenSSL_1_1_1-pre9~70 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=3d3cbce550ff5d6172cf28dbbf80bda93f6577a9;p=oweals%2Fopenssl.git Check return from BN_sub Reviewed-by: Tim Hudson (Merged from https://github.com/openssl/openssl/pull/6823) --- diff --git a/crypto/rsa/rsa_ossl.c b/crypto/rsa/rsa_ossl.c index feb1ab4f07..c441905526 100644 --- a/crypto/rsa/rsa_ossl.c +++ b/crypto/rsa/rsa_ossl.c @@ -339,7 +339,8 @@ static int rsa_ossl_private_encrypt(int flen, const unsigned char *from, goto err; if (padding == RSA_X931_PADDING) { - BN_sub(f, rsa->n, ret); + if (!BN_sub(f, rsa->n, ret)) + goto err; if (BN_cmp(ret, f) > 0) res = f; else