cryptodev_digest_update: don't leak original state->mac_data if realloc fails
[oweals/openssl.git] / crypto / bn / bn_exp2.c
index b3f43cec8c1c1cc949f24c051c5cb7934f65e443..a00c11521684030ea2acb5c33973641ce190546f 100644 (file)
  *
  */
 
+#define OPENSSL_FIPSAPI
+
 #include <stdio.h>
 #include "cryptlib.h"
 #include "bn_lcl.h"
@@ -301,7 +303,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);