summaryrefslogtreecommitdiffstats
path: root/crypto/bn/bn_exp2.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/bn/bn_exp2.c')
-rw-r--r--crypto/bn/bn_exp2.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/crypto/bn/bn_exp2.c b/crypto/bn/bn_exp2.c
index 70c4d83a79..56f1c959bd 100644
--- a/crypto/bn/bn_exp2.c
+++ b/crypto/bn/bn_exp2.c
@@ -141,9 +141,15 @@ int BN_mod_exp2_mont(BIGNUM *rr, const BIGNUM *a1, const BIGNUM *p1,
bits2=BN_num_bits(p2);
if ((bits1 == 0) && (bits2 == 0))
{
- BN_one(rr);
- return(1);
+ ret = BN_one(rr);
+ return ret;
}
+ if (BN_is_zero(a1) || BN_is_zero(a2))
+ {
+ ret = BN_zero(rr);
+ return ret;
+ }
+
bits=(bits1 > bits2)?bits1:bits2;
BN_CTX_start(ctx);