summaryrefslogtreecommitdiffstats
path: root/crypto/bn/bn_lib.c
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2002-08-03 18:27:47 +0000
committerBodo Möller <bodo@openssl.org>2002-08-03 18:27:47 +0000
commit183847747af50de1f0c6da1224e0ad6b6f54ebea (patch)
tree5f70b87bf030a35b2a7195db01505495b242f6d4 /crypto/bn/bn_lib.c
parentbac6012308e05c187bc11bcb44b984bcd71365e7 (diff)
fix bn_expand2
Diffstat (limited to 'crypto/bn/bn_lib.c')
-rw-r--r--crypto/bn/bn_lib.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/crypto/bn/bn_lib.c b/crypto/bn/bn_lib.c
index 60e3c680bc..20f851cc66 100644
--- a/crypto/bn/bn_lib.c
+++ b/crypto/bn/bn_lib.c
@@ -453,13 +453,14 @@ BIGNUM *bn_expand2(BIGNUM *b, int words)
if ((b != NULL) && (b->top < b->dmax))
{
A = &(b->d[b->top]);
- for (i=(words - b->top)>>3; i>0; i--,A+=8)
+ for (i=(b->dmax - b->top)>>3; i>0; i--,A+=8)
{
A[0]=0; A[1]=0; A[2]=0; A[3]=0;
A[4]=0; A[5]=0; A[6]=0; A[7]=0;
}
- for (i=(words - b->top)&7; i>0; i--,A++)
+ for (i=(b->dmax - b->top)&7; i>0; i--,A++)
A[0]=0;
+ assert(A == &(b->d[b->dmax]));
}
return b;