Skip to content
Open
Show file tree
Hide file tree
Changes from 5 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
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,9 @@ if (BUILD_TESTING)
-Wshadow -Wcast-align -Wwrite-strings -Wformat-security
-Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-deprecated -std=gnu99
)
if (UNSAFE_TREAT_WARNINGS_AS_ERRORS)
target_compile_options(${test_case_name} PRIVATE -Werror)
endif()
if (S2N_LTO)
target_compile_options(${test_case_name} PRIVATE -flto)
endif()
Expand Down
11 changes: 10 additions & 1 deletion tests/unit/s2n_safety_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ static int success_memcpy()

static int failure_memcpy()
{
char src[1024];
char src[1024] = { 0 };
char *ptr = NULL;

POSIX_CHECKED_MEMCPY(ptr, src, 1024);
Expand Down Expand Up @@ -205,6 +205,15 @@ static int success_ct_pkcs1()
return memcmp(outbuf, expected, sizeof(expected)) ? -1 : 0;
}

#if S2N_CLONE_SUPPORTED
static int s2n_unit_test_clone_child_process(struct s2n_unit_test_clone *data)
{
char src[1024] = { 0 };
POSIX_ENSURE_REF(memcpy(src, NULL, sizeof(src)) == NULL);
return S2N_SUCCESS;
}
#endif

static int success_ct_pkcs1_negative()
{
uint8_t pkcs1_data_too_long[] = { 0x00, 0x02, 0x80, 0x0f, 0x00, 0x10, 0xab, 0xcd, 0xef, 0x00 };
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/s2n_tls12_handshake_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ int main(int argc, char **argv)
{
struct s2n_connection *conn = s2n_connection_new(S2N_CLIENT);
conn->actual_protocol_version = S2N_TLS12;
EXPECT_EQUAL(ACTIVE_STATE_MACHINE(conn), state_machine);
EXPECT_EQUAL(ACTIVE_HANDSHAKES(conn), handshakes);
EXPECT_EQUAL(&ACTIVE_STATE_MACHINE(conn)[0], &state_machine[0]);
EXPECT_EQUAL(&ACTIVE_HANDSHAKES(conn)[0], &handshakes[0]);
EXPECT_SUCCESS(s2n_connection_free(conn));
};

Expand Down
4 changes: 2 additions & 2 deletions tests/unit/s2n_tls13_handshake_state_machine_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,8 @@ int main(int argc, char **argv)
struct s2n_connection *conn = s2n_connection_new(S2N_CLIENT);
conn->actual_protocol_version = S2N_TLS13;
EXPECT_OK(s2n_conn_choose_state_machine(conn, S2N_TLS13));
EXPECT_EQUAL(ACTIVE_STATE_MACHINE(conn), tls13_state_machine);
EXPECT_EQUAL(ACTIVE_HANDSHAKES(conn), tls13_handshakes);
EXPECT_EQUAL(&ACTIVE_STATE_MACHINE(conn)[0], &tls13_state_machine[0]);
EXPECT_EQUAL(&ACTIVE_HANDSHAKES(conn)[0], &tls13_handshakes[0]);
EXPECT_SUCCESS(s2n_connection_free(conn));
};

Expand Down
Loading