]> 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:32:58 +0000 (15:32 +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 cf4eb69fb720f4a3dacc5ebe9ff4ed65d35abb17..1d14c4400065e4301195db090a66cb78a98efa2b 100644 (file)
@@ -2730,6 +2730,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[] = {
@@ -2746,6 +2747,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,