From 55833a8de70589a5000044b6291e190f5a3826ae Mon Sep 17 00:00:00 2001 From: Mansour Ahmadi Date: Tue, 11 Dec 2018 15:48:08 -0500 Subject: [PATCH] add missing check for BN_mod_inverse Fixes #7650 Reviewed-by: Kurt Roeckx Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/7876) --- crypto/rsa/rsa_x931g.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crypto/rsa/rsa_x931g.c b/crypto/rsa/rsa_x931g.c index bc03875f3b..160177721c 100644 --- a/crypto/rsa/rsa_x931g.c +++ b/crypto/rsa/rsa_x931g.c @@ -128,6 +128,8 @@ int RSA_X931_derive_ex(RSA *rsa, BIGNUM *p1, BIGNUM *p2, BIGNUM *q1, /* calculate inverse of q mod p */ rsa->iqmp = BN_mod_inverse(NULL, rsa->q, rsa->p, ctx2); + if (rsa->iqmp == NULL) + goto err; ret = 1; err: -- 2.25.1