summaryrefslogtreecommitdiffstats
path: root/crypto/bn/bn_div.c
diff options
context:
space:
mode:
authorGeoff Thorpe <geoff@openssl.org>2004-03-09 03:53:40 +0000
committerGeoff Thorpe <geoff@openssl.org>2004-03-09 03:53:40 +0000
commita8aa764d3c96eb65b22863cdc5f6ab08d92dd355 (patch)
treef6b27ded43690e9ada28fb27ceba23ba3ea25431 /crypto/bn/bn_div.c
parente7716b7a197d551a22dfdb4df6021db8e92bae5d (diff)
Minimise the amount of code dependent on BN_DEBUG_RAND. In particular,
redefine bn_clear_top2max() to be a NOP in the non-debugging case, and remove some unnecessary usages in bn_nist.c. Submitted by: Nils Larsch Reviewed by: Geoff Thorpe, Ulf Möller
Diffstat (limited to 'crypto/bn/bn_div.c')
-rw-r--r--crypto/bn/bn_div.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/crypto/bn/bn_div.c b/crypto/bn/bn_div.c
index 2f464b31d1..556fcda1e3 100644
--- a/crypto/bn/bn_div.c
+++ b/crypto/bn/bn_div.c
@@ -232,10 +232,8 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
wnum.neg = 0;
wnum.d = &(snum->d[loop]);
wnum.top = div_n;
-#ifdef BN_DEBUG_RAND
/* only needed when BN_ucmp messes up the values between top and max */
wnum.dmax = snum->dmax - loop; /* so we don't step out of bounds */
-#endif
/* Get the top 2 words of sdiv */
/* div_n=sdiv->top; */
@@ -256,12 +254,10 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
if (BN_ucmp(&wnum,sdiv) >= 0)
{
-#ifdef BN_DEBUG_RAND
/* If BN_DEBUG_RAND is defined BN_ucmp changes (via
* bn_pollute) the const bignum arguments =>
* clean the values between top and max again */
bn_clear_top2max(&wnum);
-#endif
bn_sub_words(wnum.d, wnum.d, sdiv->d, div_n);
*resp=1;
}
@@ -384,13 +380,13 @@ X) -> 0x%08X\n",
/* store part of the result */
*resp = q;
}
+ bn_correct_top(snum);
if (rm != NULL)
{
/* Keep a copy of the neg flag in num because if rm==num
* BN_rshift() will overwrite it.
*/
int neg = num->neg;
- bn_correct_top(snum);
BN_rshift(rm,snum,norm_shift);
if (!BN_is_zero(rm))
rm->neg = neg;