summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bn/bn_mont.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/bn/bn_mont.c')
-rw-r--r--src/lib/libcrypto/bn/bn_mont.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lib/libcrypto/bn/bn_mont.c b/src/lib/libcrypto/bn/bn_mont.c
index 7bb0b91223..598fecbf0c 100644
--- a/src/lib/libcrypto/bn/bn_mont.c
+++ b/src/lib/libcrypto/bn/bn_mont.c
@@ -73,6 +73,7 @@ int BN_mod_mul_montgomery(BIGNUM *r, BIGNUM *a, BIGNUM *b,
73 BN_MONT_CTX *mont, BN_CTX *ctx) 73 BN_MONT_CTX *mont, BN_CTX *ctx)
74 { 74 {
75 BIGNUM *tmp,*tmp2; 75 BIGNUM *tmp,*tmp2;
76 int ret=0;
76 77
77 BN_CTX_start(ctx); 78 BN_CTX_start(ctx);
78 tmp = BN_CTX_get(ctx); 79 tmp = BN_CTX_get(ctx);
@@ -101,10 +102,10 @@ int BN_mod_mul_montgomery(BIGNUM *r, BIGNUM *a, BIGNUM *b,
101 } 102 }
102 /* reduce from aRR to aR */ 103 /* reduce from aRR to aR */
103 if (!BN_from_montgomery(r,tmp,mont,ctx)) goto err; 104 if (!BN_from_montgomery(r,tmp,mont,ctx)) goto err;
104 BN_CTX_end(ctx); 105 ret=1;
105 return(1);
106err: 106err:
107 return(0); 107 BN_CTX_end(ctx);
108 return(ret);
108 } 109 }
109 110
110int BN_from_montgomery(BIGNUM *ret, BIGNUM *a, BN_MONT_CTX *mont, 111int BN_from_montgomery(BIGNUM *ret, BIGNUM *a, BN_MONT_CTX *mont,