Skip to content

Commit

Permalink
tests: fix s2n_enable_tls13 deprecation warnings (#3120)
Browse files Browse the repository at this point in the history
  • Loading branch information
camshaft authored Nov 10, 2021
1 parent aeb7c23 commit dffd2aa
Show file tree
Hide file tree
Showing 155 changed files with 292 additions and 280 deletions.
2 changes: 1 addition & 1 deletion tests/fuzz/s2n_certificate_extensions_parse_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ static const uint8_t TLS_VERSIONS[] = {S2N_TLS13};

int s2n_fuzz_init(int *argc, char **argv[])
{
POSIX_GUARD(s2n_enable_tls13());
POSIX_GUARD(s2n_enable_tls13_in_test());
return S2N_SUCCESS;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/fuzz/s2n_client_hello_recv_fuzz_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static const uint8_t TLS_VERSIONS[] = {S2N_TLS10, S2N_TLS11, S2N_TLS12, S2N_TLS1

int s2n_fuzz_init(int *argc, char **argv[])
{
POSIX_GUARD(s2n_enable_tls13());
POSIX_GUARD(s2n_enable_tls13_in_test());
srand(time(0));
return S2N_SUCCESS;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/fuzz/s2n_encrypted_extensions_recv_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static const uint8_t TLS_VERSIONS[] = {S2N_TLS13};

int s2n_fuzz_init(int *argc, char **argv[])
{
POSIX_GUARD(s2n_enable_tls13());
POSIX_GUARD(s2n_enable_tls13_in_test());
return S2N_SUCCESS;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/fuzz/s2n_extensions_client_key_share_recv_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static const uint8_t TLS_VERSIONS[] = {S2N_TLS13};

int s2n_fuzz_init(int *argc, char **argv[])
{
POSIX_GUARD(s2n_enable_tls13());
POSIX_GUARD(s2n_enable_tls13_in_test());
return S2N_SUCCESS;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ static const uint8_t TLS_VERSIONS[] = {S2N_TLS13};

int s2n_fuzz_init(int *argc, char **argv[])
{
POSIX_GUARD(s2n_enable_tls13());
POSIX_GUARD(s2n_enable_tls13_in_test());
return S2N_SUCCESS;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/fuzz/s2n_extensions_server_key_share_recv_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ static const uint8_t TLS_VERSIONS[] = {S2N_TLS13};

int s2n_fuzz_init(int *argc, char **argv[])
{
POSIX_GUARD(s2n_enable_tls13());
POSIX_GUARD(s2n_enable_tls13_in_test());
return S2N_SUCCESS;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static const uint8_t TLS_VERSIONS[] = {S2N_TLS13};

int s2n_fuzz_init(int *argc, char **argv[])
{
POSIX_GUARD(s2n_enable_tls13());
POSIX_GUARD(s2n_enable_tls13_in_test());
return S2N_SUCCESS;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/fuzz/s2n_recv_client_supported_groups_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static const uint8_t TLS_VERSIONS[] = {S2N_TLS13};

int s2n_fuzz_init(int *argc, char **argv[])
{
POSIX_GUARD(s2n_enable_tls13());
POSIX_GUARD(s2n_enable_tls13_in_test());
return S2N_SUCCESS;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/fuzz/s2n_server_extensions_recv_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static const uint8_t TLS_VERSIONS[] = {S2N_TLS13};

int s2n_fuzz_init(int *argc, char **argv[])
{
POSIX_GUARD(s2n_enable_tls13());
POSIX_GUARD(s2n_enable_tls13_in_test());
return S2N_SUCCESS;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/s2n_3des_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ int main(int argc, char **argv)
struct s2n_blob r = {.data = random_data, .size = sizeof(random_data)};

BEGIN_TEST();
EXPECT_SUCCESS(s2n_disable_tls13());
EXPECT_SUCCESS(s2n_disable_tls13_in_test());

EXPECT_NOT_NULL(conn = s2n_connection_new(S2N_SERVER));
EXPECT_OK(s2n_get_public_random_data(&r));
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/s2n_aead_aes_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ int main(int argc, char **argv)
struct s2n_blob r = {.data = random_data, .size = sizeof(random_data)};

BEGIN_TEST();
EXPECT_SUCCESS(s2n_disable_tls13());
EXPECT_SUCCESS(s2n_disable_tls13_in_test());

EXPECT_NOT_NULL(conn = s2n_connection_new(S2N_SERVER));
EXPECT_OK(s2n_get_public_random_data(&r));
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/s2n_aead_chacha20_poly1305_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ int main(int argc, char **argv)
struct s2n_blob r = { .data = random_data, .size = sizeof(random_data)};

BEGIN_TEST();
EXPECT_SUCCESS(s2n_disable_tls13());
EXPECT_SUCCESS(s2n_disable_tls13_in_test());

/* Skip test if librcrypto doesn't support the cipher */
if(!s2n_chacha20_poly1305.is_available()) {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/s2n_aes_sha_composite_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ int main(int argc, char **argv)
uint8_t existing_explicit_ivs[S2N_DEFAULT_FRAGMENT_LENGTH + 2][S2N_TLS_MAX_IV_LEN];

BEGIN_TEST();
EXPECT_SUCCESS(s2n_disable_tls13());
EXPECT_SUCCESS(s2n_disable_tls13_in_test());

/* Skip test if we can't use the ciphers */
if (!s2n_aes128_sha.is_available() ||
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/s2n_aes_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ int main(int argc, char **argv)
struct s2n_blob r = {.data = random_data, .size = sizeof(random_data)};

BEGIN_TEST();
EXPECT_SUCCESS(s2n_disable_tls13());
EXPECT_SUCCESS(s2n_disable_tls13_in_test());

EXPECT_NOT_NULL(conn = s2n_connection_new(S2N_SERVER));
EXPECT_OK(s2n_get_public_random_data(&r));
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/s2n_array_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ int main(int argc, char **argv)
uint32_t capacity = 0;

BEGIN_TEST();
EXPECT_SUCCESS(s2n_disable_tls13());
EXPECT_SUCCESS(s2n_disable_tls13_in_test());
struct array_element elements[NUM_OF_ELEMENTS] = {0};

for (int i = 0; i < NUM_OF_ELEMENTS; i++) {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/s2n_asn1_time_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
int main(int argc, char **argv)
{
BEGIN_TEST();
EXPECT_SUCCESS(s2n_disable_tls13());
EXPECT_SUCCESS(s2n_disable_tls13_in_test());

/* October 20, 2017 3:09:11 PM GMT-07:00 */
uint64_t expected_ns = 1508539878000000000;
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/s2n_async_pkey_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ int async_pkey_invalid_complete(struct s2n_connection *conn, struct s2n_blob *si
int main(int argc, char **argv)
{
BEGIN_TEST();
EXPECT_SUCCESS(s2n_disable_tls13());
EXPECT_SUCCESS(s2n_disable_tls13_in_test());

char dhparams_pem[S2N_MAX_TEST_PEM_SIZE];
EXPECT_SUCCESS(s2n_read_test_pem(S2N_DEFAULT_TEST_DHPARAMS, dhparams_pem, S2N_MAX_TEST_PEM_SIZE));
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/s2n_auth_selection_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static int s2n_test_auth_combo(struct s2n_connection *conn,
int main(int argc, char **argv)
{
BEGIN_TEST();
EXPECT_SUCCESS(s2n_disable_tls13());
EXPECT_SUCCESS(s2n_disable_tls13_in_test());

struct s2n_cert_chain_and_key *rsa_cert_chain;
EXPECT_SUCCESS(s2n_test_cert_chain_and_key_new(&rsa_cert_chain,
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/s2n_blob_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
int main(int argc, char **argv)
{
BEGIN_TEST();
EXPECT_SUCCESS(s2n_disable_tls13());
EXPECT_SUCCESS(s2n_disable_tls13_in_test());

/* Null blob is not valid */
EXPECT_ERROR(s2n_blob_validate(NULL));
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/s2n_cbc_verify_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ inline static uint64_t rdtsc(){
int main(int argc, char **argv)
{
BEGIN_TEST();
EXPECT_SUCCESS(s2n_disable_tls13());
EXPECT_SUCCESS(s2n_disable_tls13_in_test());
/*
* disable everything in this test if the compiler target isn't Intel x86 or x86_64. There's inline asm
* that can't really be replaced with an analog for other architectures.
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/s2n_cert_chain_and_key_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ int main(int argc, char **argv)
char *private_key;

BEGIN_TEST();
EXPECT_SUCCESS(s2n_disable_tls13());
EXPECT_SUCCESS(s2n_disable_tls13_in_test());

struct s2n_test_io_pair io_pair;
EXPECT_SUCCESS(s2n_io_pair_init_non_blocking(&io_pair));
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/s2n_certificate_extensions_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ int main(int argc, char **argv)
{
BEGIN_TEST();

EXPECT_SUCCESS(s2n_enable_tls13());
EXPECT_SUCCESS(s2n_enable_tls13_in_test());

struct s2n_config *config;
EXPECT_NOT_NULL(config = s2n_config_new());
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/s2n_change_cipher_spec_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
int main(int argc, char **argv)
{
BEGIN_TEST();
EXPECT_SUCCESS(s2n_disable_tls13());
EXPECT_SUCCESS(s2n_disable_tls13_in_test());

uint8_t empty_finished_array[S2N_TLS_FINISHED_LEN] = { 0 };

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/s2n_choose_supported_group_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* supported group or, if none are available, select NULL. */
int main() {
BEGIN_TEST();
EXPECT_SUCCESS(s2n_disable_tls13());
EXPECT_SUCCESS(s2n_disable_tls13_in_test());

/* Tests with default KEM preferences (kem_preferences_null) */
{
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/s2n_cipher_suite_match_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static s2n_result s2n_conn_set_chosen_psk(struct s2n_connection *conn) {
int main(int argc, char **argv)
{
BEGIN_TEST();
EXPECT_SUCCESS(s2n_disable_tls13());
EXPECT_SUCCESS(s2n_disable_tls13_in_test());

/* Test client cipher selection */
{
Expand Down Expand Up @@ -819,7 +819,7 @@ int main(int argc, char **argv)

/* Client sends cipher which is not in the configured suite */
{
EXPECT_SUCCESS(s2n_enable_tls13());
EXPECT_SUCCESS(s2n_enable_tls13_in_test());
uint8_t invalid_cipher_pref[] = {
TLS_ECDHE_BIKE_RSA_WITH_AES_256_GCM_SHA384
};
Expand All @@ -830,7 +830,7 @@ int main(int argc, char **argv)
conn->actual_protocol_version = S2N_TLS13;
EXPECT_FAILURE_WITH_ERRNO(s2n_set_cipher_as_tls_server(conn, invalid_cipher_pref, invalid_cipher_count), S2N_ERR_CIPHER_NOT_SUPPORTED);
EXPECT_SUCCESS(s2n_connection_wipe(conn));
EXPECT_SUCCESS(s2n_disable_tls13());
EXPECT_SUCCESS(s2n_disable_tls13_in_test());
}

EXPECT_SUCCESS(s2n_config_free(server_config));
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/s2n_cleanup_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ int check_dont_cleanup_null_on_fn_exit()
int main()
{
BEGIN_TEST();
EXPECT_SUCCESS(s2n_disable_tls13());
EXPECT_SUCCESS(s2n_disable_tls13_in_test());
int expected_cleanup_count = 0;

/* check that the cleanup functions are called on each loop exit */
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/s2n_client_alpn_extension_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
int main(int argc, char **argv)
{
BEGIN_TEST();
EXPECT_SUCCESS(s2n_disable_tls13());
EXPECT_SUCCESS(s2n_disable_tls13_in_test());

const char *protocols[] = { "protocol1", "protocol2", "protocol3" };
const uint8_t protocols_count = s2n_array_len(protocols);
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/s2n_client_auth_handshake_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ int main(int argc, char **argv)
END_TEST();
}

EXPECT_SUCCESS(s2n_enable_tls13());
EXPECT_SUCCESS(s2n_enable_tls13_in_test());

/* client_auth handshake negotiation */
{
Expand Down
10 changes: 5 additions & 5 deletions tests/unit/s2n_client_cert_request_context_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
int main(int argc, char **argv)
{
BEGIN_TEST();
EXPECT_SUCCESS(s2n_disable_tls13());
EXPECT_SUCCESS(s2n_disable_tls13_in_test());

uint8_t empty_cert_len = 3;
uint8_t certificate_context_len = 1;
Expand All @@ -50,18 +50,18 @@ int main(int argc, char **argv)
EXPECT_EQUAL(s2n_stuffer_data_available(&client_conn->handshake.io), 0);

/* With TLS 1.3 enabled, there is a context length */
EXPECT_SUCCESS(s2n_enable_tls13());
EXPECT_SUCCESS(s2n_enable_tls13_in_test());
client_conn->actual_protocol_version = S2N_TLS13;
EXPECT_SUCCESS(s2n_client_cert_send(client_conn));
EXPECT_EQUAL(s2n_stuffer_data_available(&client_conn->handshake.io), empty_cert_len + certificate_context_len);
EXPECT_SUCCESS(s2n_client_cert_recv(client_conn));
EXPECT_SUCCESS(s2n_disable_tls13());
EXPECT_SUCCESS(s2n_disable_tls13_in_test());

EXPECT_SUCCESS(s2n_connection_free(client_conn));
EXPECT_SUCCESS(s2n_config_free(client_config));
}

EXPECT_SUCCESS(s2n_enable_tls13());
EXPECT_SUCCESS(s2n_enable_tls13_in_test());

/* Test certificate_request_context is zero-length as currently
* only used for handshake authentication */
Expand Down Expand Up @@ -109,7 +109,7 @@ int main(int argc, char **argv)
EXPECT_SUCCESS(s2n_config_free(server_config));
}

EXPECT_SUCCESS(s2n_disable_tls13());
EXPECT_SUCCESS(s2n_disable_tls13_in_test());

END_TEST();
}
2 changes: 1 addition & 1 deletion tests/unit/s2n_client_empty_cert_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
int main(int argc, char **argv)
{
BEGIN_TEST();
EXPECT_SUCCESS(s2n_disable_tls13());
EXPECT_SUCCESS(s2n_disable_tls13_in_test());

/* Test s2n_send_empty_cert_chain */
{
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/s2n_client_extensions_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ int main(int argc, char **argv)
char *private_key = NULL;

BEGIN_TEST();
EXPECT_SUCCESS(s2n_disable_tls13());
EXPECT_SUCCESS(s2n_disable_tls13_in_test());

EXPECT_NOT_NULL(cert_chain = malloc(S2N_MAX_TEST_PEM_SIZE));
EXPECT_NOT_NULL(private_key = malloc(S2N_MAX_TEST_PEM_SIZE));
Expand Down Expand Up @@ -905,7 +905,7 @@ int main(int argc, char **argv)
const uint8_t *server_ocsp_reply;
uint32_t length;

EXPECT_SUCCESS(s2n_enable_tls13());
EXPECT_SUCCESS(s2n_enable_tls13_in_test());

EXPECT_NOT_NULL(client_config = s2n_config_new());
EXPECT_SUCCESS(s2n_config_set_check_stapled_ocsp_response(client_config, 0));
Expand Down Expand Up @@ -957,7 +957,7 @@ int main(int argc, char **argv)
EXPECT_SUCCESS(s2n_config_free(server_config));
EXPECT_SUCCESS(s2n_config_free(client_config));

EXPECT_SUCCESS(s2n_disable_tls13());
EXPECT_SUCCESS(s2n_disable_tls13_in_test());
}

/* Client does not request SCT, but server is configured to serve them. */
Expand Down
Loading

0 comments on commit dffd2aa

Please sign in to comment.