Skip to content

Commit

Permalink
Add forgotten crypto_kdf_hkdf_sha512_statebytes()
Browse files Browse the repository at this point in the history
  • Loading branch information
jedisct1 committed Nov 29, 2023
1 parent 2945e73 commit 60c0c40
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/libsodium/crypto_kdf/hkdf/kdf_hkdf_sha512.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,8 @@ crypto_kdf_hkdf_sha512_bytes_max(void)
{
return crypto_kdf_hkdf_sha512_BYTES_MAX;
}

size_t crypto_kdf_hkdf_sha512_statebytes(void)
{
return sizeof(crypto_kdf_hkdf_sha512_state);
}
2 changes: 2 additions & 0 deletions test/default/kdf_hkdf.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,12 @@ tv_kdf_hkdf(void)
assert(crypto_kdf_hkdf_sha512_bytes_min() == crypto_kdf_hkdf_sha512_BYTES_MIN);
assert(crypto_kdf_hkdf_sha512_bytes_max() == crypto_kdf_hkdf_sha512_BYTES_MAX);
assert(crypto_kdf_hkdf_sha512_keybytes() == crypto_kdf_hkdf_sha512_KEYBYTES);
assert(crypto_kdf_hkdf_sha512_statebytes() >= sizeof (crypto_kdf_hkdf_sha512_state));

assert(crypto_kdf_hkdf_sha256_bytes_min() == crypto_kdf_hkdf_sha256_BYTES_MIN);
assert(crypto_kdf_hkdf_sha256_bytes_max() == crypto_kdf_hkdf_sha256_BYTES_MAX);
assert(crypto_kdf_hkdf_sha256_keybytes() == crypto_kdf_hkdf_sha256_KEYBYTES);
assert(crypto_kdf_hkdf_sha256_statebytes() >= sizeof (crypto_kdf_hkdf_sha256_state));

assert(crypto_kdf_hkdf_sha256_KEYBYTES < crypto_kdf_hkdf_sha512_KEYBYTES);

Expand Down

0 comments on commit 60c0c40

Please sign in to comment.