]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
test: test for setting hkdf salt to null
authorPauli <ppzgs1@gmail.com>
Wed, 9 Apr 2025 02:42:40 +0000 (12:42 +1000)
committerMatt Caswell <matt@openssl.org>
Fri, 18 Apr 2025 14:30:19 +0000 (15:30 +0100)
Fixes #27302

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27305)

(cherry picked from commit 727117960c0a47073290de936fb517db12351174)

test/evp_extra_test.c

index 6b8237ddf9a7813134253a356cfe33c9178e7e05..871ef6a807b172bf1223e90cb0eea93af4776f4e 100644 (file)
@@ -2949,6 +2949,7 @@ static int test_empty_salt_info_HKDF(void)
     size_t outlen;
     int ret = 0;
     unsigned char salt[] = "";
+    unsigned char fake[] = "0123456789";
     unsigned char key[] = "012345678901234567890123456789";
     unsigned char info[] = "";
     const unsigned char expected[] = {
@@ -2965,6 +2966,8 @@ static int test_empty_salt_info_HKDF(void)
 
     if (!TEST_int_gt(EVP_PKEY_derive_init(pctx), 0)
             || !TEST_int_gt(EVP_PKEY_CTX_set_hkdf_md(pctx, EVP_sha256()), 0)
+            || !TEST_int_gt(EVP_PKEY_CTX_set1_hkdf_salt(pctx, fake,
+                                                        sizeof(fake) - 1), 0)
             || !TEST_int_gt(EVP_PKEY_CTX_set1_hkdf_salt(pctx, salt,
                                                         sizeof(salt) - 1), 0)
             || !TEST_int_gt(EVP_PKEY_CTX_set1_hkdf_key(pctx, key,