1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-19 18:15:18 -07:00

Proper zeroization in hkdf

Fixes #1375
This commit is contained in:
Frank Denis 2024-05-30 15:56:54 +02:00
parent 7978205916
commit 704e97fdf5
2 changed files with 2 additions and 2 deletions

View File

@ -26,7 +26,7 @@ crypto_kdf_hkdf_sha256_extract_final(crypto_kdf_hkdf_sha256_state *state,
unsigned char prk[crypto_kdf_hkdf_sha256_KEYBYTES]) unsigned char prk[crypto_kdf_hkdf_sha256_KEYBYTES])
{ {
crypto_auth_hmacsha256_final(&state->st, prk); crypto_auth_hmacsha256_final(&state->st, prk);
sodium_memzero(state, sizeof state); sodium_memzero(state, sizeof *state);
return 0; return 0;
} }

View File

@ -26,7 +26,7 @@ crypto_kdf_hkdf_sha512_extract_final(crypto_kdf_hkdf_sha512_state *state,
unsigned char prk[crypto_kdf_hkdf_sha512_KEYBYTES]) unsigned char prk[crypto_kdf_hkdf_sha512_KEYBYTES])
{ {
crypto_auth_hmacsha512_final(&state->st, prk); crypto_auth_hmacsha512_final(&state->st, prk);
sodium_memzero(state, sizeof state); sodium_memzero(state, sizeof *state);
return 0; return 0;
} }