Check for 0 modulus in BN_MONT_CTX_set
authorMatt Caswell <matt@openssl.org>
Mon, 10 Aug 2015 11:00:29 +0000 (12:00 +0100)
committerMatt Caswell <matt@openssl.org>
Tue, 11 Aug 2015 19:20:24 +0000 (20:20 +0100)
commit512368c9ed4d53fb230000e83071eb81bf628b22
treef4fe0e828a7793f598c7b8e48d004e554140b7cc
parentada57746b6b80beae73111fe1291bf8dd89af91c
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.

Reviewed-by: Richard Levitte <levitte@openssl.org>
crypto/bn/bn_mont.c