diff options
author | Shane Lontis <shane.lontis@oracle.com> | 2018-09-04 14:01:37 +1000 |
---|---|---|
committer | Pauli <paul.dale@oracle.com> | 2018-09-05 05:23:00 +1000 |
commit | b5b39779f3dfe811a64899bd8b33397647dda57a (patch) | |
tree | 87a0aee95d408fad83b357f1f3a0b839dc4772e1 | |
parent | febb025068f6c74f6776cc7faf1a8bcd55138f87 (diff) |
hkdf zeroization fix
Reviewed-by: Paul Yang <yang.yang@baishancloud.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/7106)
(cherry picked from commit 64ed55ab033f1bfa795d46f0ecc61c313204b418)
-rw-r--r-- | crypto/kdf/hkdf.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/crypto/kdf/hkdf.c b/crypto/kdf/hkdf.c index 00b95b5a88..6d38a2fded 100644 --- a/crypto/kdf/hkdf.c +++ b/crypto/kdf/hkdf.c @@ -234,6 +234,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; @@ -283,11 +284,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; } |