From d05068c2cc3beea51f115aafa3ad583c21f83882 Mon Sep 17 00:00:00 2001 From: Emma Stensland Date: Wed, 2 Dec 2026 12:15:43 -0700 Subject: [PATCH 01/11] F-18852: stop the ENC28J60 TLS server for good on "shutdown" app_main kept rebuilding the server every 5 s without accepting. The server READMEs say the embedded certs and keys are public. --- ESP32/TLS13-ENC28J60-server/README.md | 7 +++++++ .../main/enc28j60_example_main.c | 14 +++++++++++--- ESP32/TLS13-wifi_station-server/README.md | 7 +++++++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/ESP32/TLS13-ENC28J60-server/README.md b/ESP32/TLS13-ENC28J60-server/README.md index 95026ac8c..4295c40b1 100644 --- a/ESP32/TLS13-ENC28J60-server/README.md +++ b/ESP32/TLS13-ENC28J60-server/README.md @@ -7,6 +7,13 @@ To open this solution in Visual Studio with the VisualGDB extension, see the [So With wolfSSL debugging turned on, sample serial output of the ESP32 can been found in the [example output](./README-output.txt) +## Credentials + +The certificates and keys in `main/embedded_*.h` are the public wolfSSL test +credentials from `certs/`: anyone can use them to connect, or to impersonate +this server. Replace them with your own before using this code outside a demo. +A connected client can also stop the server by sending `shutdown`. + # ENC28J60 Example (See the README.md file in the upper level 'examples' directory for more information about examples.) diff --git a/ESP32/TLS13-ENC28J60-server/main/enc28j60_example_main.c b/ESP32/TLS13-ENC28J60-server/main/enc28j60_example_main.c index 1677de068..6632509c6 100644 --- a/ESP32/TLS13-ENC28J60-server/main/enc28j60_example_main.c +++ b/ESP32/TLS13-ENC28J60-server/main/enc28j60_example_main.c @@ -138,6 +138,9 @@ TickType_t DelayTicks = 5000 / portTICK_PERIOD_MS; +/* Set by the "shutdown" command; app_main() then stops the server. */ +static int mShutdown = 0; + #ifdef HAVE_SIGNAL static void sig_handler(const int sig) { // fprintf(stderr, "SIGINT handled = %d.\n", sig); @@ -175,7 +178,6 @@ int tls_smp_server_task() { int on; static int mConnd = SOCKET_INVALID; - static int mShutdown = 0; /* declare wolfSSL objects */ WOLFSSL_CTX *ctx = NULL; /* the wolfSSL context object*/ @@ -1053,9 +1055,15 @@ void app_main(void) { // one of the most important aspects of security is the time and date values set_time(); - for (;;) { + /* Restart the server after an error, but not after "shutdown". */ + while (!mShutdown) { ESP_LOGI(TAG, "main loop"); - vTaskDelay(DelayTicks ? DelayTicks : 1); /* Minimum delay = 1 tick */ + vTaskDelay(DelayTicks ? DelayTicks : 1); /* Minimum delay = 1 tick */ tls_smp_server_task(); } + + /* done. wait forever */ + for (;;) { + vTaskDelay(DelayTicks ? DelayTicks : 1); /* Minimum delay = 1 tick */ + } } diff --git a/ESP32/TLS13-wifi_station-server/README.md b/ESP32/TLS13-wifi_station-server/README.md index fe41a93f7..972436bfe 100644 --- a/ESP32/TLS13-wifi_station-server/README.md +++ b/ESP32/TLS13-wifi_station-server/README.md @@ -7,6 +7,13 @@ To open this solution in Visual Studio with the VisualGDB extension, see the [So With wolfSSL debugging turned on, sample serial output of the ESP32 can been found in the [example output]() +## Credentials + +The certificates and keys in `main/embedded_*.h` are the public wolfSSL test +credentials from `certs/`: anyone can use them to connect, or to impersonate +this server. Replace them with your own before using this code outside a demo. +A connected client can also stop the server by sending `shutdown`. + # Wi-Fi Station Example From 0ad962b88312f6a263be05cf890619f9a3e3f5dc Mon Sep 17 00:00:00 2001 From: Emma Stensland Date: Wed, 2 Dec 2026 12:15:43 -0700 Subject: [PATCH 02/11] F-17930: keep the ESP32 DTLS server up after a per-peer error A failed handshake, read or write, or an empty datagram, tore down the listener and the task; now only that peer is dropped. --- .../main/server-dtls13.c | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/ESP32/DTLS13-wifi-station-server/main/server-dtls13.c b/ESP32/DTLS13-wifi-station-server/main/server-dtls13.c index 85d750e31..1690b5da6 100644 --- a/ESP32/DTLS13-wifi-station-server/main/server-dtls13.c +++ b/ESP32/DTLS13-wifi-station-server/main/server-dtls13.c @@ -119,6 +119,7 @@ WOLFSSL_ESP_TASK dtls13_smp_server_task(void *pvParameters) int recvLen = 0; /* length of message */ int ip_protocol = 0; int ret; + int timedOut = 0; /* the last recvfrom() hit a timeout */ ESP_LOGI(TAG, "Init Stack: %d words", TLS_SMP_SERVER_TASK_WORDS); ShowStackInfo("Begin Stack"); @@ -308,7 +309,11 @@ WOLFSSL_ESP_TASK dtls13_smp_server_task(void *pvParameters) - (uxTaskGetStackHighWaterMark(NULL))); ShowStackInfo("While Stack"); while (1) { - ESP_LOGI(TAG, "\n\nAwaiting client connection on port %d\n", SERV_PORT); + if (!timedOut) { + ESP_LOGI(TAG, "\n\nAwaiting client connection on port %d\n", + SERV_PORT); + } + timedOut = 0; cliLen = sizeof(cliaddr); ret = (int)recvfrom(listenfd, @@ -318,12 +323,22 @@ WOLFSSL_ESP_TASK dtls13_smp_server_task(void *pvParameters) ); if (ret < 0) { + if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) { + /* A receive timeout, such as the one wolfSSL leaves on + * listenfd after a failed handshake: keep waiting. */ + timedOut = 1; + continue; + } ESP_LOGE(TAG, "ERROR during recvfrom()"); goto cleanup; } else if (ret == 0) { - ESP_LOGE(TAG, "recvfrom zero return\n"); - goto cleanup; + /* An empty datagram: drop it, as MSG_PEEK left it queued. */ + ESP_LOGW(TAG, "recvfrom zero return, dropping empty datagram\n"); + cliLen = sizeof(cliaddr); + (void)recvfrom(listenfd, (char *)&buff, sizeof(buff), 0, + (struct sockaddr*)&cliaddr, &cliLen); + continue; } /* Create the WOLFSSL Object */ @@ -360,7 +375,7 @@ WOLFSSL_ESP_TASK dtls13_smp_server_task(void *pvParameters) err = wolfSSL_get_error(ssl, 0); ESP_LOGE(TAG, "error = %d, %s\n", err, wolfSSL_ERR_reason_error_string(err)); ESP_LOGE(TAG, "SSL_accept failed.\n"); - goto cleanup; + goto next_peer; } showConnInfo(ssl); while (1) { @@ -378,7 +393,7 @@ WOLFSSL_ESP_TASK dtls13_smp_server_task(void *pvParameters) ESP_LOGE(TAG, "error = %d, %s\n", err, wolfSSL_ERR_reason_error_string(err)); ESP_LOGE(TAG, "SSL_read failed.\n"); - goto cleanup; + goto next_peer; } ESP_LOGI(TAG, "Sending reply (check client for this text): %s", ack); @@ -387,7 +402,7 @@ WOLFSSL_ESP_TASK dtls13_smp_server_task(void *pvParameters) ESP_LOGE(TAG, "error = %d, %s\n", err, wolfSSL_ERR_reason_error_string(err)); ESP_LOGE(TAG, "wolfSSL_write failed.\n"); - goto cleanup; + goto next_peer; } ESP_LOGI(TAG, "Sending complete. Waiting for next message..."); } @@ -407,6 +422,9 @@ WOLFSSL_ESP_TASK dtls13_smp_server_task(void *pvParameters) err, wolfSSL_ERR_reason_error_string(err)); ESP_LOGE(TAG, "wolfSSL_shutdown failed\n"); } + +next_peer: + /* A failure with one peer must not stop the server for the others. */ wolfSSL_free(ssl); ssl = NULL; From e5c30df92a24c0c0df676e4491ff87963a553ab0 Mon Sep 17 00:00:00 2001 From: Emma Stensland Date: Wed, 2 Dec 2026 12:15:44 -0700 Subject: [PATCH 03/11] F-11807: terminate the ESP32 DTLS server read buffer before logging --- ESP32/DTLS13-wifi-station-server/main/server-dtls13.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ESP32/DTLS13-wifi-station-server/main/server-dtls13.c b/ESP32/DTLS13-wifi-station-server/main/server-dtls13.c index 1690b5da6..e1ed5a318 100644 --- a/ESP32/DTLS13-wifi-station-server/main/server-dtls13.c +++ b/ESP32/DTLS13-wifi-station-server/main/server-dtls13.c @@ -380,10 +380,9 @@ WOLFSSL_ESP_TASK dtls13_smp_server_task(void *pvParameters) showConnInfo(ssl); while (1) { if ((recvLen = wolfSSL_read(ssl, buff, sizeof(buff)-1)) > 0) { + buff[recvLen] = '\0'; ESP_LOGI(TAG, "wolfSSL_read heard %d bytes:\n\n" "%s", recvLen, buff); - - buff[recvLen] = '\0'; } else if (recvLen <= 0) { err = wolfSSL_get_error(ssl, 0); From 5b5f9e766f23145b9b8b87f46cabe0d542296f35 Mon Sep 17 00:00:00 2001 From: Emma Stensland Date: Wed, 2 Dec 2026 12:15:44 -0700 Subject: [PATCH 04/11] F-11760: stop the ESP32 TLS clients when the DNS lookup fails They went on to dereference a NULL address. --- ESP32/TLS13-ENC28J60-client/main/enc28j60_example_main.c | 6 +++++- ESP32/TLS13-wifi_station-client/main/station_example_main.c | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ESP32/TLS13-ENC28J60-client/main/enc28j60_example_main.c b/ESP32/TLS13-ENC28J60-client/main/enc28j60_example_main.c index eee049479..800717b5d 100644 --- a/ESP32/TLS13-ENC28J60-client/main/enc28j60_example_main.c +++ b/ESP32/TLS13-ENC28J60-client/main/enc28j60_example_main.c @@ -134,7 +134,7 @@ static void LogSocketError(const char* fmt, int err) int tls_smp_client_task() { int ret = WOLFSSL_SUCCESS; /* assume success until proven wrong */ - int sockfd = 0; /* the socket that will carry our secure connection */ + int sockfd = SOCKET_INVALID; /* the socket that will carry our secure connection */ struct sockaddr_in servAddr; const int BUFF_SIZE = 256; char buff[BUFF_SIZE]; @@ -205,6 +205,10 @@ int tls_smp_client_task() { WOLFSSL_ERROR_MSG("ERROR: invalid address\n"); } } + else if (ip4_addr == NULL) { + /* gethostbyname() failed above */ + ret = WOLFSSL_FAILURE; + } else { servAddr.sin_addr.s_addr = ip4_addr->addr; } diff --git a/ESP32/TLS13-wifi_station-client/main/station_example_main.c b/ESP32/TLS13-wifi_station-client/main/station_example_main.c index b2b7a29b2..3a8891f6d 100644 --- a/ESP32/TLS13-wifi_station-client/main/station_example_main.c +++ b/ESP32/TLS13-wifi_station-client/main/station_example_main.c @@ -277,7 +277,7 @@ void wifi_init_sta(void) int tls_smp_client_task() { int ret = WOLFSSL_SUCCESS; /* assume success until proven wrong */ - int sockfd = 0; /* the socket that will carry our secure connection */ + int sockfd = SOCKET_INVALID; /* the socket that will carry our secure connection */ struct sockaddr_in servAddr; const int BUFF_SIZE = 256; char buff[BUFF_SIZE]; @@ -336,6 +336,10 @@ int tls_smp_client_task() { ESP_LOGE(TAG, "ERROR: invalid address\n"); } } + else if (ip4_addr == NULL) { + /* gethostbyname() failed above */ + ret = WOLFSSL_FAILURE; + } else { servAddr.sin_addr.s_addr = ip4_addr->addr; } From d7d463b5ba4eb45417f677aac0cab51ac25b512b Mon Sep 17 00:00:00 2001 From: Emma Stensland Date: Wed, 2 Dec 2026 12:15:44 -0700 Subject: [PATCH 05/11] F-11761: zero the fallback clock struct tm in the ESP32 TLS examples mktime read an uninitialized tm_isdst. --- ESP32/TLS13-ENC28J60-client/main/enc28j60_example_main.c | 2 +- ESP32/TLS13-ENC28J60-server/main/enc28j60_example_main.c | 2 +- ESP32/TLS13-wifi_station-client/main/station_example_main.c | 2 +- ESP32/TLS13-wifi_station-server/main/station_example_main.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ESP32/TLS13-ENC28J60-client/main/enc28j60_example_main.c b/ESP32/TLS13-ENC28J60-client/main/enc28j60_example_main.c index 800717b5d..885cfe525 100644 --- a/ESP32/TLS13-ENC28J60-client/main/enc28j60_example_main.c +++ b/ESP32/TLS13-ENC28J60-client/main/enc28j60_example_main.c @@ -929,7 +929,7 @@ int set_time() { int res = 0; //*ideally, we'd like to set time from network, but let's set a default time, just in case */ - struct tm timeinfo; + struct tm timeinfo = { 0 }; /* tm_isdst and the rest zeroed for mktime */ timeinfo.tm_year = 2022 - 1900; timeinfo.tm_mon = 3; timeinfo.tm_mday = 15; diff --git a/ESP32/TLS13-ENC28J60-server/main/enc28j60_example_main.c b/ESP32/TLS13-ENC28J60-server/main/enc28j60_example_main.c index 6632509c6..5fad88efb 100644 --- a/ESP32/TLS13-ENC28J60-server/main/enc28j60_example_main.c +++ b/ESP32/TLS13-ENC28J60-server/main/enc28j60_example_main.c @@ -946,7 +946,7 @@ int set_time() { int res = 0; //*ideally, we'd like to set time from network, but let's set a default time, just in case */ - struct tm timeinfo; + struct tm timeinfo = { 0 }; /* tm_isdst and the rest zeroed for mktime */ timeinfo.tm_year = 2022 - 1900; timeinfo.tm_mon = 3; timeinfo.tm_mday = 15; diff --git a/ESP32/TLS13-wifi_station-client/main/station_example_main.c b/ESP32/TLS13-wifi_station-client/main/station_example_main.c index 3a8891f6d..9b1ab2c15 100644 --- a/ESP32/TLS13-wifi_station-client/main/station_example_main.c +++ b/ESP32/TLS13-wifi_station-client/main/station_example_main.c @@ -167,7 +167,7 @@ int set_time() { /* ideally, we'd like to set time from network, ** but let's set a default time, just in case */ - struct tm timeinfo; + struct tm timeinfo = { 0 }; /* tm_isdst and the rest zeroed for mktime */ timeinfo.tm_year = 2022 - 1900; timeinfo.tm_mon = 3; timeinfo.tm_mday = 15; diff --git a/ESP32/TLS13-wifi_station-server/main/station_example_main.c b/ESP32/TLS13-wifi_station-server/main/station_example_main.c index 0226aff20..4b8b06e36 100644 --- a/ESP32/TLS13-wifi_station-server/main/station_example_main.c +++ b/ESP32/TLS13-wifi_station-server/main/station_example_main.c @@ -171,7 +171,7 @@ int set_time() { /*ideally, we'd like to set time from network, but let's set a default time, just in case */ - struct tm timeinfo; + struct tm timeinfo = { 0 }; /* tm_isdst and the rest zeroed for mktime */ timeinfo.tm_year = 2022 - 1900; timeinfo.tm_mon = 3; timeinfo.tm_mday = 15; From b01d8a777157b2e97c0de408e34158271f901828 Mon Sep 17 00:00:00 2001 From: Emma Stensland Date: Wed, 2 Dec 2026 12:15:44 -0700 Subject: [PATCH 06/11] F-18850: check the server name in the ESP32 TLS 1.3 clients Any cert chaining to the CA was accepted as the server. --- .../main/enc28j60_example_main.c | 11 +++++++++++ .../main/station_example_main.c | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/ESP32/TLS13-ENC28J60-client/main/enc28j60_example_main.c b/ESP32/TLS13-ENC28J60-client/main/enc28j60_example_main.c index 885cfe525..e6e0aeb2a 100644 --- a/ESP32/TLS13-ENC28J60-client/main/enc28j60_example_main.c +++ b/ESP32/TLS13-ENC28J60-client/main/enc28j60_example_main.c @@ -71,6 +71,8 @@ #define TLS_SMP_CLIENT_TASK_PRIORITY 8 #define TLS_SMP_TARGET_HOST "192.168.75.55" +/* The name the server certificate must carry (the test cert has example.com) */ +#define TLS_SMP_SERVER_NAME "example.com" /* include certificates. Note that there is an experiation date! @@ -598,6 +600,15 @@ int tls_smp_client_task() { WOLFSSL_ERROR_MSG("skipping wolfSSL_set_fd\n"); } + /* Accept only a server certificate issued to TLS_SMP_SERVER_NAME, + * not any certificate that chains to CA_FILE. */ + if (ret == WOLFSSL_SUCCESS) { + ret = wolfSSL_check_domain_name(ssl, TLS_SMP_SERVER_NAME); + if (ret != WOLFSSL_SUCCESS) { + WOLFSSL_ERROR_MSG("ERROR: wolfSSL_check_domain_name failed\n"); + } + } + /* *************************************************************************** diff --git a/ESP32/TLS13-wifi_station-client/main/station_example_main.c b/ESP32/TLS13-wifi_station-client/main/station_example_main.c index 9b1ab2c15..897a6c56b 100644 --- a/ESP32/TLS13-wifi_station-client/main/station_example_main.c +++ b/ESP32/TLS13-wifi_station-client/main/station_example_main.c @@ -76,6 +76,8 @@ #define TLS_SMP_CLIENT_TASK_PRIORITY 8 #define TLS_SMP_TARGET_HOST "192.168.25.114" +/* The name the server certificate must carry (the test cert has example.com) */ +#define TLS_SMP_SERVER_NAME "example.com" /* include certificates. Note that there is an experiation date! @@ -734,6 +736,15 @@ int tls_smp_client_task() { ESP_LOGE(TAG, "skipping wolfSSL_set_fd\n"); } + /* Accept only a server certificate issued to TLS_SMP_SERVER_NAME, + * not any certificate that chains to CA_FILE. */ + if (ret == WOLFSSL_SUCCESS) { + ret = wolfSSL_check_domain_name(ssl, TLS_SMP_SERVER_NAME); + if (ret != WOLFSSL_SUCCESS) { + ESP_LOGE(TAG, "ERROR: wolfSSL_check_domain_name failed\n"); + } + } + /* *************************************************************************** From 199af7c8b5dab5ea5ac4e89262db98283ce21869 Mon Sep 17 00:00:00 2001 From: Emma Stensland Date: Wed, 2 Dec 2026 12:15:44 -0700 Subject: [PATCH 07/11] F-18851: note the public test credentials in the ESP32 TLS clients --- ESP32/TLS13-ENC28J60-client/README.md | 7 +++++++ ESP32/TLS13-wifi_station-client/README.md | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/ESP32/TLS13-ENC28J60-client/README.md b/ESP32/TLS13-ENC28J60-client/README.md index 1770231af..7a92124be 100644 --- a/ESP32/TLS13-ENC28J60-client/README.md +++ b/ESP32/TLS13-ENC28J60-client/README.md @@ -7,6 +7,13 @@ To open this solution in Visual Studio with the VisualGDB extension, see the [So With wolfSSL debugging turned on, sample serial output of the ESP32 can been found in the [example output](./README-output.txt) +## Credentials + +The certificates and keys in `main/embedded_*.h` are the public wolfSSL test +credentials from `certs/`: anyone can sign a server certificate this client +accepts, or use the client key. Replace them with your own before using this +code outside a demo, and set `TLS_SMP_SERVER_NAME` to your server's name. + # ENC28J60 Example (See the Espressif [README.md](https://github.com/espressif/esp-idf/tree/master/examples#readme) file in the upper level '[examples](https://github.com/espressif/esp-idf/tree/master/examples)' diff --git a/ESP32/TLS13-wifi_station-client/README.md b/ESP32/TLS13-wifi_station-client/README.md index c1c696f01..c96455bb8 100644 --- a/ESP32/TLS13-wifi_station-client/README.md +++ b/ESP32/TLS13-wifi_station-client/README.md @@ -7,6 +7,13 @@ To open this solution in Visual Studio with the VisualGDB extension, see the [So With wolfSSL debugging turned on, sample serial output of the ESP32 can been found in the [example output]() +## Credentials + +The certificates and keys in `main/embedded_*.h` are the public wolfSSL test +credentials from `certs/`: anyone can sign a server certificate this client +accepts, or use the client key. Replace them with your own before using this +code outside a demo, and set `TLS_SMP_SERVER_NAME` to your server's name. + From b4c70a2b41abf51a99725b087eb1f0b18184ff50 Mon Sep 17 00:00:00 2001 From: Emma Stensland Date: Wed, 2 Dec 2026 12:15:44 -0700 Subject: [PATCH 08/11] F-17933: check the server name in the ESP32 DTLS 1.3 client The SM2 test cert has no SAN, so SM builds check its CN instead. --- ESP32/DTLS13-wifi-station-client/main/client-dtls13.c | 8 ++++++++ .../main/include/client-dtls13.h | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/ESP32/DTLS13-wifi-station-client/main/client-dtls13.c b/ESP32/DTLS13-wifi-station-client/main/client-dtls13.c index 49ee35c51..0ded1617b 100644 --- a/ESP32/DTLS13-wifi-station-client/main/client-dtls13.c +++ b/ESP32/DTLS13-wifi-station-client/main/client-dtls13.c @@ -181,6 +181,14 @@ WOLFSSL_ESP_TASK dtls13_smp_client_task(void *pvParameters) goto cleanup; } + /* Accept only a server certificate issued to TLS_SMP_SERVER_NAME, + * not any certificate that chains to the CA. */ + if (wolfSSL_check_domain_name(ssl, TLS_SMP_SERVER_NAME) + != WOLFSSL_SUCCESS) { + ESP_LOGE(TAG, "wolfSSL_check_domain_name failed\n"); + goto cleanup; + } + /* Perform SSL connection */ ESP_LOGI(TAG, "Connecting to DTLS 1.3 server..."); if (wolfSSL_connect(ssl) != SSL_SUCCESS) { diff --git a/ESP32/DTLS13-wifi-station-client/main/include/client-dtls13.h b/ESP32/DTLS13-wifi-station-client/main/include/client-dtls13.h index 9621f5e8e..492835ce3 100644 --- a/ESP32/DTLS13-wifi-station-client/main/include/client-dtls13.h +++ b/ESP32/DTLS13-wifi-station-client/main/include/client-dtls13.h @@ -32,6 +32,16 @@ #include #include "user_settings.h" +/* The name the server certificate must carry: the SM2 test cert has only + * CN www.wolfssl.com, the RSA one has SAN example.com. */ +#ifndef TLS_SMP_SERVER_NAME + #if defined(WOLFSSL_SM2) || defined(WOLFSSL_SM3) || defined(WOLFSSL_SM4) + #define TLS_SMP_SERVER_NAME "www.wolfssl.com" + #else + #define TLS_SMP_SERVER_NAME "example.com" + #endif +#endif + #include #ifdef __cplusplus From 0c7f9a12b17193ccf703a223c98af2330852aeac Mon Sep 17 00:00:00 2001 From: Emma Stensland Date: Wed, 2 Dec 2026 12:15:44 -0700 Subject: [PATCH 09/11] F-17932: note the public test CA in the ESP32 DTLS client README --- ESP32/DTLS13-wifi-station-client/README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ESP32/DTLS13-wifi-station-client/README.md b/ESP32/DTLS13-wifi-station-client/README.md index 677c8c098..36e9b1454 100644 --- a/ESP32/DTLS13-wifi-station-client/README.md +++ b/ESP32/DTLS13-wifi-station-client/README.md @@ -61,6 +61,14 @@ idf.py save-defconfig Press `Ctrl+]` to exit `idf.py monitor`. See [additional monitor keyboard commands](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-monitor.html). +## Credentials + +The trusted CA comes from `wolfssl/certs_test.h` (see `CTX_CA_CERT` in +`user_settings.h`): its private key is public, so anyone can sign a server +certificate this client accepts. Replace it with your own CA before using this +code outside a demo, and set `TLS_SMP_SERVER_NAME` in `client-dtls13.h` to +your server's name. + ## Other Examples: For examples, see: From 2925bd5a3e6c55a2cf121a7fb0f520ea929f80b0 Mon Sep 17 00:00:00 2001 From: Emma Stensland Date: Wed, 2 Dec 2026 12:15:44 -0700 Subject: [PATCH 10/11] F-17931: note the public test key in the ESP32 DTLS server README --- ESP32/DTLS13-wifi-station-server/README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ESP32/DTLS13-wifi-station-server/README.md b/ESP32/DTLS13-wifi-station-server/README.md index 0a07c95b2..f729adb73 100644 --- a/ESP32/DTLS13-wifi-station-server/README.md +++ b/ESP32/DTLS13-wifi-station-server/README.md @@ -90,6 +90,13 @@ idf.py save-defconfig Press `Ctrl+]` to exit `idf.py monitor`. See [additional monitor keyboard commands](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-monitor.html). +## Credentials + +The server certificate and key come from `wolfssl/certs_test.h` (see +`CTX_SERVER_CERT` in `user_settings.h`): they are the public wolfSSL test +credentials, so anyone can impersonate this server. Replace them with your +own before using this code outside a demo. + ## Other Examples: For examples, see: From 69bbeafda82b5df88338b439dd2bd28a772c9eff Mon Sep 17 00:00:00 2001 From: Emma Stensland Date: Wed, 2 Dec 2026 12:19:38 -0700 Subject: [PATCH 11/11] ESP32: fix the res typo in the DTLS client set_time() fallback Without a wolfSSL git hash date the example failed to compile. --- ESP32/DTLS13-wifi-station-client/main/time_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ESP32/DTLS13-wifi-station-client/main/time_helper.c b/ESP32/DTLS13-wifi-station-client/main/time_helper.c index 233295757..b33fcef93 100644 --- a/ESP32/DTLS13-wifi-station-client/main/time_helper.c +++ b/ESP32/DTLS13-wifi-station-client/main/time_helper.c @@ -162,7 +162,7 @@ int set_time(void) #else /* otherwise set a fixed time that was hard coded */ set_fixed_default_time(); - restrict = -3; + res = -3; #endif #ifndef NTP_SERVER_COUNT