]> 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:27:20 +0000 (15:27 +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)

test/evp_extra_test.c

index 82ccf9323892110314f44d6a748ab209f4902d06..5368c6266b8b2ef651e72f11394c5c3ee5a01a64 100644 (file)
@@ -3524,6 +3524,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[] = {
@@ -3540,6 +3541,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,