Skip to content

ESP32 examples: Fenrir fixes - #662

Open
stenslae wants to merge 11 commits into
wolfSSL:masterfrom
stenslae:fenrir/f18852-esp32-tls13-server-creds
Open

stenslae wants to merge 11 commits into
wolfSSL:masterfrom
stenslae:fenrir/f18852-esp32-tls13-server-creds

Conversation

@stenslae

@stenslae stenslae commented Dec 2, 2026

Copy link
Copy Markdown
Member

Fixes for ten Fenrir findings in the ESP32 TLS 1.3 / DTLS 1.3 example projects, one commit each, plus one typo fix.

  • Server identity (F-18850, F-17933): the TLS 1.3 and DTLS 1.3 clients call wolfSSL_check_domain_name() before connecting.
  • DTLS server stays up (F-17930): a failed handshake, read or write now drops only that peer. Empty datagrams and receive timeouts no longer shut the server down.
  • Stop on "shutdown" (F-18852): the ENC28J60 server now idles after shutdown instead of rebuilding itself every 5 s.
  • Small bugs:
    • DNS failure no longer dereferences NULL (F-11760).
    • struct tm is zero-initialized (F-11761).
    • The DTLS read buffer is terminated before logging (F-11807).
    • A res typo broke the DTLS client build without wolfSSL git metadata.
  • Test credentials (F-18851, F-17931, F-17932, F-18852): each README now says the embedded certs and keys are public test credentials to replace.

Testing: all six projects build with ESP-IDF 5.5 against wolfSSL master.

app_main kept rebuilding the server every 5 s without accepting.
The server READMEs say the embedded certs and keys are public.
A failed handshake, read or write, or an empty datagram, tore down
the listener and the task; now only that peer is dropped.
They went on to dereference a NULL address.
Any cert chaining to the CA was accepted as the server.
The SM2 test cert has no SAN, so SM builds check its CN instead.
Without a wolfSSL git hash date the example failed to compile.
@stenslae stenslae self-assigned this Dec 2, 2026
Copilot AI balanced review requested due to automatic review settings December 2, 2026 20:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are recorded for the ESP32 TLS/DTLS example hardening changes.

No open issues 🎉

What changed in this PR

Hardens the ESP32 TLS 1.3 and DTLS 1.3 examples by addressing server identity checks, failure handling, and demo credential risks.

Changes:

  • Adds server certificate name checks to clients.
  • Improves DTLS peer recovery, honors ENC28J60 shutdown, and fixes initialization, DNS, logging, and build issues.
  • Documents public test credentials in all six example READMEs.
File Description
ESP32/​TLS13-wifi_station-server/​README.md Documents test credentials and shutdown command.
ESP32/​TLS13-wifi_station-server/​main/​station_example_main.c Zero-initializes time structure.
ESP32/​TLS13-wifi_station-client/​README.md Documents credential replacement and server name.
ESP32/​TLS13-wifi_station-client/​main/​station_example_main.c Adds identity checks; fixes DNS and initialization handling.
ESP32/​TLS13-ENC28J60-server/​README.md Documents test credentials and shutdown command.
ESP32/​TLS13-ENC28J60-server/​main/​enc28j60_example_main.c Prevents restart after shutdown; initializes time structure.
ESP32/​TLS13-ENC28J60-client/​README.md Documents credential replacement and server name.
ESP32/​TLS13-ENC28J60-client/​main/​enc28j60_example_main.c Adds identity checks; fixes DNS and initialization handling.
ESP32/​DTLS13-wifi-station-server/​README.md Warns about public server credentials.
ESP32/​DTLS13-wifi-station-server/​main/​server-dtls13.c Recovers from peer failures and safely terminates logged data.
ESP32/​DTLS13-wifi-station-client/​README.md Documents test CA risks and server-name configuration.
ESP32/​DTLS13-wifi-station-client/​main/​time_helper.c Fixes fallback-time variable typo.
ESP32/​DTLS13-wifi-station-client/​main/​include/​client-dtls13.h Defines certificate-specific default server names.
ESP32/​DTLS13-wifi-station-client/​main/​client-dtls13.c Enables server certificate name verification.

Review effort: Balanced

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #662

Scan targets checked: wolfssl-examples-src, wolfssl-examples-bugs
Not reviewed (no scan target covers them): ESP32/DTLS13-wifi-station-client/README.md, ESP32/DTLS13-wifi-station-server/README.md, ESP32/TLS13-ENC28J60-client/README.md, ESP32/TLS13-ENC28J60-server/README.md, ESP32/TLS13-wifi_station-client/README.md, ESP32/TLS13-wifi_station-server/README.md
Coverage: 7 of 8 in-scope changed file(s) opened by the reviewer; not opened: ESP32/TLS13-wifi_station-server/main/station_example_main.c

Fenrir result: Approved ✅

No new issues found in the changed files.

Advisory only — this automated result does not count as a GitHub approval.

Review tier: Max

@stenslae stenslae assigned wolfSSL-Bot and unassigned stenslae Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants