From 3d3cbce550ff5d6172cf28dbbf80bda93f6577a9 Mon Sep 17 00:00:00 2001 From: Pauli Date: Tue, 31 Jul 2018 13:11:00 +1000 Subject: [PATCH] Check return from BN_sub Reviewed-by: Tim Hudson (Merged from https://github.com/openssl/openssl/pull/6823) --- crypto/rsa/rsa_ossl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 -- 2.25.1