From: Bernd Edlinger Date: Sun, 1 Jan 2017 13:53:33 +0000 (+0100) Subject: aes_gcm_cleanup() should check that gctx != NULL before X-Git-Tag: OpenSSL_1_0_2l~103 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=166e365ed84dfabec3274baf8a9ef8aa4e677891;p=openssl aes_gcm_cleanup() should check that gctx != NULL before calling OPENSSL_cleanse() Reviewed-by: Richard Levitte Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/2149) --- diff --git a/crypto/evp/e_aes.c b/crypto/evp/e_aes.c index 7c62d327a1..47fcd82077 100644 --- a/crypto/evp/e_aes.c +++ b/crypto/evp/e_aes.c @@ -1120,6 +1120,8 @@ BLOCK_CIPHER_generic_pack(NID_aes, 128, EVP_CIPH_FLAG_FIPS) static int aes_gcm_cleanup(EVP_CIPHER_CTX *c) { EVP_AES_GCM_CTX *gctx = c->cipher_data; + if (gctx == NULL) + return 0; OPENSSL_cleanse(&gctx->gcm, sizeof(gctx->gcm)); if (gctx->iv != c->iv) OPENSSL_free(gctx->iv);