Skip to content

Commit

Permalink
hkdf: when HMAC key is all zeros, still set a valid key length
Browse files Browse the repository at this point in the history
By itself, this is no change in any computation. However, this will
unlock enforcing minimum key lengths for NIST and FIPS 140-3
requirements.

Also reading RFC8448 and RFC5869, this seems to be strictly correct
too.

Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@surgut.co.uk>

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #24204)
  • Loading branch information
xnox authored and t8m committed Apr 25, 2024
1 parent 5d218b0 commit 15d6114
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion providers/implementations/kdfs/hkdf.c
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ static int prov_tls13_hkdf_generate_secret(OSSL_LIB_CTX *libctx,
}
if (prevsecret == NULL) {
prevsecret = default_zeros;
prevsecretlen = 0;
prevsecretlen = mdlen;
} else {
EVP_MD_CTX *mctx = EVP_MD_CTX_new();
unsigned char hash[EVP_MAX_MD_SIZE];
Expand Down

0 comments on commit 15d6114

Please sign in to comment.