From: Shane Lontis Date: Tue, 4 Sep 2018 04:01:37 +0000 (+1000) Subject: hkdf zeroization fix X-Git-Tag: OpenSSL_1_1_1~45 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=64ed55ab033f1bfa795d46f0ecc61c313204b418;p=oweals%2Fopenssl.git hkdf zeroization fix Reviewed-by: Paul Yang Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/7106) --- diff --git a/crypto/kdf/hkdf.c b/crypto/kdf/hkdf.c index baaa16f0b7..ec6090ad6a 100644 --- a/crypto/kdf/hkdf.c +++ b/crypto/kdf/hkdf.c @@ -281,6 +281,7 @@ static unsigned char *HKDF_Expand(const EVP_MD *evp_md, unsigned char *okm, size_t okm_len) { HMAC_CTX *hmac; + unsigned char *ret = NULL; unsigned int i; @@ -330,11 +331,10 @@ static unsigned char *HKDF_Expand(const EVP_MD *evp_md, done_len += copy_len; } - - HMAC_CTX_free(hmac); - return okm; + ret = okm; err: + OPENSSL_cleanse(prev, sizeof(prev)); HMAC_CTX_free(hmac); - return NULL; + return ret; }