]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
hkdf: when HMAC key is all zeros, still set a valid key length master
authorDimitri John Ledkov <dimitri.ledkov@surgut.co.uk>
Fri, 19 Apr 2024 10:50:34 +0000 (11:50 +0100)
committerTomas Mraz <tomas@openssl.org>
Thu, 25 Apr 2024 12:00:05 +0000 (14:00 +0200)
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 https://github.com/openssl/openssl/pull/24204)

providers/implementations/kdfs/hkdf.c

index a634216419b7c710d0ce2a810f7ed35d13fad61e..3f65346a2b0b72f5016c587812ae40598c5b0f50 100644 (file)
@@ -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];