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)
This commit is contained in:
parent
f5cee414fa
commit
64ed55ab03
1 changed files with 4 additions and 4 deletions
|
@ -281,6 +281,7 @@ static unsigned char *HKDF_Expand(const EVP_MD *evp_md,
|
||||||
unsigned char *okm, size_t okm_len)
|
unsigned char *okm, size_t okm_len)
|
||||||
{
|
{
|
||||||
HMAC_CTX *hmac;
|
HMAC_CTX *hmac;
|
||||||
|
unsigned char *ret = NULL;
|
||||||
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
|
@ -330,11 +331,10 @@ static unsigned char *HKDF_Expand(const EVP_MD *evp_md,
|
||||||
|
|
||||||
done_len += copy_len;
|
done_len += copy_len;
|
||||||
}
|
}
|
||||||
|
ret = okm;
|
||||||
HMAC_CTX_free(hmac);
|
|
||||||
return okm;
|
|
||||||
|
|
||||||
err:
|
err:
|
||||||
|
OPENSSL_cleanse(prev, sizeof(prev));
|
||||||
HMAC_CTX_free(hmac);
|
HMAC_CTX_free(hmac);
|
||||||
return NULL;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue