Remove a = 0 special-case in BN_mod_exp_mont. BN_mod_exp_mont is intended to protect the base, but not the exponent. Accordingly, it shouldn't treat a base of zero as special. Change-Id: Ib053e8ce65ab1741973a9f9bfeff8c353567439c Reviewed-on: https://boringssl-review.googlesource.com/27284 Reviewed-by: Adam Langley <agl@google.com>
diff --git a/crypto/fipsmodule/bn/exponentiation.c b/crypto/fipsmodule/bn/exponentiation.c index c85c00b..12bc6e8 100644 --- a/crypto/fipsmodule/bn/exponentiation.c +++ b/crypto/fipsmodule/bn/exponentiation.c
@@ -639,12 +639,6 @@ aa = a; } - if (BN_is_zero(aa)) { - BN_zero(rr); - ret = 1; - goto err; - } - // We exponentiate by looking at sliding windows of the exponent and // precomputing powers of |aa|. Windows may be shifted so they always end on a // set bit, so only precompute odd powers. We compute val[i] = aa^(2*i + 1)