[openssl-commits] [openssl] master update

Paul I. Dale pauli at openssl.org
Tue Sep 4 19:22:11 UTC 2018


The branch master has been updated
       via  64ed55ab033f1bfa795d46f0ecc61c313204b418 (commit)
      from  f5cee414fa8e7e9a088d8d5ebe641f368df20801 (commit)


- Log -----------------------------------------------------------------
commit 64ed55ab033f1bfa795d46f0ecc61c313204b418
Author: Shane Lontis <shane.lontis at oracle.com>
Date:   Tue Sep 4 14:01:37 2018 +1000

    hkdf zeroization fix
    
    Reviewed-by: Paul Yang <yang.yang at baishancloud.com>
    Reviewed-by: Paul Dale <paul.dale at oracle.com>
    (Merged from https://github.com/openssl/openssl/pull/7106)

-----------------------------------------------------------------------

Summary of changes:
 crypto/kdf/hkdf.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/crypto/kdf/hkdf.c b/crypto/kdf/hkdf.c
index baaa16f..ec6090a 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;
 }


More information about the openssl-commits mailing list