summaryrefslogtreecommitdiffstats
path: root/crypto/bn/bn_mont.c
diff options
context:
space:
mode:
authorBen Laurie <ben@openssl.org>2000-07-01 16:30:27 +0000
committerBen Laurie <ben@openssl.org>2000-07-01 16:30:27 +0000
commit69b5d3c51fa30072895a60d8a6aca0fcb231442b (patch)
tree3980b2d5ebfac79208a44da0379c0dc97112022b /crypto/bn/bn_mont.c
parent2bfb4dbce445eaa4dc06d3012a41eeb78628a06f (diff)
Don't let top go below zero!
Diffstat (limited to 'crypto/bn/bn_mont.c')
-rw-r--r--crypto/bn/bn_mont.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/bn/bn_mont.c b/crypto/bn/bn_mont.c
index e5fbcd619f..6a54e8f4cf 100644
--- a/crypto/bn/bn_mont.c
+++ b/crypto/bn/bn_mont.c
@@ -90,7 +90,7 @@ int BN_mod_mul_montgomery(BIGNUM *r, BIGNUM *a, BIGNUM *b,
bn_wexpand(tmp2,a->top*4);
bn_sqr_recursive(tmp->d,a->d,a->top,tmp2->d);
tmp->top=a->top*2;
- if (tmp->d[tmp->top-1] == 0)
+ if (tmp->top > 0 && tmp->d[tmp->top-1] == 0)
tmp->top--;
#else
if (!BN_sqr(tmp,a,ctx)) goto err;