boringssl/crypto/bn
David Benjamin 9e45d6e42f Check for 0 modulus in BN_MONT_CTX_set.
The function BN_MONT_CTX_set was assuming that the modulus was non-zero
and therefore that |mod->top| > 0. In an error situation that may not be
the case and could cause a seg fault.

This is a follow on from CVE-2015-1794.

(Imported from upstream's 512368c9ed4d53fb230000e83071eb81bf628b22.)

The CVE itself doesn't affect us as the bit strength check in the DHE logic
excludes zero.

Also add tests to bn_test for a couple of division by zero cases. (This and
BN_div.)

Change-Id: Ibd8ef98d6be48eb95110021c23cd8e278656764d
Reviewed-on: https://boringssl-review.googlesource.com/5690
Reviewed-by: Adam Langley <agl@google.com>
2015-08-17 20:32:38 +00:00
..
asm Don't use x86_64-gcc.c with NO_ASM. 2015-05-15 22:23:49 +00:00
add.c Remove the func parameter to OPENSSL_PUT_ERROR. 2015-07-16 02:02:37 +00:00
bn_asn1.c Remove the func parameter to OPENSSL_PUT_ERROR. 2015-07-16 02:02:37 +00:00
bn_test.cc Check for 0 modulus in BN_MONT_CTX_set. 2015-08-17 20:32:38 +00:00
bn.c Get overflow checks right in BN_bin2bn. 2015-08-17 20:30:00 +00:00
CMakeLists.txt Rename crypto/{bn,evp}/asn1.c. 2015-07-13 21:18:26 +00:00
cmp.c
convert.c Get overflow checks right in BN_bin2bn. 2015-08-17 20:30:00 +00:00
ctx.c Remove the func parameter to OPENSSL_PUT_ERROR. 2015-07-16 02:02:37 +00:00
div.c Remove the func parameter to OPENSSL_PUT_ERROR. 2015-07-16 02:02:37 +00:00
exponentiation.c Remove stray (void)0. 2015-08-07 01:53:43 +00:00
gcd.c Remove the func parameter to OPENSSL_PUT_ERROR. 2015-07-16 02:02:37 +00:00
generic.c Add in missing curly braces part 1. 2015-02-11 19:31:01 +00:00
internal.h Get overflow checks right in BN_bin2bn. 2015-08-17 20:30:00 +00:00
kronecker.c
montgomery.c Check for 0 modulus in BN_MONT_CTX_set. 2015-08-17 20:32:38 +00:00
mul.c Check for BN_copy failures. 2015-06-15 17:52:40 +00:00
prime.c Remove the func parameter to OPENSSL_PUT_ERROR. 2015-07-16 02:02:37 +00:00
random.c Remove the func parameter to OPENSSL_PUT_ERROR. 2015-07-16 02:02:37 +00:00
rsaz_exp.c
rsaz_exp.h Fix license on rsaz_exp.h. 2015-07-27 22:21:11 +00:00
shift.c Remove the func parameter to OPENSSL_PUT_ERROR. 2015-07-16 02:02:37 +00:00
sqrt.c Remove the func parameter to OPENSSL_PUT_ERROR. 2015-07-16 02:02:37 +00:00