From c050b0846a00f242c2313db61f92b620aed1b9dc Mon Sep 17 00:00:00 2001 From: toidiu Date: Tue, 7 Feb 2023 16:19:39 -0800 Subject: [PATCH] ktls: rm kTLS request field on config (#3816) --- tests/unit/s2n_ktls_mode_test.c | 30 ------------------------------ tls/s2n_config.c | 27 --------------------------- tls/s2n_config.h | 6 ------ 3 files changed, 63 deletions(-) diff --git a/tests/unit/s2n_ktls_mode_test.c b/tests/unit/s2n_ktls_mode_test.c index 042b8509fec..04bad8526e2 100644 --- a/tests/unit/s2n_ktls_mode_test.c +++ b/tests/unit/s2n_ktls_mode_test.c @@ -21,36 +21,6 @@ int main(int argc, char **argv) { BEGIN_TEST(); - /* Default config kTLS mode */ - { - DEFER_CLEANUP(struct s2n_config *config = s2n_config_new(), s2n_config_ptr_free); - EXPECT_NOT_NULL(config); - EXPECT_FALSE(config->ktls_send_requested); - EXPECT_FALSE(config->ktls_recv_requested); - }; - - /* Request config kTLS mode */ - { - DEFER_CLEANUP(struct s2n_config *config = s2n_config_new(), s2n_config_ptr_free); - EXPECT_NOT_NULL(config); - - EXPECT_SUCCESS(s2n_config_set_ktls_mode(config, S2N_KTLS_MODE_SEND)); - EXPECT_TRUE(config->ktls_send_requested); - EXPECT_FALSE(config->ktls_recv_requested); - - EXPECT_SUCCESS(s2n_config_set_ktls_mode(config, S2N_KTLS_MODE_RECV)); - EXPECT_FALSE(config->ktls_send_requested); - EXPECT_TRUE(config->ktls_recv_requested); - - EXPECT_SUCCESS(s2n_config_set_ktls_mode(config, S2N_KTLS_MODE_DISABLED)); - EXPECT_FALSE(config->ktls_send_requested); - EXPECT_FALSE(config->ktls_recv_requested); - - EXPECT_SUCCESS(s2n_config_set_ktls_mode(config, S2N_KTLS_MODE_DUPLEX)); - EXPECT_TRUE(config->ktls_send_requested); - EXPECT_TRUE(config->ktls_recv_requested); - }; - /* Default connection kTLS mode */ { DEFER_CLEANUP(struct s2n_connection *conn = s2n_connection_new(S2N_CLIENT), diff --git a/tls/s2n_config.c b/tls/s2n_config.c index a55dcc6d67f..71abae5903a 100644 --- a/tls/s2n_config.c +++ b/tls/s2n_config.c @@ -1072,30 +1072,3 @@ int s2n_config_set_recv_multi_record(struct s2n_config *config, bool enabled) return S2N_SUCCESS; } - -/* Indicates if the connection should attempt to enable kTLS. */ -int s2n_config_set_ktls_mode(struct s2n_config *config, s2n_ktls_mode ktls_mode) -{ - POSIX_ENSURE_REF(config); - - switch (ktls_mode) { - case S2N_KTLS_MODE_DUPLEX: - config->ktls_recv_requested = true; - config->ktls_send_requested = true; - break; - case S2N_KTLS_MODE_SEND: - config->ktls_recv_requested = false; - config->ktls_send_requested = true; - break; - case S2N_KTLS_MODE_RECV: - config->ktls_recv_requested = true; - config->ktls_send_requested = false; - break; - case S2N_KTLS_MODE_DISABLED: - config->ktls_recv_requested = false; - config->ktls_send_requested = false; - break; - } - - return S2N_SUCCESS; -} diff --git a/tls/s2n_config.h b/tls/s2n_config.h index 03d1c709d6a..86bdd77d8d1 100644 --- a/tls/s2n_config.h +++ b/tls/s2n_config.h @@ -101,12 +101,6 @@ struct s2n_config { */ unsigned recv_multi_record : 1; - /* Depending on OS and configuration it is possible to use kTLS. - * - * This option indicates if connections should attempt to use kTLS. */ - unsigned ktls_send_requested : 1; - unsigned ktls_recv_requested : 1; - struct s2n_dh_params *dhparams; /* Needed until we can deprecate s2n_config_add_cert_chain_and_key. This is * used to release memory allocated only in the deprecated API that the application