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 18:57:01 +0000 (19:57 +0100)
commit6a009812b2e249fed01488f6f19f9fbfd9ee74c4
tree56bd838e9d50be78716dd2437fbb2682b8fa98ee
parent61e72d761c945e128ca13599a98a187ac23650dd
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