Repository navigation
Reduce ESP32 TLS memory use with dynamic mbedTLS buffers - #3211
Merged
Merged
Conversation
floitsch
force-pushed
the
floitsch/esp-idf-dynamic-tls-buffers
branch
from
September 9, 2026 14:24
62be510 to
17b8d75
Compare
floitsch
enabled auto-merge (squash)
September 9, 2026 14:26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reduce TLS heap use on ESP32 by enabling dynamic mbedTLS buffers and disabling retention of the peer certificate after verification. Apply both settings to all six supported targets (ESP32, C3, C6, P4, S2, and S3); certificate verification remains enabled.
The required partial-header fix for nonblocking dynamic TLS receives (toitware/esp-idf#132) is available on master through #3216.
Generate
sdkconfig.defaultswithidf.py save-defconfig, then recreatesdkconfigfrom those defaults for each target. Keep the existing 7800/3700-byte record limits and leave dynamic freeing of configuration/CA data disabled. TLS 1.3 remains disabled; these settings would need revisiting when enabling it.Validation after rebasing:
sdkconfig.defaults, and regenerating solely from those defaults reproduces each committedsdkconfigbyte-for-byte.The ESP-IDF fix was previously validated with a host regression suite, allocation-failure injection, AddressSanitizer checks, and 54 verified TLS 1.2 transfers covering AES-CBC, AES-GCM, and ChaCha20-Poly1305, fragmented reads, and peer-certificate retention on/off. Physical-board execution of the TLS regression remains outstanding.