Skip to content

Commit

Permalink
test for unparsed client hello
Browse files Browse the repository at this point in the history
  • Loading branch information
goatgoose committed Sep 20, 2023
1 parent 9a74e1c commit 15bbefa
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions tests/unit/s2n_client_hello_get_supported_groups_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,13 @@ int main(int argc, char **argv)

/* Ensure that s2n_client_hello_get_supported_groups fails before the client hello is parsed. */
{

struct s2n_client_hello client_hello = { 0 };

uint16_t supported_groups[TEST_SUPPORTED_GROUPS_LIST_COUNT] = { 0 };
uint16_t supported_groups_count = 0;
EXPECT_FAILURE_WITH_ERRNO(s2n_client_hello_get_supported_groups(&client_hello, supported_groups, &supported_groups_count,
s2n_array_len(supported_groups)),
S2N_ERR_NULL);
}

/* Ensure that s2n_client_hello_get_supported_groups fails if a supported groups extension
Expand Down Expand Up @@ -233,8 +239,8 @@ int main(int argc, char **argv)
}

/* Ensure that s2n_client_hello_get_supported_groups writes what is contained in the parsed
* supported groups extension in the client hello.
*/
* supported groups extension in the client hello.
*/
{
struct s2n_client_hello client_hello = { 0 };

Expand Down Expand Up @@ -274,7 +280,6 @@ int main(int argc, char **argv)
for (size_t i = 0; i < supported_groups_count; i++) {
uint16_t test_group = 0;
EXPECT_SUCCESS(s2n_stuffer_read_uint16(&test_groups_list_stuffer, &test_group));

uint16_t written_group = supported_groups[i];

EXPECT_EQUAL(test_group, written_group);
Expand All @@ -283,10 +288,10 @@ int main(int argc, char **argv)
}

/* Self-talk: Ensure that the retrieved supported groups match what was sent by the client.
*
* This test also ensures that s2n_client_hello_get_supported_groups is usable from within
* the client hello callback.
*/
*
* This test also ensures that s2n_client_hello_get_supported_groups is usable from within
* the client hello callback.
*/
{

}
Expand Down

0 comments on commit 15bbefa

Please sign in to comment.