summaryrefslogtreecommitdiffstats
path: root/crypto/bn/bn_asm.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/bn/bn_asm.c')
-rw-r--r--crypto/bn/bn_asm.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/crypto/bn/bn_asm.c b/crypto/bn/bn_asm.c
index 286a0f1e74..4d3da16a0c 100644
--- a/crypto/bn/bn_asm.c
+++ b/crypto/bn/bn_asm.c
@@ -264,18 +264,20 @@ BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d)
else
q=h/dh;
+ th=q*dh;
+ tl=dl*q;
for (;;)
{
- t=(h-(th=q*dh));
- tl=BN_MASK2;
+ t=h-th;
if ((t&BN_MASK2h) ||
- ((tl=dl*q) <= (
+ ((tl) <= (
(t<<BN_BITS4)|
((l&BN_MASK2h)>>BN_BITS4))))
break;
q--;
+ th-=dh;
+ tl-=dl;
}
- if (tl==BN_MASK2) tl=q*dl;
t=(tl>>BN_BITS4);
tl=(tl<<BN_BITS4)&BN_MASK2h;
th+=t;