Browse Source

Kyber with DTLS 1.3 tests

Anthony Hu 1 year ago
parent
commit
ad6d6be620
4 changed files with 71 additions and 1 deletions
  1. 1 1
      src/tls.c
  2. 44 0
      tests/suites.c
  3. 13 0
      tests/test-dtls13-pq-2.conf
  4. 13 0
      tests/test-dtls13-pq.conf

+ 1 - 1
src/tls.c

@@ -8454,7 +8454,7 @@ static int server_generate_pqc_ciphertext(WOLFSSL* ssl,
 
     if (ret == 0) {
         ret = wc_KyberKey_Init(type, kem, ssl->heap, INVALID_DEVID);
-        if (ret == 0) {
+        if (ret != 0) {
             WOLFSSL_MSG("Error creating Kyber KEM");
         }
     }

+ 44 - 0
tests/suites.c

@@ -927,6 +927,50 @@ int SuiteTest(int argc, char** argv)
     }
     #endif
     #endif
+    #ifdef HAVE_PQC
+    /* add TLSv13 pq tests */
+    XSTRLCPY(argv0[1], "tests/test-tls13-pq.conf", sizeof(argv0[1]));
+    printf("starting TLSv13 post-quantum groups tests\n");
+    test_harness(&args);
+    if (args.return_code != 0) {
+        printf("error from script %d\n", args.return_code);
+        args.return_code = EXIT_FAILURE;
+        goto exit;
+    }
+    #ifdef HAVE_LIBOQS
+    /* add TLSv13 pq tests */
+    XSTRLCPY(argv0[1], "tests/test-tls13-pq-2.conf", sizeof(argv0[1]));
+    printf("starting TLSv13 post-quantum groups tests\n");
+    test_harness(&args);
+    if (args.return_code != 0) {
+        printf("error from script %d\n", args.return_code);
+        args.return_code = EXIT_FAILURE;
+        goto exit;
+    }
+    #endif
+    #endif
+    #if defined(HAVE_PQC) && defined(WOLFSSL_DTLS13)
+    /* add DTLSv13 pq tests */
+    XSTRLCPY(argv0[1], "tests/test-dtls13-pq.conf", sizeof(argv0[1]));
+    printf("starting DTLSv13 post-quantum groups tests\n");
+    test_harness(&args);
+    if (args.return_code != 0) {
+        printf("error from script %d\n", args.return_code);
+        args.return_code = EXIT_FAILURE;
+        goto exit;
+    }
+    #ifdef HAVE_LIBOQS
+    /* add DTLSv13 pq tests */
+    XSTRLCPY(argv0[1], "tests/test-dtls13-pq-2.conf", sizeof(argv0[1]));
+    printf("starting DTLSv13 post-quantum groups tests\n");
+    test_harness(&args);
+    if (args.return_code != 0) {
+        printf("error from script %d\n", args.return_code);
+        args.return_code = EXIT_FAILURE;
+        goto exit;
+    }
+    #endif
+    #endif
 #endif
 #if defined(WC_RSA_PSS) && (!defined(HAVE_FIPS) || \
      (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION > 2))) && \

+ 13 - 0
tests/test-dtls13-pq-2.conf

@@ -0,0 +1,13 @@
+# server DTLSv1.3 with post-quantum group
+-u
+-v 4
+-l TLS13-AES256-GCM-SHA384
+--pqc P256_KYBER_LEVEL1
+
+# client DTLSv1.3 with post-quantum group
+-u
+-v 4
+-l TLS13-AES256-GCM-SHA384
+--pqc P256_KYBER_LEVEL1
+
+# P384_KYBER_LEVEL3 and P521_KYBER_LEVEL5 would fragment the ClientHello.

+ 13 - 0
tests/test-dtls13-pq.conf

@@ -0,0 +1,13 @@
+# server DTLSv1.3 with post-quantum group
+-u
+-v 4
+-l TLS13-AES256-GCM-SHA384
+--pqc KYBER_LEVEL1
+
+# client DTLSv1.3 with post-quantum group
+-u
+-v 4
+-l TLS13-AES256-GCM-SHA384
+--pqc KYBER_LEVEL1
+
+# KYBER_LEVEL3 and KYBER_LEVEL5 would fragment the ClientHello.