Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ktls: rm kTLS request field on config #3816

Merged
merged 1 commit into from
Feb 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions tests/unit/s2n_ktls_mode_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
27 changes: 0 additions & 27 deletions tls/s2n_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
6 changes: 0 additions & 6 deletions tls/s2n_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down