summaryrefslogtreecommitdiffstats
path: root/crypto/bn/bn_mont.c
diff options
context:
space:
mode:
authorGeoff Thorpe <geoff@openssl.org>2003-11-04 22:54:49 +0000
committerGeoff Thorpe <geoff@openssl.org>2003-11-04 22:54:49 +0000
commitd870740cd75dd4f0cb66fb8c32653a7d47369706 (patch)
tree0c6cb1ce0b1083c96419c432d1f05c3dff51320d /crypto/bn/bn_mont.c
parentd8ec0dcf457f4dec39f137657b702fcbeaf5cc04 (diff)
Put the first stage of my bignum debugging adventures into CVS. This code
is itself experimental, and in addition may cause execution to break on existing openssl "bugs" that previously were harmless or at least invisible.
Diffstat (limited to 'crypto/bn/bn_mont.c')
-rw-r--r--crypto/bn/bn_mont.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/crypto/bn/bn_mont.c b/crypto/bn/bn_mont.c
index c9ebdbaabe..22d23cc3d7 100644
--- a/crypto/bn/bn_mont.c
+++ b/crypto/bn/bn_mont.c
@@ -90,6 +90,7 @@ int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
}
/* reduce from aRR to aR */
if (!BN_from_montgomery(r,tmp,mont,ctx)) goto err;
+ bn_check_top(r);
ret=1;
err:
BN_CTX_end(ctx);
@@ -172,7 +173,7 @@ int BN_from_montgomery(BIGNUM *ret, const BIGNUM *a, BN_MONT_CTX *mont,
for (x=2; (((++nrp[x])&BN_MASK2) == 0); x++) ;
}
}
- bn_fix_top(r);
+ bn_correct_top(r);
/* mont->ri will be a multiple of the word size */
#if 0
@@ -229,6 +230,7 @@ int BN_from_montgomery(BIGNUM *ret, const BIGNUM *a, BN_MONT_CTX *mont,
if (!BN_usub(ret,ret,&(mont->N))) goto err;
}
retn=1;
+ bn_check_top(ret);
err:
BN_CTX_end(ctx);
return(retn);