Skip to content

Commit

Permalink
ktls: rm kTLS request field on config (#3816)
Browse files Browse the repository at this point in the history
  • Loading branch information
toidiu authored Feb 8, 2023
1 parent ecedd2b commit c050b08
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 63 deletions.
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

0 comments on commit c050b08

Please sign in to comment.