Skip to content

Commit e9b711e

Browse files
committed
Tests for mutual authentication
1 parent 4d3925d commit e9b711e

3 files changed

Lines changed: 16 additions & 9 deletions

File tree

.github/workflows/async-examples.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,13 @@ jobs:
7676
run_pair ecc_tls12 --tls12 --ecc
7777
run_pair x25519_tls12 --tls12 --x25519
7878
79-
# BELOW ARE NOT WORKING YET
8079
# TLS 1.3 mutual auth
81-
#run_pair ecc_tls13_mutual --mutual --ecc
82-
#run_pair x25519_tls13_mutual --mutual --x25519
80+
run_pair ecc_tls13_mutual --mutual --ecc
81+
run_pair x25519_tls13_mutual --mutual --x25519
82+
83+
# TLS 1.2 mutual auth
84+
run_pair ecc_tls12_mutual --mutual --tls12 --ecc
85+
run_pair x25519_tls12_mutual --mutual --tls12 --x25519
8386
8487
8588
- name: Print async logs

examples/async/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ $(OBJDIR)/%.o: $(WOLFSSL_TOP)/%.c
5151
$(OBJDIR)/wolfcrypt/src/ecc_fp.o: CFLAGS += -Wno-pedantic
5252
$(OBJDIR)/wolfcrypt/src/fips.o: CFLAGS += -Wno-pedantic
5353
$(OBJDIR)/wolfcrypt/src/fips_test.o: CFLAGS += -Wno-pedantic
54+
$(OBJDIR)/wolfcrypt/src/fipsv2.o: CFLAGS += -Wno-pedantic
5455
$(OBJDIR)/wolfcrypt/src/selftest.o: CFLAGS += -Wno-pedantic
5556
$(OBJDIR)/wolfcrypt/src/wolfcrypt_first.o: CFLAGS += -Wno-pedantic
5657
$(OBJDIR)/wolfcrypt/src/wolfcrypt_last.o: CFLAGS += -Wno-pedantic

examples/async/async_server.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -316,11 +316,12 @@ int server_async_test(int argc, char** argv)
316316
}
317317

318318
if (mutual) {
319-
ret = wolfSSL_CTX_load_verify_buffer(ctx, ca_ed25519_cert,
320-
sizeof_ca_ed25519_cert, WOLFSSL_FILETYPE_ASN1);
319+
/* client-ed25519 is self-signed, so load it as its own CA */
320+
ret = wolfSSL_CTX_load_verify_buffer(ctx, client_ed25519_cert,
321+
sizeof_client_ed25519_cert, WOLFSSL_FILETYPE_ASN1);
321322
if (ret != WOLFSSL_SUCCESS) {
322323
fprintf(stderr,
323-
"ERROR: failed to load ED25519 CA cert.\n");
324+
"ERROR: failed to load ED25519 client CA cert.\n");
324325
goto exit;
325326
}
326327
}
@@ -345,10 +346,12 @@ int server_async_test(int argc, char** argv)
345346
}
346347

347348
if (mutual) {
348-
ret = wolfSSL_CTX_load_verify_buffer(ctx, ca_ecc_cert_der_256,
349-
sizeof_ca_ecc_cert_der_256, WOLFSSL_FILETYPE_ASN1);
349+
/* client-ecc-cert is self-signed, so load it as its own CA */
350+
ret = wolfSSL_CTX_load_verify_buffer(ctx, cliecc_cert_der_256,
351+
sizeof_cliecc_cert_der_256, WOLFSSL_FILETYPE_ASN1);
350352
if (ret != WOLFSSL_SUCCESS) {
351-
fprintf(stderr, "ERROR: failed to load ECC CA cert.\n");
353+
fprintf(stderr,
354+
"ERROR: failed to load ECC client CA cert.\n");
352355
goto exit;
353356
}
354357
}

0 commit comments

Comments
 (0)