From fa8faa389a672d804a255220d37f7fb79bb4a0c8 Mon Sep 17 00:00:00 2001 From: Sam Clark <3758302+goatgoose@users.noreply.github.com> Date: Wed, 20 Sep 2023 15:40:18 -0400 Subject: [PATCH] fixes --- ...s2n_client_hello_get_supported_groups_test.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/tests/unit/s2n_client_hello_get_supported_groups_test.c b/tests/unit/s2n_client_hello_get_supported_groups_test.c index 49a1171cbd5..7f5f8daacfc 100644 --- a/tests/unit/s2n_client_hello_get_supported_groups_test.c +++ b/tests/unit/s2n_client_hello_get_supported_groups_test.c @@ -30,8 +30,6 @@ #define TEST_SUPPORTED_GROUPS_EXTENSION_SIZE (2 + TEST_SUPPORTED_GROUPS_LIST_SIZE) struct s2n_client_hello_context { - const struct s2n_kem_preferences *kem_preferences; - const struct s2n_ecc_preferences *ecc_preferences; int invoked_count; }; @@ -51,21 +49,22 @@ int s2n_check_received_supported_groups_cb(struct s2n_connection *conn, void *ct &supported_groups_count, s2n_array_len(supported_groups))); EXPECT_TRUE(supported_groups_count > 0); - uint16_t expected_groups_count = context->ecc_preferences->count; + const struct s2n_security_policy *security_policy = conn->config->security_policy; + uint16_t expected_groups_count = security_policy->ecc_preferences->count; if (s2n_connection_get_protocol_version(conn) >= S2N_TLS13 && s2n_pq_is_enabled()) { - expected_groups_count += context->kem_preferences->tls13_kem_group_count; + expected_groups_count += security_policy->kem_preferences->tls13_kem_group_count; } EXPECT_EQUAL(supported_groups_count, expected_groups_count); size_t offset = 0; - for (size_t i = 0; i < context->kem_preferences->tls13_kem_group_count; i++) { - const struct s2n_kem_group *group = context->kem_preferences->tls13_kem_groups[i]; + for (size_t i = 0; i < security_policy->kem_preferences->tls13_kem_group_count; i++) { + const struct s2n_kem_group *group = security_policy->kem_preferences->tls13_kem_groups[i]; EXPECT_EQUAL(supported_groups[i], group->iana_id); offset += 1; } - for (size_t i = 0; i < context->ecc_preferences->count; i++) { - const struct s2n_ecc_named_curve *curve = context->ecc_preferences->ecc_curves[i]; + for (size_t i = 0; i < security_policy->ecc_preferences->count; i++) { + const struct s2n_ecc_named_curve *curve = security_policy->ecc_preferences->ecc_curves[i]; EXPECT_EQUAL(supported_groups[offset + i], curve->iana_id); } @@ -342,8 +341,6 @@ int main(int argc, char **argv) EXPECT_SUCCESS(s2n_config_set_cipher_preferences(config, security_policies[i])); struct s2n_client_hello_context context = { - .kem_preferences = config->security_policy->kem_preferences, - .ecc_preferences = config->security_policy->ecc_preferences, .invoked_count = 0, }; EXPECT_SUCCESS(s2n_config_set_client_hello_cb(config, s2n_check_received_supported_groups_cb,