Add lots of checks for memory allocation failure, error codes to indicate
[openssl.git] / crypto / bn / bn_mont.c
index 287392db0f000b8a3aec38f668e8548859071e29..61416483cb26761b113935857fc677a5081eac4d 100644 (file)
@@ -277,7 +277,7 @@ int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx)
        BN_CTX_start(ctx);
        if((Ri = BN_CTX_get(ctx)) == NULL) goto err;
        R= &(mont->RR);                                 /* grab RR as a temp */
-       BN_copy(&(mont->N),mod);                        /* Set N */
+       if (!BN_copy(&(mont->N),mod)) goto err;         /* Set N */
        mont->N.neg = 0;
 
 #ifdef MONT_WORD