Skip to content

Commit ad6d6be

Browse files
committed
Kyber with DTLS 1.3 tests
1 parent b2d25ec commit ad6d6be

4 files changed

Lines changed: 71 additions & 1 deletion

File tree

src/tls.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8454,7 +8454,7 @@ static int server_generate_pqc_ciphertext(WOLFSSL* ssl,
84548454

84558455
if (ret == 0) {
84568456
ret = wc_KyberKey_Init(type, kem, ssl->heap, INVALID_DEVID);
8457-
if (ret == 0) {
8457+
if (ret != 0) {
84588458
WOLFSSL_MSG("Error creating Kyber KEM");
84598459
}
84608460
}

tests/suites.c

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,50 @@ int SuiteTest(int argc, char** argv)
927927
}
928928
#endif
929929
#endif
930+
#ifdef HAVE_PQC
931+
/* add TLSv13 pq tests */
932+
XSTRLCPY(argv0[1], "tests/test-tls13-pq.conf", sizeof(argv0[1]));
933+
printf("starting TLSv13 post-quantum groups tests\n");
934+
test_harness(&args);
935+
if (args.return_code != 0) {
936+
printf("error from script %d\n", args.return_code);
937+
args.return_code = EXIT_FAILURE;
938+
goto exit;
939+
}
940+
#ifdef HAVE_LIBOQS
941+
/* add TLSv13 pq tests */
942+
XSTRLCPY(argv0[1], "tests/test-tls13-pq-2.conf", sizeof(argv0[1]));
943+
printf("starting TLSv13 post-quantum groups tests\n");
944+
test_harness(&args);
945+
if (args.return_code != 0) {
946+
printf("error from script %d\n", args.return_code);
947+
args.return_code = EXIT_FAILURE;
948+
goto exit;
949+
}
950+
#endif
951+
#endif
952+
#if defined(HAVE_PQC) && defined(WOLFSSL_DTLS13)
953+
/* add DTLSv13 pq tests */
954+
XSTRLCPY(argv0[1], "tests/test-dtls13-pq.conf", sizeof(argv0[1]));
955+
printf("starting DTLSv13 post-quantum groups tests\n");
956+
test_harness(&args);
957+
if (args.return_code != 0) {
958+
printf("error from script %d\n", args.return_code);
959+
args.return_code = EXIT_FAILURE;
960+
goto exit;
961+
}
962+
#ifdef HAVE_LIBOQS
963+
/* add DTLSv13 pq tests */
964+
XSTRLCPY(argv0[1], "tests/test-dtls13-pq-2.conf", sizeof(argv0[1]));
965+
printf("starting DTLSv13 post-quantum groups tests\n");
966+
test_harness(&args);
967+
if (args.return_code != 0) {
968+
printf("error from script %d\n", args.return_code);
969+
args.return_code = EXIT_FAILURE;
970+
goto exit;
971+
}
972+
#endif
973+
#endif
930974
#endif
931975
#if defined(WC_RSA_PSS) && (!defined(HAVE_FIPS) || \
932976
(defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION > 2))) && \

tests/test-dtls13-pq-2.conf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# server DTLSv1.3 with post-quantum group
2+
-u
3+
-v 4
4+
-l TLS13-AES256-GCM-SHA384
5+
--pqc P256_KYBER_LEVEL1
6+
7+
# client DTLSv1.3 with post-quantum group
8+
-u
9+
-v 4
10+
-l TLS13-AES256-GCM-SHA384
11+
--pqc P256_KYBER_LEVEL1
12+
13+
# P384_KYBER_LEVEL3 and P521_KYBER_LEVEL5 would fragment the ClientHello.

tests/test-dtls13-pq.conf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# server DTLSv1.3 with post-quantum group
2+
-u
3+
-v 4
4+
-l TLS13-AES256-GCM-SHA384
5+
--pqc KYBER_LEVEL1
6+
7+
# client DTLSv1.3 with post-quantum group
8+
-u
9+
-v 4
10+
-l TLS13-AES256-GCM-SHA384
11+
--pqc KYBER_LEVEL1
12+
13+
# KYBER_LEVEL3 and KYBER_LEVEL5 would fragment the ClientHello.

0 commit comments

Comments
 (0)