add missing check for BN_mod_inverse
[openssl.git] / crypto / rsa / rsa_x931g.c
index bc03875f3be3527d91c61c57040c6d69b47a099e..160177721c852255a9589d639aa167a78dac1117 100644 (file)
@@ -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: