Update Espressif Examples and Libraries
Description
This is primarily an update to the Espressif test and benchmark examples.
The updates to the client and server will be addressed in a separate PR.
I don't consider the examples "done", but I had to come up with a stopping point someplace, so here it is.
General
- Updates copyright year
- Spelling corrections, line length adjustment to less than 80 chars, variable initialization.
Post Quantum KEM PQ Support
- Adds optional Kyber KEM support to Espressif examples. See each project's
user_settings.h. Disabled by default.
wolfCrypt settings
- Adds Espressif-specific
XMALLOCconditionalwc_debug_pvPortMalloc()to print the number of bytes attempted to allocate at failure time.
Benchmark updates
- Improves support for ESP8266 (Tensilica). Timing is based on RTOS ticks, as CPU counter not available.
- Forces compile error if
CONFIG_NEWLIB_NANO_FORMAT=1(enabling this causes needed 64bit support to not be available, resulting in no numeric output). - Polish debugging code for Espressif timing & counter metrics.
- Updated some integer types
- Document
WOLFSSL_BENCHMARK_TIMER_DEBUG
TLS Client/Server Examples
- Add optional Kyber support. Disabled by default; see
./components/wolfssl/include/user_settings.h. - Implement more robust shutdown example (see
/examples/client) - Expand Read/Write loop for
WOLFSSL_ERROR_WANT_READandWOLFSSL_ERROR_WANT_WRITE
Espressif Utilities
- Adds programmatic ability to turn off watchdog.
- Polish function types (return
esp_err_tinstead ofint), add debug messages. - Adds new
esp_sdk_mem_libfor memory related functions and debugging tools. - Adds new
esp_sdk_time_libto pull time functions into common library rather than separate code in each example. - Adds new
esp_sdk_wifi_libto pull WiFi functions into common library rather than separate code in each example.
The Espressif TLS client and server applications have not been updated to use the new time and wifi libraries at this time.
- edit: Introduce NO_ESP_SDK_WIFI for Espressif examples due to missing
PROTOCOL_EXAMPLESfor ESP-IDF < v5.0.
Espressif Examples
- Updates
templateESP32 example VisualGDB project to use new ESP-IDF v5.2 by default. - Checks if
IDF_PATHis missing, causing a more clear error when usingcmake. - Add support for ESP8266
makeandcmakesupport towolfssl_benchmarkandwolfssl_test. - Updates
sdkconfigdefaults for various memory optimization settings. Note app may still use RTOS stack / tasks. - Modify ESP8266 heap allocation to no longer use IRAM by default.
- Adds
testAll.shandtestMonitor.shscripts to aid in running wolfcrypt tests on multiple Espressif devices. - Expands scope of testing in
wolfssl_testEspressif example, with known problems (e.g. insufficient default memory) flagged inuser_settings.h. - Various improvements to local wolfSSL component CMake file, in particular for setting or finding wolfssl source.
- Performance improvements using [
file(GLOB EXCLUDE...] instead of [file(GLOB_RECURSE EXCLUDE...] during build. - Adds cmake
VERBOSE_COMPONENT_MESSAGES(off be default) to print fewer messages. - Initialize UART in
main.c. Important for ESP8266 targets to output console. - Correction that RTOS task parameters are bytes, not words. See
TLS_SMP_SERVER_TASK_WORDSvsTLS_SMP_SERVER_TASK_BYTESmacro.
Fixes zd# n/a
Testing
How did you test?
Tested on 9 different Espressif SoC devices. Minimal testing on non-Espressif builds. Used the new 'testAll.sh' and 'testMonitor.sh' scripts.
Although disabled by default, there was extensive testing of ESP32 and ESP8266 PQ PEM from Espressif client to Espressif server, from Espressif client to Linux server, and from Linux client to Espressif listening TLS server. Linux versions used the 5.7.0 master release to ensure these Espressif examples work with that latest release.
Here are the 9x test results from my test jig
Checklist
- [ ] added tests
- [ ] updated/added doxygen
- [ ] updated appropriate READMEs
- [ ] Updated manual and documentation