Fix a crash in EVP_CIPHER_CTX_cleanup due to cipher_data may be NULL
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Mon, 6 Feb 2017 12:37:42 +0000 (13:37 +0100)
committerMatt Caswell <matt@openssl.org>
Tue, 7 Feb 2017 09:12:34 +0000 (09:12 +0000)
commit273a0218e65f1737cdbb0ef65a5ddebd601e6bef
tree058bca35ee32b87c37543a103d99ee599f7d144c
parentbe4c82aa767998ce2a5717fc895482052373f1b1
Fix a crash in EVP_CIPHER_CTX_cleanup due to cipher_data may be NULL
or EVP_CTRL_INIT/EVP_CTRL_COPY was not called or failed.
If that happens in EVP_CipherInit_ex/EVP_CIPHER_CTX_copy set cipher = NULL,
aes_gcm_cleanup should check that gctx != NULL before calling OPENSSL_cleanse.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2562)
crypto/evp/e_aes.c
crypto/evp/evp_enc.c