PR: 2295
[openssl.git] / crypto / bn / bn_exp2.c
index b3f43cec8c1c1cc949f24c051c5cb7934f65e443..bd0c34b91bc62243410cd1c7ebf9f71197dcb74f 100644 (file)
@@ -301,7 +301,8 @@ int BN_mod_exp2_mont(BIGNUM *rr, const BIGNUM *a1, const BIGNUM *p1,
                        r_is_one = 0;
                        }
                }
-       BN_from_montgomery(rr,r,mont,ctx);
+       if (!BN_from_montgomery(rr,r,mont,ctx))
+               goto err;
        ret=1;
 err:
        if ((in_mont == NULL) && (mont != NULL)) BN_MONT_CTX_free(mont);