Skip to content

Commit bec87e5

Browse files
committed
PQC TLS 1.3: test setting pqc with wolfSSL_CTX_set_groups
1 parent 3a88107 commit bec87e5

1 file changed

Lines changed: 41 additions & 2 deletions

File tree

tests/api.c

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65242,8 +65242,7 @@ static int test_dtls13_frag_ch_pq(void)
6524265242
{
6524365243
EXPECT_DECLS;
6524465244
#if defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && defined(WOLFSSL_DTLS13) \
65245-
&& defined(WOLFSSL_DTLS_MTU) && defined(WOLFSSL_DTLS_CH_FRAG) \
65246-
&& defined(HAVE_LIBOQS)
65245+
&& defined(WOLFSSL_DTLS_CH_FRAG) && defined(HAVE_LIBOQS)
6524765246
WOLFSSL_CTX *ctx_c = NULL;
6524865247
WOLFSSL_CTX *ctx_s = NULL;
6524965248
WOLFSSL *ssl_c = NULL;
@@ -65507,6 +65506,45 @@ static int test_dtls_empty_keyshare_with_cookie(void)
6550765506
return EXPECT_RESULT();
6550865507
}
6550965508

65509+
#if defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && defined(WOLFSSL_TLS13) && \
65510+
defined(HAVE_LIBOQS)
65511+
static void test_tls13_pq_groups_ctx_ready(WOLFSSL_CTX* ctx)
65512+
{
65513+
int group = WOLFSSL_KYBER_LEVEL5;
65514+
AssertIntEQ(wolfSSL_CTX_set_groups(ctx, &group, 1), WOLFSSL_SUCCESS);
65515+
}
65516+
65517+
static void test_tls13_pq_groups_on_result(WOLFSSL* ssl)
65518+
{
65519+
AssertStrEQ(wolfSSL_get_curve_name(ssl), "KYBER_LEVEL5");
65520+
}
65521+
#endif
65522+
65523+
static int test_tls13_pq_groups(void)
65524+
{
65525+
EXPECT_DECLS;
65526+
#if defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && defined(WOLFSSL_TLS13) && \
65527+
defined(HAVE_LIBOQS)
65528+
callback_functions func_cb_client;
65529+
callback_functions func_cb_server;
65530+
65531+
XMEMSET(&func_cb_client, 0, sizeof(callback_functions));
65532+
XMEMSET(&func_cb_server, 0, sizeof(callback_functions));
65533+
65534+
func_cb_client.method = wolfTLSv1_3_client_method;
65535+
func_cb_server.method = wolfTLSv1_3_server_method;
65536+
func_cb_client.ctx_ready = test_tls13_pq_groups_ctx_ready;
65537+
func_cb_client.on_result = test_tls13_pq_groups_on_result;
65538+
func_cb_server.on_result = test_tls13_pq_groups_on_result;
65539+
65540+
test_wolfSSL_client_server_nofail(&func_cb_client, &func_cb_server);
65541+
65542+
ExpectIntEQ(func_cb_client.return_code, TEST_SUCCESS);
65543+
ExpectIntEQ(func_cb_server.return_code, TEST_SUCCESS);
65544+
#endif
65545+
return EXPECT_RESULT();
65546+
}
65547+
6551065548
/*----------------------------------------------------------------------------*
6551165549
| Main
6551265550
*----------------------------------------------------------------------------*/
@@ -66779,6 +66817,7 @@ TEST_CASE testCases[] = {
6677966817
TEST_DECL(test_dtls_frag_ch),
6678066818
TEST_DECL(test_dtls13_frag_ch_pq),
6678166819
TEST_DECL(test_dtls_empty_keyshare_with_cookie),
66820+
TEST_DECL(test_tls13_pq_groups),
6678266821
/* This test needs to stay at the end to clean up any caches allocated. */
6678366822
TEST_DECL(test_wolfSSL_Cleanup)
6678466823
};

0 commit comments

Comments
 (0)