From cb5b7850acd0d30c7550323b450abd2841f829db Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bodo=20M=C3=B6ller?= Date: Tue, 1 Feb 2000 11:10:54 +0000 Subject: [PATCH] If n0 == d0, we must alway compute 'rem' "by hand" --- crypto/bn/bn_div.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crypto/bn/bn_div.c b/crypto/bn/bn_div.c index 928773af1c..f15eced0cf 100644 --- a/crypto/bn/bn_div.c +++ b/crypto/bn/bn_div.c @@ -235,8 +235,13 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, n0=wnump[0]; n1=wnump[-1]; if (n0 == d0) + { q=BN_MASK2; - else +#ifdef REMAINDER_IS_ALREADY_CALCULATED /* in this case it isn't */ + rem=(n1-q*d0)&BN_MASK2; +#endif + } + else /* n0 < d0 */ #if defined(BN_LLONG) && defined(BN_DIV2W) && !defined(bn_div_words) q=(BN_ULONG)(((((BN_ULLONG)n0)<