From 727117960c0a47073290de936fb517db12351174 Mon Sep 17 00:00:00 2001 From: Pauli Date: Wed, 9 Apr 2025 12:42:40 +1000 Subject: [PATCH] test: test for setting hkdf salt to null Fixes #27302 Reviewed-by: Viktor Dukhovni Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/27305) --- test/evp_extra_test.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/evp_extra_test.c b/test/evp_extra_test.c index 82ccf932389..5368c6266b8 100644 --- a/test/evp_extra_test.c +++ b/test/evp_extra_test.c @@ -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, -- 2.47.2