Skip to content

Commit

Permalink
address pr feedback
Browse files Browse the repository at this point in the history
- remove unused compile definition in CMakeLists.txt
- add comment for test utility
  • Loading branch information
jmayclin committed Mar 4, 2024
1 parent 65c06aa commit 95b67f3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,10 @@ if(ASAN)
endif()

if (UBSAN)
target_compile_options(${PROJECT_NAME} PUBLIC -fsanitize=undefined -fno-sanitize-recover=all -DS2N_ADDRESS_SANITIZER=1)
target_compile_options(${PROJECT_NAME} PUBLIC -fsanitize=undefined -fno-sanitize-recover=all)
target_link_options(${PROJECT_NAME} PUBLIC -fsanitize=undefined -fno-sanitize-recover=all)
endif()


if(TSAN OR ASAN OR UBSAN)
# no-omit-frame-pointer and no-optimize-sibling-calls provide better stack traces
target_compile_options(${PROJECT_NAME} PUBLIC -fno-omit-frame-pointer -fno-optimize-sibling-calls)
Expand Down
8 changes: 6 additions & 2 deletions tests/testlib/s2n_key_schedule_testlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ S2N_RESULT s2n_connection_set_test_transcript_hash(struct s2n_connection *conn,
{
RESULT_GUARD(s2n_connection_set_test_message_type(conn, message_type));
conn->handshake.handshake_type &= NEGOTIATED;
RESULT_ENSURE_EQ(s2n_conn_get_current_message_type(conn), message_type);
RESULT_CHECKED_MEMCPY(conn->handshake.hashes->transcript_hash_digest,
digest->data, digest->size);
return S2N_RESULT_OK;
Expand Down Expand Up @@ -59,9 +58,14 @@ S2N_RESULT s2n_connection_set_test_master_secret(struct s2n_connection *conn,
return S2N_RESULT_OK;
}

/* This function will iterate over all rows and columns of the handshake state
* machine until it finds a valid (handshake_type, handshake_number) such that
* the active message is `expected_message_type`. If callers need to depend on a
* specific `message_number` or `handshake_type` this function should not be
* used.
*/
S2N_RESULT s2n_connection_set_test_message_type(struct s2n_connection *conn, message_type_t expected_message_type)
{
/* scan over all handshake types until the desired message type is found */
for (uint32_t handshake = 0; handshake < S2N_HANDSHAKES_COUNT; handshake++) {
for (int message = 0; message < S2N_MAX_HANDSHAKE_LENGTH; message++) {
conn->handshake.handshake_type = handshake;
Expand Down

0 comments on commit 95b67f3

Please sign in to comment.