Web: enable TLS session tickets for faster session resumption

Rename arch/esp32/tls_cipher_restrict.c → arch/esp32/tls_server_config.c.
The file now handles two aspects of TLS server configuration via the
existing __wrap_mbedtls_ssl_config_defaults() intercept, so the old name
no longer described its full scope.

Add TLS session ticket support (RFC 5077).  Browsers can now resume
HTTPS sessions without a full RSA handshake, reducing connection latency
on repeated connections.

A static mbedtls_ssl_ticket_context is initialized once on first server
start using the ESP32 hardware RNG (esp_fill_random), then registered via
mbedtls_ssl_conf_session_tickets_cb().  The context must be static because
mbedTLS stores the pointer for the lifetime of the server, analogous to
kServerOnlyCipherSuites.  If mbedtls_ssl_ticket_setup() fails, the flag
remains unset and session tickets are silently skipped rather than
registering callbacks against an uninitialized context.

CONFIG_MBEDTLS_SSL_SESSION_TICKETS is enabled by default in the pre-built
arduino-esp32 framework, so no build system changes are required beyond
the filename update in platformio.ini.
This commit is contained in:
Valentin V. Bartenev
2026-05-13 04:48:15 +03:00
parent 09e6796fee
commit 89a59d5a2e
2 changed files with 45 additions and 6 deletions
+1 -1
View File
@@ -68,7 +68,7 @@ build_flags = ${arduino_base.build_flags}
-Wl,--wrap=mbedtls_ssl_config_defaults
build_src_filter = ${arduino_base.build_src_filter}
+<../arch/esp32/task_pinning.c>
+<../arch/esp32/tls_cipher_restrict.c>
+<../arch/esp32/tls_server_config.c>
+<../arch/esp32/CPUUsageTracker.cpp>
[esp32_ota]