Skip to content

esp-wolfssl: esp_key_config_t server key support, ESP-IDF <6.0 build fix, and ESP_TLS_HAS_WOLFSSL macro#32

Open
hrushikesh430 wants to merge 4 commits into
espressif:masterfrom
hrushikesh430:feature/add_idf_component_yml_and_server_key
Open

esp-wolfssl: esp_key_config_t server key support, ESP-IDF <6.0 build fix, and ESP_TLS_HAS_WOLFSSL macro#32
hrushikesh430 wants to merge 4 commits into
espressif:masterfrom
hrushikesh430:feature/add_idf_component_yml_and_server_key

Conversation

@hrushikesh430

@hrushikesh430 hrushikesh430 commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

What

  • port/esp_tls_wolfssl.c — accept the unified esp_key_config_t (cfg->server_key / cfg->client_key) on the esp-tls server and client paths, in addition to the legacy serverkey_buf / clientkey_buf. The unified key interface was added to esp-tls after v6.0, so it is detected via __has_include("esp_key_config.h") (not an IDF version number) to keep building on v6.0 and earlier.
  • CMakeLists.txt — don't compile port/esp_tls_wolfssl.c when CONFIG_ESP_TLS_CUSTOM_STACK is unset (it uses the 6.0-only esp_tls_custom_stack.h), so the component builds on ESP-IDF < 6.0 (native-API use).
  • include/esp_wolfssl_stack.h — define ESP_TLS_HAS_WOLFSSL for feature detection. Migrated from feat(esp-wolfssl): Defined the ESP_TLS_HAS_WOLFSSL macro #29 (esp-idf#17682); supersedes and closes feat(esp-wolfssl): Defined the ESP_TLS_HAS_WOLFSSL macro #29.
  • README.md — document path-based (clone) usage; drop the registry / add-dependency instructions.

Why the code changes

  • key config — ESP-IDF commit 36090b71611 (feat(esp-tls): Add unified private key interface via esp_key_config_t) switched esp_https_server / https_server/simple to pass the key via cfg->server_key instead of serverkey_buf. The wolfSSL port only read serverkey_buf, so https_server/simple failed with esp-tls-wolfssl: You have to provide both servercert_buf and serverkey_buf. The client path (client_key) had the same gap.
  • < 6.0 build fixesp_tls_custom_stack.h exists only in v6.0+, but the custom-stack file was compiled unconditionally, so on v5.5 the build failed with fatal error: esp_tls_custom_stack.h: No such file or directory.

Testing

Backend = esp-wolfssl. On IDF 6.0+ it is the esp-tls custom stack (CONFIG_ESP_TLS_CUSTOM_STACK=y); on < 6.0 it is used via the native wolfSSL API (custom stack does not exist there). Logs attached in the comments below.

ESP-IDF Chip Example Backend path Result
master (v6.2-dev) ESP32-C3 esp-idf https_request custom stack ✅ TLS 1.2 → HTTP 200
master (v6.2-dev) ESP32-C3 esp-idf https_server/simple custom stack (mutual TLS) ✅ HTTP 200 Hello Secure World!
master (v6.2-dev) ESP32-C3 esp-wolfssl examples/https_request custom stack ✅ TLS 1.2 → HTTP 200
v6.0.1 ESP32 esp-idf https_request custom stack ✅ TLS 1.2 → HTTP 200
v6.0.1 ESP32 esp-idf https_server/simple custom stack (mutual TLS) ✅ HTTP 200 Hello Secure World!
v5.5.4 ESP32-C3 esp-wolfssl examples/wolfssl_client native wolfSSL API ✅ TLS → HTTP 200

Builds: master (v6.2-dev) ✅ · v6.0.1 ✅ · v5.5.4 ✅. On v6.0.1 the __has_include guard is also exercised (there esp_key_config.h is absent, so server_key/client_key are correctly excluded); on v5.5.4 the component builds only because esp_tls_wolfssl.c is excluded (< 6.0 fix).

@hrushikesh430 hrushikesh430 self-assigned this Jul 13, 2026
@hrushikesh430

Copy link
Copy Markdown
Collaborator Author

Runtime test logs

Tested on ESP-IDF master (v6.2-dev), ESP32-C3, esp-wolfssl as the esp-tls custom stack.

examples/protocols/https_request — device serial (TLS 1.2 → HTTP 200)
========================================================================
 esp-wolfssl (wolfSSL as ESP-TLS custom stack) - runtime test
 Example : esp-idf/examples/protocols/https_request  (application code UNMODIFIED)
 Backend : esp-wolfssl, CONFIG_ESP_TLS_CUSTOM_STACK=y, wolfSSL v5.9.1-stable
 Target  : ESP32-C3     ESP-IDF : v6.2-dev
 Result  : custom stack registered -> Wi-Fi -> SNTP -> TLS 1.2 handshake
           -> HTTP/1.1 200 OK from www.howsmyssl.com (loops, clean close)
========================================================================

ESP-ROM:esp32c3-20200918
Build:Sep 18 2020
rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd5830,len:0x15b8
load:0x403cbf10,len:0xd04
load:0x403ce710,len:0x2ffc
entry 0x403cbf1a
I (30) boot: ESP-IDF v6.2-dev-1281-g6ef9a267f1b-dirt 2nd stage bootloader
I (30) boot: compile time Jul 13 2026 14:44:31
I (30) boot: chip revision: v0.0
I (32) boot: efuse block revision: v0.0
I (36) boot.esp32c3: SPI Speed      : 80MHz
I (40) boot.esp32c3: SPI Mode       : DIO
I (44) boot.esp32c3: SPI Flash Size : 2MB
I (47) boot: Enabling RNG early entropy source...
I (52) boot: Partition Table:
I (54) boot: ## Label            Usage          Type ST Offset   Length
I (61) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (67) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (74) boot:  2 factory          factory app      00 00 00010000 00177000
I (80) boot: End of partition table
I (84) esp_image: segment 0: paddr=00010020 vaddr=3c0e0020 size=2f334h (193332) map
I (121) esp_image: segment 1: paddr=0003f35c vaddr=3fc91c00 size=00cbch (  3260) load
I (122) esp_image: segment 2: paddr=00040020 vaddr=42000020 size=db9fch (899580) map
I (265) esp_image: segment 3: paddr=0011ba24 vaddr=3fc928bc size=02838h ( 10296) load
I (268) esp_image: segment 4: paddr=0011e264 vaddr=40380000 size=11a28h ( 72232) load
I (283) esp_image: segment 5: paddr=0012fc94 vaddr=50000000 size=00024h (    36) load
I (289) boot: Loaded app from partition at offset 0x10000
I (289) boot: Disabling RNG early entropy source...
I (301) cpu_start: Unicore app
I (310) cpu_start: GPIO 20 and 21 are used as console UART I/O pins
I (310) cpu_start: Pro cpu start user code
I (310) cpu_start: cpu freq: 160000000 Hz
I (312) app_init: Application information:
I (316) app_init: Project name:     https_request
I (320) app_init: App version:      v6.2-dev-1281-g6ef9a267f1b-dirt
I (326) app_init: Compile time:     Jul 13 2026 14:41:37
I (331) app_init: ELF file SHA256:  52c0663e8...
I (335) app_init: ESP-IDF:          v6.2-dev-1281-g6ef9a267f1b-dirt
I (341) efuse_init: Min chip rev:     v0.0
I (345) efuse_init: Max chip rev:     v1.99 
I (349) efuse_init: Chip rev:         v0.0
I (353) heap_init: Initializing. RAM available for dynamic allocation:
I (359) heap_init: At 3FC9B0F0 len 00024F10 (147 KiB): RAM
I (365) heap_init: At 3FCC0000 len 0001C710 (113 KiB): Retention RAM
I (371) heap_init: At 3FCDC710 len 00002B50 (10 KiB): Retention RAM
I (377) heap_init: At 50000024 len 00001FC4 (7 KiB): RTCRAM
I (383) spi_flash: detected chip: generic
I (386) spi_flash: flash io: dio
W (389) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
W (401) eFuse: calibration efuse version does not match, set default version to 0
I (414) sleep_gpio: Configure to isolate all GPIO pins in sleep state
I (414) sleep_gpio: Enable automatic switching of GPIO sleep configuration
I (421) esp-tls-custom-stack: Custom TLS stack registered successfully
I (428) main_task: Started on CPU0
I (428) main_task: Calling app_main()
I (438) example_connect: Start example_connect.
I (438) pp: pp rom version: 8459080
I (438) net80211: net80211 rom version: 8459080
I (448) wifi:wifi driver task: 3fca3608, prio:23, stack:6656, core=0
I (448) wifi:wifi firmware version: 65f9dd7
I (448) wifi:wifi certification version: v7.0
I (458) wifi:config NVS flash: enabled
I (458) wifi:config nano formatting: disabled
I (458) wifi:Init data frame dynamic rx buffer num: 32
I (468) wifi:Init static rx mgmt buffer num: 5
I (468) wifi:Init management short buffer num: 32
I (478) wifi:Init dynamic tx buffer num: 32
I (478) wifi:Init static tx FG buffer num: 2
I (488) wifi:Init static rx buffer size: 1600
I (488) wifi:Init static rx buffer num: 10
I (488) wifi:Init dynamic rx buffer num: 32
I (498) wifi_init: rx ba win: 6
I (498) wifi_init: accept mbox: 6
I (498) wifi_init: tcpip mbox: 32
I (508) wifi_init: udp mbox: 6
I (508) wifi_init: tcp mbox: 6
I (508) wifi_init: tcp tx win: 5760
I (518) wifi_init: tcp rx win: 5760
I (518) wifi_init: tcp mss: 1440
I (518) wifi_init: WiFi IRAM OP enabled
I (518) wifi_init: WiFi RX IRAM OP enabled
I (528) phy_init: phy_version 1235,8bd8c6fc,Apr 13 2026,18:46:20
I (578) wifi:mode : sta (7c:df:a1:40:01:48)
I (578) wifi:enable tsf
I (578) example_connect: Connecting to Pixel...
W (578) wifi:Password length matches WPA2 standards, authmode threshold changes from OPEN to WPA2
I (588) example_connect: Waiting for IP(s)
I (2998) wifi:new:<11,0>, old:<1,0>, ap:<255,255>, sta:<11,0>, prof:1, snd_ch_cfg:0x0
I (2998) wifi:state: init -> auth (0xb0)
I (3508) wifi:state: auth -> assoc (0x0)
I (3508) wifi:state: assoc -> run (0x10)
I (3558) wifi:connected with Pixel, aid = 1, channel 11, BW20, bssid = 8e:26:55:17:45:aa
I (3558) wifi:security: WPA3-SAE HUNT_AND_PECK, phy: bgn, rssi: -46, cipher(pairwise:0x3, group:0x3), pmf:1
I (3568) wifi:pm start, type: 1

I (3568) wifi:dp: 1, bi: 102400, li: 3, scale listen interval from 307200 us to 307200 us
I (3578) wifi:set rx beacon pti, rx_bcn_pti: 0, bcn_timeout: 25000, mt_pti: 0, mt_time: 10000
I (3588) wifi:dp: 2, bi: 102400, li: 4, scale listen interval from 307200 us to 409600 us
I (3588) wifi:AP's beacon interval = 102400 us, DTIM period = 2
I (4638) esp_netif_handlers: example_netif_sta ip: 10.42.223.133, mask: 255.255.255.0, gw: 10.42.223.134
I (4638) example_connect: Got IPv4 event: Interface "example_netif_sta" address: 10.42.223.133
I (5438) example_connect: Got IPv6 event: Interface "example_netif_sta" address: fe80:0000:0000:0000:7edf:a1ff:fe40:0148, type: ESP_IP6_ADDR_IS_LINK_LOCAL
I (5438) example_common: Connected to example_netif_sta
I (5438) example_common: - IPv4 address: 10.42.223.133,
I (5448) example_common: - IPv6 address: fe80:0000:0000:0000:7edf:a1ff:fe40:0148, type: ESP_IP6_ADDR_IS_LINK_LOCAL
I (5458) example: Updating time from NVS
I (5458) example: Start https_request example
I (5468) example: Minimum free heap size: 209660 bytes
I (5468) example: https_request using cacert_buf
I (5478) main_task: Returned from app_main()
I (5488) wifi:<ba-add>idx:0 (ifx:0, 8e:26:55:17:45:aa), tid:0, ssn:2, winSize:64
I (7438) example_connect: Got IPv6 event: Interface "example_netif_sta" address: 2401:4900:ad28:8dc8:7edf:a1ff:fe40:0148, type: ESP_IP6_ADDR_IS_GLOBAL
I (11278) example: Connection established...
I (11278) example: 102 bytes written
I (11278) example: Reading HTTP response...
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Connection: close
Content-Length: 1135
Content-Type: application/json
Strict-Transport-Security: max-age=631138519; includeSubdomains; preload
Vary: Accept-Encoding
Date: Mon, 13 Jul 2026 09:55:54 GMT

{"given_cipher_suites":["TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384","TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256","TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384","TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256","TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256","TLS_ECDHE_ECDSA_WITH_AES
_128_CBC_SHA256","TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384","TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384","TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA","TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA","TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA","TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA"],"given_named_groups":["secp521r1","secp384r1","secp256r1","x25519","secp224r1"],"given_signature_algorithms":["ecdsa_secp521r1_sha512","ecdsa_secp384r1_sha384","ecdsa_secp256r1_sha256","ed25519","rsa_pss_rsae_sha512","rsa_pss_rsae_sha384","rsa_pss_rsae_sha256
","rsa_pkcs1_sha512","rsa_pkcs1_sha384","rsa_pkcs1_sha256"],"post_quantum_key_agreement":false,"ephemeral_keys_supported":true,"session_ticket_supported":fal
se,"tls_compression_supported":false,"unknown_cipher_suite_supported":false,"beast_vuln":false,"able_to_detect_n_minus_one_splitting":false,"insecure_cipher_suites":{},"tls_version":"TLS 1.2","rating":"Improvable"}
I (11798) example: connection closed
I (11798) example: 10...
I (12798) example: 9...
I (13798) example: 8...
I (14798) example: 7...
I (15798) example: 6...
I (16798) example: 5...
I (17798) example: 4...
I (18798) example: 3...
I (19798) example: 2...
I (20798) example: 1...
I (21798) example: 0...
I (22798) example: https_request using global ca_store
I (28478) example: Connection established...
I (28488) example: 102 bytes written
I (28488) example: Reading HTTP response...
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Connection: close
Content-Length: 1135
Content-Type: application/json
Strict-Transport-Security: max-age=631138519; includeSubdomains; preload
Vary: Accept-Encoding
Date: Mon, 13 Jul 2026 09:56:11 GMT

{"given_cipher_suites":["TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384","TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256","TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384","TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256","TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256","TLS_ECDHE_ECDSA_WITH_AES
_128_CBC_SHA256","TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384","TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384","TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA","TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA","TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA","TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA"],"given_named_groups":["secp521r1","secp384r1","secp256r1","x25519","secp224r1"],"given_signature_algorithms":["ecdsa_secp521r1_sha512","ecdsa_secp384r1_sha384","ecdsa_secp256r1_sha256","ed25519","rsa_pss_rsae_sha512","rsa_pss_rsae_sha384","rsa_pss_rsae_sha256
","rsa_pkcs1_sha512","rsa_pkcs1_sha384","rsa_pkcs1_sha256"],"post_quantum_key_agreement":false,"ephemeral_keys_supported":true,"session_ticket_supported":fal
se,"tls_compression_supported":false,"unknown_cipher_suite_supported":false,"beast_vuln":false,"able_to_detect_n_minus_one_splitting":false,"insecure_cipher_suites":{},"tls_version":"TLS 1.2","rating":"Improvable"}
I (29028) example: connection closed
I (29038) example: 10...
I (30038) example: 9...
I (31038) example: 8...
I (32038) example: 7...
I (33038) example: 6...
I (34038) example: 5...
I (35038) example: 4...
I (36038) example: 3...
I (37038) example: 2...
I (38038) example: 1...
I (39038) example: 0...
I (40038) example: Finish https_request example

examples/protocols/https_server/simple — device serial + client curl (mutual TLS → HTTP 200)
========================================================================
 esp-wolfssl (wolfSSL as ESP-TLS custom stack) - runtime test
 Example : esp-idf/examples/protocols/https_server/simple
           (original conf.server_key key API; a settimeofday() clock step
            was added because wolfSSL validates certificate dates)
 Backend : esp-wolfssl, CONFIG_ESP_TLS_CUSTOM_STACK=y, wolfSSL v5.9.1-stable
 Target  : ESP32-C3     ESP-IDF : v6.2-dev
 Result  : custom stack registered -> server listening :443
           -> mutual-TLS handshake -> HTTP 200 'Hello Secure World!'
========================================================================

------------------------------------------------------------------------
[1] Device serial (ESP32-C3): boot, wolfSSL registration, Wi-Fi, server start
------------------------------------------------------------------------
ESP-ROM:esp32c3-20200918
Build:Sep 18 2020
rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd5830,len:0x15b8
load:0x403cbf10,len:0xd04
load:0x403ce710,len:0x2ffc
entry 0x403cbf1a
I (30) boot: ESP-IDF v6.2-dev-1281-g6ef9a267f1b-dirt 2nd stage bootloader
I (30) boot: compile time Jul 13 2026 14:50:58
I (30) boot: chip revision: v0.0
I (32) boot: efuse block revision: v0.0
I (36) boot.esp32c3: SPI Speed      : 80MHz
I (40) boot.esp32c3: SPI Mode       : DIO
I (44) boot.esp32c3: SPI Flash Size : 2MB
I (47) boot: Enabling RNG early entropy source...
I (52) boot: Partition Table:
I (54) boot: ## Label            Usage          Type ST Offset   Length
I (61) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (67) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (74) boot:  2 factory          factory app      00 00 00010000 00177000
I (80) boot: End of partition table
I (84) esp_image: segment 0: paddr=00010020 vaddr=3c0e0020 size=308ech (198892) map
I (122) esp_image: segment 1: paddr=00040914 vaddr=3fc91c00 size=0350ch ( 13580) load
I (125) esp_image: segment 2: paddr=00043e28 vaddr=40380000 size=0c1f0h ( 49648) load
I (135) esp_image: segment 3: paddr=00050020 vaddr=42000020 size=dd728h (907048) map
I (277) esp_image: segment 4: paddr=0012d750 vaddr=4038c1f0 size=05864h ( 22628) load
I (281) esp_image: segment 5: paddr=00132fbc vaddr=50000000 size=00024h (    36) load
I (287) boot: Loaded app from partition at offset 0x10000
I (287) boot: Disabling RNG early entropy source...
I (303) cpu_start: Unicore app
I (312) cpu_start: GPIO 20 and 21 are used as console UART I/O pins
I (312) cpu_start: Pro cpu start user code
I (312) cpu_start: cpu freq: 160000000 Hz
I (314) app_init: Application information:
I (318) app_init: Project name:     https_server
I (322) app_init: App version:      v6.2-dev-1281-g6ef9a267f1b-dirt
I (328) app_init: Compile time:     Jul 13 2026 14:51:00
I (333) app_init: ELF file SHA256:  30f5e0c61...
I (337) app_init: ESP-IDF:          v6.2-dev-1281-g6ef9a267f1b-dirt
I (343) efuse_init: Min chip rev:     v0.0
I (347) efuse_init: Max chip rev:     v1.99 
I (351) efuse_init: Chip rev:         v0.0
I (355) heap_init: Initializing. RAM available for dynamic allocation:
I (361) heap_init: At 3FC9ABC0 len 00025440 (149 KiB): RAM
I (366) heap_init: At 3FCC0000 len 0001C710 (113 KiB): Retention RAM
I (373) heap_init: At 3FCDC710 len 00002B50 (10 KiB): Retention RAM
I (379) heap_init: At 50000024 len 00001FC4 (7 KiB): RTCRAM
I (385) spi_flash: detected chip: generic
I (388) spi_flash: flash io: dio
W (391) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
W (403) eFuse: calibration efuse version does not match, set default version to 0
I (416) sleep_gpio: Configure to isolate all GPIO pins in sleep state
I (416) sleep_gpio: Enable automatic switching of GPIO sleep configuration
I (423) esp-tls-custom-stack: Custom TLS stack registered successfully
I (429) main_task: Started on CPU0
I (429) main_task: Calling app_main()
I (439) example_connect: Start example_connect.
I (439) pp: pp rom version: 8459080
I (439) net80211: net80211 rom version: 8459080
I (449) wifi:wifi driver task: 3fca3220, prio:23, stack:6656, core=0
I (449) wifi:wifi firmware version: 65f9dd7
I (449) wifi:wifi certification version: v7.0
I (459) wifi:config NVS flash: enabled
I (459) wifi:config nano formatting: disabled
I (459) wifi:Init data frame dynamic rx buffer num: 32
I (469) wifi:Init static rx mgmt buffer num: 5
I (469) wifi:Init management short buffer num: 32
I (479) wifi:Init dynamic tx buffer num: 32
I (479) wifi:Init static tx FG buffer num: 2
I (489) wifi:Init static rx buffer size: 1600
I (489) wifi:Init static rx buffer num: 10
I (489) wifi:Init dynamic rx buffer num: 32
I (499) wifi_init: rx ba win: 6
I (499) wifi_init: accept mbox: 6
I (499) wifi_init: tcpip mbox: 32
I (509) wifi_init: udp mbox: 6
I (509) wifi_init: tcp mbox: 6
I (509) wifi_init: tcp tx win: 5760
I (519) wifi_init: tcp rx win: 5760
I (519) wifi_init: tcp mss: 1440
I (519) wifi_init: WiFi IRAM OP enabled
I (519) wifi_init: WiFi RX IRAM OP enabled
I (529) phy_init: phy_version 1235,8bd8c6fc,Apr 13 2026,18:46:20
I (569) wifi:mode : sta (7c:df:a1:40:01:48)
I (569) wifi:enable tsf
I (579) example_connect: Connecting to Pixel...
W (579) wifi:Password length matches WPA2 standards, authmode threshold changes from OPEN to WPA2
I (579) example_connect: Waiting for IP(s)
I (2989) wifi:new:<11,0>, old:<1,0>, ap:<255,255>, sta:<11,0>, prof:1, snd_ch_cfg:0x0
I (2989) wifi:state: init -> auth (0xb0)
I (3519) wifi:state: auth -> assoc (0x0)
I (3549) wifi:state: assoc -> run (0x10)
I (3569) wifi:connected with Pixel, aid = 1, channel 11, BW20, bssid = 8e:26:55:17:45:aa
I (3569) wifi:security: WPA3-SAE HUNT_AND_PECK, phy: bgn, rssi: -41, cipher(pairwise:0x3, group:0x3), pmf:1
I (3579) wifi:pm start, type: 1

I (3579) wifi:dp: 1, bi: 102400, li: 3, scale listen interval from 307200 us to 307200 us
I (3589) wifi:set rx beacon pti, rx_bcn_pti: 0, bcn_timeout: 25000, mt_pti: 0, mt_time: 10000
I (3619) wifi:dp: 2, bi: 102400, li: 4, scale listen interval from 307200 us to 409600 us
I (3619) wifi:AP's beacon interval = 102400 us, DTIM period = 2
I (4679) example: Starting server
I (4679) esp_https_server: Starting server
I (4679) esp_https_server: Server listening on port 443
I (4679) example: Registering URI handlers
I (4679) esp_netif_handlers: example_netif_sta ip: 10.42.223.133, mask: 255.255.255.0, gw: 10.42.223.134
I (4689) example_connect: Got IPv4 event: Interface "example_netif_sta" address: 10.42.223.133
I (5439) example_connect: Got IPv6 event: Interface "example_netif_sta" address: fe80:0000:0000:0000:7edf:a1ff:fe40:0148, type: ESP_IP6_ADDR_IS_LINK_LOCAL
I (5439) example_common: Connected to example_netif_sta
I (5439) example_common: - IPv4 address: 10.42.223.133,
I (5449) example_common: - IPv6 address: fe80:0000:0000:0000:7edf:a1ff:fe40:0148, type: ESP_IP6_ADDR_IS_LINK_LOCAL
I (5449) wifi:<ba-add>idx:0 (ifx:0, 8e:26:55:17:45:aa), tid:0, ssn:2, winSize:64
I (5469) main_task: Returned from app_main()
I (7439) example_connect: Got IPv6 event: Interface "example_netif_sta" address: 2401:4900:ad28:8dc8:7edf:a1ff:fe40:0148, type: ESP_IP6_ADDR_IS_GLOBAL

------------------------------------------------------------------------
[2] Device serial: incoming TLS session while the client connects
------------------------------------------------------------------------
I (423) esp-tls-custom-stack: Custom TLS stack registered successfully
I (7920) esp_https_server: Starting server
I (7920) esp_https_server: Server listening on port 443
I (7920) example: Registering URI handlers
I (8240) esp_https_server: performing session handshake

------------------------------------------------------------------------
[3] Host client: curl --cert client_cert.pem --key client_key.pem (mutual TLS)
------------------------------------------------------------------------
*   Trying 10.42.223.133:443...
* Connected to 10.42.223.133 (10.42.223.133) port 443
* ALPN: curl offers h2,http/1.1
* (304) (OUT), TLS handshake, Client hello (1):
} [292 bytes data]
* (304) (IN), TLS handshake, Server hello (2):
{ [82 bytes data]
* TLSv1.2 (IN), TLS handshake, Certificate (11):
{ [915 bytes data]
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
{ [300 bytes data]
* TLSv1.2 (IN), TLS handshake, Request CERT (13):
{ [30 bytes data]
* TLSv1.2 (IN), TLS handshake, Server finished (14):
{ [4 bytes data]
* TLSv1.2 (OUT), TLS handshake, Certificate (11):
} [906 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
} [37 bytes data]
* TLSv1.2 (OUT), TLS handshake, CERT verify (15):
} [264 bytes data]
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
} [1 bytes data]
* TLSv1.2 (OUT), TLS handshake, Finished (20):
} [16 bytes data]
* TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
{ [1 bytes data]
* TLSv1.2 (IN), TLS handshake, Finished (20):
{ [16 bytes data]
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384 / [blank] / UNDEF
* ALPN: server did not agree on a protocol. Uses default.
* Server certificate:
*  subject: C=SG; ST=SG; L=SG; O=ESP32; CN=ESP32 HTTPS Server
*  start date: Oct 10 02:39:00 2025 GMT
*  expire date: Oct  8 02:39:00 2035 GMT
*  issuer: CN=ESP32 HTTPS server example
*  SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
* using HTTP/1.x
> GET / HTTP/1.1
> Host: 10.42.223.133
> User-Agent: curl/8.6.0
> Accept: */*
> 
< HTTP/1.1 200 OK
< Content-Type: text/html
< Content-Length: 28
< 
{ [28 bytes data]
* Connection #0 to host 10.42.223.133 left intact
<h1>Hello Secure World!</h1>

@hrushikesh430

Copy link
Copy Markdown
Collaborator Author

@AdityaHPatwardhan PTAL

@hrushikesh430

Copy link
Copy Markdown
Collaborator Author

On-device firmware log — ESP-IDF v5.5.4 (ESP32-C3)

esp-wolfssl exercised via the native wolfSSL API (examples/wolfssl_client) on ESP-IDF v5.5.4 (the esp-tls custom stack is 6.0+ only). Flow: Wi-Fi → SNTP → wolfSSL TLS handshake to api.github.com:443 (server certificate verified) → HTTP/1.1 200 OK, looping.

Built with the CMake fix from this branch (4f20a1c) that excludes the custom-stack file on IDF < 6.0; without it the component fails to compile on 5.5.

wolfssl_client — device serial (v5.5.4, ESP32-C3)
======================================================================
 esp-wolfssl on ESP-IDF v5.5.4  -  on-device firmware log
 On ESP-IDF < 6.0 the esp-tls custom-stack API does not exist, so
 esp-wolfssl is exercised via the native wolfSSL API.
 Example : esp-wolfssl/examples/wolfssl_client -> api.github.com:443
 Target  : ESP32-C3 (rev v0.0)   IDF: v5.5.4   TLS cert verify: ON
 Result  : Wi-Fi -> SNTP -> wolfSSL TLS handshake -> HTTP/1.1 200 OK
======================================================================

ESP-ROM:esp32c3-20200918
Build:Sep 18 2020
rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd5820,len:0x155c
load:0x403cbf10,len:0xc84
load:0x403ce710,len:0x2fa4
entry 0x403cbf1a
I (30) boot: ESP-IDF v5.5.4 2nd stage bootloader
I (30) boot: compile time Jul 14 2026 11:47:25
I (30) boot: chip revision: v0.0
I (30) boot: efuse block revision: v0.0
I (34) boot.esp32c3: SPI Speed      : 80MHz
I (38) boot.esp32c3: SPI Mode       : DIO
I (41) boot.esp32c3: SPI Flash Size : 2MB
I (45) boot: Enabling RNG early entropy source...
I (50) boot: Partition Table:
I (52) boot: ## Label            Usage          Type ST Offset   Length
I (59) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (65) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (72) boot:  2 factory          factory app      00 00 00010000 00177000
I (78) boot: End of partition table
I (81) esp_image: segment 0: paddr=00010020 vaddr=3c0e0020 size=2b9d8h (178648) map
I (117) esp_image: segment 1: paddr=0003ba00 vaddr=3fc94600 size=031b8h ( 12728) load
I (119) esp_image: segment 2: paddr=0003ebc0 vaddr=40380000 size=01458h (  5208) load
I (122) esp_image: segment 3: paddr=00040020 vaddr=42000020 size=d4230h (868912) map
I (264) esp_image: segment 4: paddr=00114258 vaddr=40381458 size=13134h ( 78132) load
I (278) esp_image: segment 5: paddr=00127394 vaddr=50000000 size=00020h (    32) load
I (284) boot: Loaded app from partition at offset 0x10000
I (284) boot: Disabling RNG early entropy source...
I (297) cpu_start: Unicore app
I (305) cpu_start: GPIO 20 and 21 are used as console UART I/O pins
I (305) cpu_start: Pro cpu start user code
I (306) cpu_start: cpu freq: 160000000 Hz
I (307) app_init: Application information:
I (311) app_init: Project name:     wolfssl
I (315) app_init: App version:      4f20a1c-dirty
I (320) app_init: Compile time:     Jul 14 2026 11:47:26
I (325) app_init: ELF file SHA256:  861a40000...
I (329) app_init: ESP-IDF:          v5.5.4
I (333) efuse_init: Min chip rev:     v0.0
I (337) efuse_init: Max chip rev:     v1.99 
I (341) efuse_init: Chip rev:         v0.0
I (345) heap_init: Initializing. RAM available for dynamic allocation:
I (351) heap_init: At 3FC9D790 len 00022870 (138 KiB): RAM
I (356) heap_init: At 3FCC0000 len 0001C710 (113 KiB): Retention RAM
I (362) heap_init: At 3FCDC710 len 00002B50 (10 KiB): Retention RAM
I (368) heap_init: At 50000020 len 00001FC8 (7 KiB): RTCRAM
I (374) spi_flash: detected chip: generic
I (377) spi_flash: flash io: dio
W (380) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
W (392) eFuse: calibration efuse version does not match, set default version to 0
I (405) sleep_gpio: Configure to isolate all GPIO pins in sleep state
I (406) sleep_gpio: Enable automatic switching of GPIO sleep configuration
I (412) main_task: Started on CPU0
I (422) main_task: Calling app_main()
I (422) example_connect: Start example_connect.
I (422) pp: pp rom version: 8459080
I (422) net80211: net80211 rom version: 8459080
I (442) wifi:wifi driver task: 3fca5f48, prio:23, stack:6656, core=0
I (442) wifi:wifi firmware version: 0947e8b
I (442) wifi:wifi certification version: v7.0
I (442) wifi:config NVS flash: enabled
I (442) wifi:config nano formatting: disabled
I (452) wifi:Init data frame dynamic rx buffer num: 32
I (452) wifi:Init static rx mgmt buffer num: 5
I (462) wifi:Init management short buffer num: 32
I (462) wifi:Init dynamic tx buffer num: 32
I (462) wifi:Init static tx FG buffer num: 2
I (472) wifi:Init static rx buffer size: 1600
I (472) wifi:Init static rx buffer num: 10
I (482) wifi:Init dynamic rx buffer num: 32
I (482) wifi_init: rx ba win: 6
I (482) wifi_init: accept mbox: 6
I (492) wifi_init: tcpip mbox: 32
I (492) wifi_init: udp mbox: 6
I (492) wifi_init: tcp mbox: 6
I (492) wifi_init: tcp tx win: 5760
I (502) wifi_init: tcp rx win: 5760
I (502) wifi_init: tcp mss: 1440
I (502) wifi_init: WiFi IRAM OP enabled
I (512) wifi_init: WiFi RX IRAM OP enabled
I (512) phy_init: phy_version 1232,d493f299,Aug 25 2025,19:01:20
W (522) phy_init: failed to load RF calibration data (0xffffffff), falling back to full calibration
I (622) phy_init: Saving new calibration data due to checksum failure or outdated calibration data, mode(2)
I (632) wifi:mode : sta (7c:df:a1:40:01:48)
I (632) wifi:enable tsf
I (642) example_connect: Connecting to Pixel...
W (642) wifi:Password length matches WPA2 standards, authmode threshold changes from OPEN to WPA2
I (642) example_connect: Waiting for IP(s)
I (3052) wifi:new:<11,0>, old:<1,0>, ap:<255,255>, sta:<11,0>, prof:1, snd_ch_cfg:0x0
I (3052) wifi:state: init -> auth (0xb0)
I (3712) wifi:state: auth -> assoc (0x0)
I (3722) wifi:state: assoc -> run (0x10)
I (3732) wifi:connected with Pixel, aid = 1, channel 11, BW20, bssid = ae:8d:40:42:92:1e
I (3732) wifi:security: WPA3-SAE HUNT_AND_PECK, phy: bgn, rssi: -32, cipher(pairwise:0x3, group:0x3), pmf:1
I (3742) wifi:pm start, type: 1

I (3742) wifi:dp: 1, bi: 102400, li: 3, scale listen interval from 307200 us to 307200 us
I (3752) wifi:set rx beacon pti, rx_bcn_pti: 0, bcn_timeout: 25000, mt_pti: 0, mt_time: 10000
I (3812) wifi:dp: 2, bi: 102400, li: 4, scale listen interval from 307200 us to 409600 us
I (3812) wifi:AP's beacon interval = 102400 us, DTIM period = 2
I (4822) esp_netif_handlers: example_netif_sta ip: 10.111.110.133, mask: 255.255.255.0, gw: 10.111.110.204
I (4822) example_connect: Got IPv4 event: Interface "example_netif_sta" address: 10.111.110.133
I (5422) example_connect: Got IPv6 event: Interface "example_netif_sta" address: fe80:0000:0000:0000:7edf:a1ff:fe40:0148, type: ESP_IP6_ADDR_IS_LINK_LOCAL
I (5422) example_common: Connected to example_netif_sta
I (5422) example_common: - IPv4 address: 10.111.110.133,
I (5432) example_common: - IPv6 address: fe80:0000:0000:0000:7edf:a1ff:fe40:0148, type: ESP_IP6_ADDR_IS_LINK_LOCAL
I (5442) main_task: Returned from app_main()
I (5682) wifi:<ba-add>idx:0 (ifx:0, ae:8d:40:42:92:1e), tid:0, ssn:2, winSize:64
I (7422) example_connect: Got IPv6 event: Interface "example_netif_sta" address: 2401:4900:7c80:39ac:7edf:a1ff:fe40:0148, type: ESP_IP6_ADDR_IS_GLOBAL
I (9152) wifi:<ba-add>idx:1 (ifx:0, ae:8d:40:42:92:1e), tid:4, ssn:0, winSize:64
I (9242) wolfssl_client: SNTP get time success
I (9242) wolfssl_client: Setting hostname for TLS session...
I (9852) wolfssl_client: Init wolfSSL...
I (9852) wolfssl_client: Set wolfSSL ctx ...
I (9852) wolfssl_client: Create socket ...
I (9852) wolfssl_client: Loading the CA root certificate...
I (9862) wolfssl_client: Connecting to api.github.com:443...
I (10382) wolfssl_client: Create wolfSSL...
I (10392) wolfssl_client: Performing the SSL/TLS handshake...
I (14262) wolfssl_client: Writing HTTPS request...
I (14272) wolfssl_client: Reading HTTPS response...
HTTP/1.1 200 OK
Date: Tue, 14 Jul 2026 06:18:18 GMT
Content-Type: text/plain;charset=utf-8
Content-Length: 19
x-github-api-version-selected: 2022-11-28
Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset, Warning
Access-Control-Allow-Origin: *
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Frame-Options: deny
X-Content-Type-Options: nosniff
X-XSS-Protection: 0
Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
Content-Security-Policy: default-src 'none'
Vary: Accept-Encoding, Accept, X-Requested-With
Server: github.com
Accept-Ranges: bytes
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 59
X-RateLimit-Used: 1
X-RateLimit-Resource: core
X-RateLimit-Reset: 1784013498
X-GitHub-Request-I
d: CDB3:2D331C:535496:5AD98B:6A55D4A6
connection: close

Accessible for all.
W (14972) wolfssl_client: Connection closed

[client loops; the next iterations also complete with HTTP/1.1 200 OK -- omitted for brevity]

@hrushikesh430
hrushikesh430 force-pushed the feature/add_idf_component_yml_and_server_key branch from 3b80797 to 6d3fd88 Compare July 14, 2026 06:40
@hrushikesh430 hrushikesh430 changed the title feat(esp-wolfssl): add idf_component.yml and support esp_key_config_t server key esp-wolfssl: esp_key_config_t server key support, ESP-IDF <6.0 build fix, and ESP_TLS_HAS_WOLFSSL macro Jul 14, 2026
@hrushikesh430

Copy link
Copy Markdown
Collaborator Author

Build log — ESP-IDF v5.5.4 (examples/wolfssl_client, ESP32-C3)

Demonstrates the <6.0 build fix: the component fails to build before the CMake change and builds after.

v5.5.4 build (before → after)
======================================================================
 esp-wolfssl on ESP-IDF v5.5.4  -  cross-version build check
 On ESP-IDF < 6.0 the esp-tls custom-stack API does not exist, so
 esp-wolfssl is used via the native wolfSSL API.
 Example : esp-wolfssl/examples/wolfssl_client     Target : ESP32-C3
 IDF     : v5.5.4        Toolchain : esp-14.2.0
======================================================================

----------------------------------------------------------------------
[BEFORE fix] build fails - port/esp_tls_wolfssl.c is compiled on <6.0
            and includes esp_tls_custom_stack.h (6.0+ only)
----------------------------------------------------------------------
-- Building ESP-IDF components for target esp32c3
-- Building ESP-IDF components for target esp32c3
FAILED: esp-idf/esp-wolfssl/CMakeFiles/__idf_esp-wolfssl.dir/port/esp_tls_wolfssl.c.obj 
/Users/hrushikesh/pro/esp-wolfssl/port/esp_tls_wolfssl.c:19:10: fatal error: esp_tls_custom_stack.h: No such file or directory
   19 | #include "esp_tls_custom_stack.h"
ninja: build stopped: subcommand failed.
ninja failed with exit code 1, output of the command is in the /Users/hrushikesh/pro/esp-wolfssl/examples/wolfssl_client/build_v55_c3/log/idf_py_stderr_output_72887 and /Users/hrushikesh/pro/esp-wolfssl/examples/wolfssl_client/build_v55_c3/log/idf_py_stdout_output_72887

----------------------------------------------------------------------
[AFTER fix] CMakeLists excludes port/esp_tls_wolfssl.c when
            CONFIG_ESP_TLS_CUSTOM_STACK is not set -> build succeeds
----------------------------------------------------------------------
-- Building ESP-IDF components for target esp32c3
Generated /Users/hrushikesh/pro/esp-wolfssl/examples/wolfssl_client/build_v55_c3/bootloader/bootloader.bin
Bootloader binary size 0x51e0 bytes. 0x2e20 bytes (36%) free.
Generated /Users/hrushikesh/pro/esp-wolfssl/examples/wolfssl_client/build_v55_c3/wolfssl.bin
wolfssl.bin binary size 0x117010 bytes. Smallest app partition is 0x177000 bytes. 0x5fff0 bytes (26%) free.
Project build complete. To flash, run:

@AdityaHPatwardhan

Copy link
Copy Markdown
Collaborator

Has this been tested on esp-idf v5.5, v6.0 and v6.1 ( master)

@hrushikesh430
hrushikesh430 force-pushed the feature/add_idf_component_yml_and_server_key branch from 6d3fd88 to 6d9a06e Compare July 14, 2026 08:09
@hrushikesh430

Copy link
Copy Markdown
Collaborator Author

More runtime/build logs

esp-wolfssl examples/https_request on ESP-IDF master (v6.2-dev), ESP32-C3 — full custom-stack run:

device serial (TLS 1.2 → HTTP 200)
======================================================================
 esp-wolfssl repo example: examples/https_request  (custom stack)
 ESP-IDF master (v6.2-dev)   Target: ESP32-C3   Backend: esp-wolfssl
 Result: custom stack registered -> Wi-Fi -> TLS 1.2 -> HTTP/1.1 200 OK
======================================================================

ESP-ROM:esp32c3-20200918
Build:Sep 18 2020
rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd5830,len:0x15b8
load:0x403cbf10,len:0xd04
load:0x403ce710,len:0x2ffc
entry 0x403cbf1a
I (30) boot: ESP-IDF v6.2-dev-1281-g6ef9a267f1b-dirt 2nd stage bootloader
I (30) boot: compile time Jul 14 2026 12:06:32
I (30) boot: chip revision: v0.0
I (32) boot: efuse block revision: v0.0
I (36) boot.esp32c3: SPI Speed      : 80MHz
I (40) boot.esp32c3: SPI Mode       : DIO
I (44) boot.esp32c3: SPI Flash Size : 2MB
I (47) boot: Enabling RNG early entropy source...
I (52) boot: Partition Table:
I (54) boot: ## Label            Usage          Type ST Offset   Length
I (61) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (67) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (74) boot:  2 factory          factory app      00 00 00010000 00177000
I (80) boot: End of partition table
I (84) esp_image: segment 0: paddr=00010020 vaddr=3c0e0020 size=2f22ch (193068) map
I (121) esp_image: segment 1: paddr=0003f254 vaddr=3fc91c00 size=00dc4h (  3524) load
I (122) esp_image: segment 2: paddr=00040020 vaddr=42000020 size=db0e8h (897256) map
I (265) esp_image: segment 3: paddr=0011b110 vaddr=3fc929c4 size=02730h ( 10032) load
I (267) esp_image: segment 4: paddr=0011d848 vaddr=40380000 size=11a28h ( 72232) load
I (282) esp_image: segment 5: paddr=0012f278 vaddr=50000000 size=00024h (    36) load
I (288) boot: Loaded app from partition at offset 0x10000
I (288) boot: Disabling RNG early entropy source...
I (301) cpu_start: Unicore app
I (309) cpu_start: GPIO 20 and 21 are used as console UART I/O pins
I (310) cpu_start: Pro cpu start user code
I (310) cpu_start: cpu freq: 160000000 Hz
I (312) app_init: Application information:
I (315) app_init: Project name:     https_request
I (320) app_init: App version:      4f20a1c-dirty
I (324) app_init: Compile time:     Jul 14 2026 12:06:38
I (329) app_init: ELF file SHA256:  641802f67...
I (334) app_init: ESP-IDF:          v6.2-dev-1281-g6ef9a267f1b-dirt
I (340) efuse_init: Min chip rev:     v0.0
I (343) efuse_init: Max chip rev:     v1.99 
I (347) efuse_init: Chip rev:         v0.0
I (351) heap_init: Initializing. RAM available for dynamic allocation:
I (358) heap_init: At 3FC9B0F0 len 00024F10 (147 KiB): RAM
I (363) heap_init: At 3FCC0000 len 0001C710 (113 KiB): Retention RAM
I (369) heap_init: At 3FCDC710 len 00002B50 (10 KiB): Retention RAM
I (375) heap_init: At 50000024 len 00001FC4 (7 KiB): RTCRAM
I (381) spi_flash: detected chip: generic
I (384) spi_flash: flash io: dio
W (387) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
W (399) eFuse: calibration efuse version does not match, set default version to 0
I (412) sleep_gpio: Configure to isolate all GPIO pins in sleep state
I (412) sleep_gpio: Enable automatic switching of GPIO sleep configuration
I (419) esp-tls-custom-stack: Custom TLS stack registered successfully
I (426) main_task: Started on CPU0
I (426) main_task: Calling app_main()
I (436) example_connect: Start example_connect.
I (436) pp: pp rom version: 8459080
I (436) net80211: net80211 rom version: 8459080
I (446) wifi:wifi driver task: 3fca368c, prio:23, stack:6656, core=0
I (446) wifi:wifi firmware version: 65f9dd7
I (456) wifi:wifi certification version: v7.0
I (456) wifi:config NVS flash: enabled
I (456) wifi:config nano formatting: disabled
I (456) wifi:Init data frame dynamic rx buffer num: 32
I (466) wifi:Init static rx mgmt buffer num: 5
I (466) wifi:Init management short buffer num: 32
I (476) wifi:Init dynamic tx buffer num: 32
I (476) wifi:Init static tx FG buffer num: 2
I (486) wifi:Init static rx buffer size: 1600
I (486) wifi:Init static rx buffer num: 10
I (486) wifi:Init dynamic rx buffer num: 32
I (496) wifi_init: rx ba win: 6
I (496) wifi_init: accept mbox: 6
I (496) wifi_init: tcpip mbox: 32
I (506) wifi_init: udp mbox: 6
I (506) wifi_init: tcp mbox: 6
I (506) wifi_init: tcp tx win: 5760
I (516) wifi_init: tcp rx win: 5760
I (516) wifi_init: tcp mss: 1440
I (516) wifi_init: WiFi IRAM OP enabled
I (516) wifi_init: WiFi RX IRAM OP enabled
I (526) phy_init: phy_version 1235,8bd8c6fc,Apr 13 2026,18:46:20
I (576) wifi:mode : sta (7c:df:a1:40:01:48)
I (576) wifi:enable tsf
I (576) example_connect: Connecting to Pixel...
W (576) wifi:Password length matches WPA2 standards, authmode threshold changes from OPEN to WPA2
I (586) example_connect: Waiting for IP(s)
I (2996) wifi:new:<11,0>, old:<1,0>, ap:<255,255>, sta:<11,0>, prof:1, snd_ch_cfg:0x0
I (2996) wifi:state: init -> auth (0xb0)
I (3506) wifi:state: auth -> assoc (0x0)
I (3506) wifi:Association refused temporarily time 1269, comeback time 1369 (TUs)
I (4916) wifi:state: assoc -> auth (0xb0)
I (5436) wifi:state: auth -> assoc (0x0)
I (5516) wifi:state: assoc -> run (0x10)
I (5546) wifi:connected with Pixel, aid = 1, channel 11, BW20, bssid = ae:8d:40:42:92:1e
I (5546) wifi:security: WPA3-SAE HUNT_AND_PECK, phy: bgn, rssi: -30, cipher(pairwise:0x3, group:0x3), pmf:1
I (5556) wifi:pm start, type: 1

I (5556) wifi:dp: 1, bi: 102400, li: 3, scale listen interval from 307200 us to 307200 us
I (5566) wifi:set rx beacon pti, rx_bcn_pti: 0, bcn_timeout: 25000, mt_pti: 0, mt_time: 10000
I (5616) wifi:dp: 2, bi: 102400, li: 4, scale listen interval from 307200 us to 409600 us
I (5616) wifi:AP's beacon interval = 102400 us, DTIM period = 2
I (6746) esp_netif_handlers: example_netif_sta ip: 10.111.110.133, mask: 255.255.255.0, gw: 10.111.110.204
I (6746) example_connect: Got IPv4 event: Interface "example_netif_sta" address: 10.111.110.133
I (7436) example_connect: Got IPv6 event: Interface "example_netif_sta" address: fe80:0000:0000:0000:7edf:a1ff:fe40:0148, type: ESP_IP6_ADDR_IS_LINK_LOCAL
I (7436) example_common: Connected to example_netif_sta
I (7436) example_common: - IPv4 address: 10.111.110.133,
I (7446) example_common: - IPv6 address: fe80:0000:0000:0000:7edf:a1ff:fe40:0148, type: ESP_IP6_ADDR_IS_LINK_LOCAL
I (7456) example: Updating time from NVS
I (7456) example: Start https_request example
I (7466) example: Minimum free heap size: 209568 bytes
I (7466) example: https_request using cacert_buf
I (7476) main_task: Returned from app_main()
I (8486) wifi:<ba-add>idx:0 (ifx:0, ae:8d:40:42:92:1e), tid:0, ssn:22, winSize:64
I (11436) example_connect: Got IPv6 event: Interface "example_netif_sta" address: 2401:4900:7c80:39ac:7edf:a1ff:fe40:0148, type: ESP_IP6_ADDR_IS_GLOBAL
I (14226) example: Connection established...
I (14226) example: 81 bytes written
I (14226) example: Reading HTTP response...
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Connection: close
Content-Length: 1135
Content-Type: application/json
Strict-Transport-Security: max-age=631138519; includeSubdomains; preload
Vary: Accept-Encoding
Date: Tue, 14 Jul 2026 06:54:07 GMT

{"given_cipher_suites":["TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384","TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256","TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384","TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256","TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256","TLS_ECDHE_ECDSA_WITH_AES
_128_CBC_SHA256","TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384","TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384","TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA","TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA","TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA","TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA"],"given_named_groups":["secp521r1","secp384r1","secp256r1","x25519","secp224r1"],"given_signature_algorithms":["ecdsa_secp521r1_sha512","ecdsa_secp384r1_sha384","ecdsa_secp256r1_sha256","ed25519","rsa_pss_rsae_sha512","rsa_pss_rsae_sha384","rsa_pss_rsae_sha256
","rsa_pkcs1_sha512","rsa_pkcs1_sha384","rsa_pkcs1_sha256"],"post_quantum_key_agreement":false,"ephemeral_keys_supported":true,"session_ticket_supported":fal
se,"tls_compression_supported":false,"unknown_cipher_suite_supported":false,"beast_vuln":false,"able_to_detect_n_minus_one_splitting":false,"insecure_cipher_suites":{},"tls_version":"TLS 1.2","rating":"Improvable"}
I (15166) example: connection closed
I (15176) example: 10...
I (16176) example: 9...
I (17176) example: 8...
I (18176) example: 7...
I (19176) example: 6...
I (20176) example: 5...
I (21176) example: 4...
I (22176) example: 3...
I (23176) example: 2...
I (24176) example: 1...
I (25176) example: 0...
I (26176) example: https_request using global ca_store
I (33286) example: Connection established...
I (33296) example: 81 bytes written
I (33296) example: Reading HTTP response...

ESP-IDF v6.0.1 (ESP32-C3) — both esp-idf examples build + wolfSSL registers as the custom stack (also confirms the __has_include guard on v6.0.1, where esp_key_config.h is absent):

v6.0.1 build + registration
======================================================================
 esp-idf examples + esp-wolfssl (custom stack) on ESP-IDF v6.0.1  (ESP32-C3)
 Both examples BUILD on v6.0.1 and wolfSSL registers as the esp-tls custom
 stack. The full HTTP request wasn't captured on 6.0 because the local Pixel
 hotspot dropped mid-run (Wi-Fi reason 201); the equivalent 6.x runtime
 (HTTP 200) is in the master (v6.2-dev) logs.
 NOTE: this also validates the fixes build on 6.0.1 -- esp_key_config.h is
       absent there, so the __has_include guard correctly excludes server_key.
======================================================================

----- examples/protocols/https_request -----
build: Project build complete. To flash, run:
I (333) app_init: ESP-IDF:          v6.0.1-dirty
I (417) esp-tls-custom-stack: Custom TLS stack registered successfully

----- examples/protocols/https_server/simple -----
build: Project build complete. To flash, run:
I (336) app_init: ESP-IDF:          v6.0.1-dirty
I (419) esp-tls-custom-stack: Custom TLS stack registered successfully

@hrushikesh430

Copy link
Copy Markdown
Collaborator Author

ESP-IDF v6.0.1 runtime (ESP32) — both examples, HTTP 200

Now captured end-to-end on ESP-IDF v6.0.1 (ESP32, esp-wolfssl custom stack):

examples/protocols/https_request — device serial (TLS 1.2 → HTTP 200)
======================================================================
 esp-idf examples/protocols/https_request on ESP-IDF v6.0.1 (ESP32)
 Backend: esp-wolfssl (CONFIG_ESP_TLS_CUSTOM_STACK=y)
 Result: custom stack registered -> Wi-Fi (ESP_India2.4) -> TLS 1.2 -> HTTP 200
======================================================================

ets Jul 29 2019 12:21:46

rst:0x1 (POWERON_RESET),boot:0x12 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0040,len:6272
load:0x40078000,len:15848
load:0x40080400,len:3920
entry 0x40080644
I (27) boot: ESP-IDF v6.0.1-dirty 2nd stage bootloader
I (27) boot: compile time Jul 14 2026 14:04:03
I (28) boot: Multicore bootloader
I (29) boot: chip revision: v3.1
I (32) boot.esp32: SPI Speed      : 40MHz
I (36) boot.esp32: SPI Mode       : DIO
I (39) boot.esp32: SPI Flash Size : 2MB
I (43) boot: Enabling RNG early entropy source...
I (47) boot: Partition Table:
I (50) boot: ## Label            Usage          Type ST Offset   Length
I (56) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (63) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (69) boot:  2 factory          factory app      00 00 00010000 00177000
I (76) boot: End of partition table
I (79) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=26db8h (159160) map
I (143) esp_image: segment 1: paddr=00036de0 vaddr=3ffb0000 size=045c8h ( 17864) load
I (151) esp_image: segment 2: paddr=0003b3b0 vaddr=40080000 size=04c68h ( 19560) load
I (159) esp_image: segment 3: paddr=00040020 vaddr=400d0020 size=c2030h (794672) map
I (442) esp_image: segment 4: paddr=00102058 vaddr=40084c68 size=10a14h ( 68116) load
I (470) esp_image: segment 5: paddr=00112a74 vaddr=50000000 size=00028h (    40) load
I (481) boot: Loaded app from partition at offset 0x10000
I (481) boot: Disabling RNG early entropy source...
I (492) cpu_start: Multicore app
I (500) cpu_start: GPIO 3 and 1 are used as console UART I/O pins
I (500) cpu_start: Pro cpu start user code
I (500) cpu_start: cpu freq: 160000000 Hz
I (502) app_init: Application information:
I (506) app_init: Project name:     https_request
I (510) app_init: App version:      v6.0.1-dirty
I (515) app_init: Compile time:     Jul 14 2026 14:19:02
I (520) app_init: ELF file SHA256:  77f472071...
I (524) app_init: ESP-IDF:          v6.0.1-dirty
I (528) efuse_init: Min chip rev:     v0.0
I (532) efuse_init: Max chip rev:     v3.99 
I (536) efuse_init: Chip rev:         v3.1
I (540) heap_init: Initializing. RAM available for dynamic allocation:
I (547) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (552) heap_init: At 3FFBA1D0 len 00025E30 (151 KiB): DRAM
I (557) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (562) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (568) heap_init: At 4009567C len 0000A984 (42 KiB): IRAM
I (574) spi_flash: detected chip: generic
I (577) spi_flash: flash io: dio
W (580) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (593) esp-tls-custom-stack: Custom TLS stack registered successfully
I (599) main_task: Started on CPU0
I (609) main_task: Calling app_main()
I (619) example_connect: Start example_connect.
I (629) wifi:wifi driver task: 3ffc187c, prio:23, stack:6656, core=0
I (629) wifi:wifi firmware version: b37c951
I (629) wifi:wifi certification version: v7.0
I (629) wifi:config NVS flash: enabled
I (629) wifi:config nano formatting: disabled
I (639) wifi:Init data frame dynamic rx buffer num: 32
I (639) wifi:Init static rx mgmt buffer num: 5
I (649) wifi:Init management short buffer num: 32
I (649) wifi:Init dynamic tx buffer num: 32
I (659) wifi:Init static rx buffer size: 1600
I (659) wifi:Init static rx buffer num: 10
I (659) wifi:Init dynamic rx buffer num: 32
I (669) wifi_init: rx ba win: 6
I (669) wifi_init: accept mbox: 6
I (669) wifi_init: tcpip mbox: 32
I (679) wifi_init: udp mbox: 6
I (679) wifi_init: tcp mbox: 6
I (679) wifi_init: tcp tx win: 5760
I (689) wifi_init: tcp rx win: 5760
I (689) wifi_init: tcp mss: 1440
I (689) wifi_init: WiFi IRAM OP enabled
I (699) wifi_init: WiFi RX IRAM OP enabled
I (699) phy_init: phy_version 4863,a3a4459,Oct 28 2025,14:30:06
I (789) wifi:mode : sta (34:5f:45:3e:19:74)
I (789) wifi:enable tsf
I (789) example_connect: Connecting to ESP_India2.4...
W (789) wifi:Password length matches WPA2 standards, authmode threshold changes from OPEN to WPA2
I (799) example_connect: Waiting for IP(s)
I (3219) wifi:new:<1,0>, old:<1,0>, ap:<255,255>, sta:<1,0>, prof:1, snd_ch_cfg:0x0
I (3219) wifi:state: init -> auth (0xb0)
I (4449) wifi:state: auth -> assoc (0x0)
I (4529) wifi:state: assoc -> run (0x10)
I (4589) wifi:connected with ESP_India2.4, aid = 3, channel 1, BW20, bssid = 04:01:a1:13:cd:e0
I (4589) wifi:security: WPA3-SAE H2E, phy: bgn, rssi: -40, cipher(pairwise:0x3, group:0x3), pmf:1
I (4599) wifi:pm start, type: 1

I (4599) wifi:dp: 1, bi: 102400, li: 3, scale listen interval from 307200 us to 307200 us
I (4619) wifi:AP's beacon interval = 102400 us, DTIM period = 1
I (4929) wifi:<ba-add>idx:0 (ifx:0, 04:01:a1:13:cd:e0), tid:0, ssn:0, winSize:64
I (4929) wifi:<ba-add>idx:1 (ifx:0, 04:01:a1:13:cd:e0), tid:6, ssn:2, winSize:64
I (5619) example_connect: Got IPv6 event: Interface "example_netif_sta" address: fe80:0000:0000:0000:365f:45ff:fe3e:1974, type: ESP_IP6_ADDR_IS_LINK_LOCAL
I (5969) esp_netif_handlers: example_netif_sta ip: 192.168.20.178, mask: 255.255.254.0, gw: 192.168.20.1
I (5969) example_connect: Got IPv4 event: Interface "example_netif_sta" address: 192.168.20.178
I (5969) example_common: Connected to example_netif_sta
I (5979) example_common: - IPv4 address: 192.168.20.178,
I (5979) example_common: - IPv6 address: fe80:0000:0000:0000:365f:45ff:fe3e:1974, type: ESP_IP6_ADDR_IS_LINK_LOCAL
I (5989) example: Updating time from NVS
I (5999) time_sync: Time not found in NVS. Syncing time from SNTP server.
I (5999) time_sync: Initializing SNTP
I (7619) example_connect: Got IPv6 event: Interface "example_netif_sta" address: fdc7:dc07:ac53:9275:365f:45ff:fe3e:1974, type: ESP_IP6_ADDR_IS_UNIQUE_LOCAL
I (8009) time_sync: Waiting for system time to be set... (1/10)
I (10009) time_sync: Waiting for system time to be set... (2/10)
I (10599) time_sync: Updated time in NVS
I (10599) example: Start https_request example
I (10599) example: Minimum free heap size: 212436 bytes
I (10599) example: https_request using cacert_buf
I (10599) main_task: Returned from app_main()
I (17119) example: Connection established...
I (17129) example: 102 bytes written
I (17129) example: Reading HTTP response...
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *

examples/protocols/https_server/simple — device + curl (mutual-TLS → HTTP 200 "Hello Secure World!")
======================================================================
 esp-idf examples/protocols/https_server/simple on ESP-IDF v6.0.1 (ESP32)
 Backend: esp-wolfssl (CONFIG_ESP_TLS_CUSTOM_STACK=y)
 Result: custom stack registered -> Wi-Fi (ESP_India2.4) -> server :443
         -> mutual-TLS handshake -> HTTP 200 'Hello Secure World!'
======================================================================

----- Device serial (ESP32): boot, registration, Wi-Fi, server start -----
I (528) app_init: ESP-IDF:          v6.0.1-dirty
I (597) esp-tls-custom-stack: Custom TLS stack registered successfully
I (17403) wifi:connected with ESP_India2.4, aid = 1, channel 6, BW20, bssid = 04:01:a1:13:be:20
I (22033) esp_https_server: Server listening on port 443
I (22033) esp_netif_handlers: example_netif_sta ip: 192.168.20.178, mask: 255.255.254.0, gw: 192.168.20.1

----- Host client: curl --cert client_cert.pem --key client_key.pem (mutual TLS) -----
*   Trying 192.168.20.178:443...
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384 / [blank] / UNDEF
*  subject: C=SG; ST=SG; L=SG; O=ESP32; CN=ESP32 HTTPS Server
*  start date: Oct 10 02:39:00 2025 GMT
*  expire date: Oct  8 02:39:00 2035 GMT
*  issuer: CN=ESP32 HTTPS server example
> GET / HTTP/1.1
> Host: 192.168.20.178
< HTTP/1.1 200 OK
<h1>Hello Secure World!</h1>

… client paths

esp_https_server / esp_tls (and their examples) pass the private key via the
unified esp_key_config_t (cfg->server_key / cfg->client_key) instead of the
legacy serverkey_buf / clientkey_buf on newer ESP-IDF. Accept the unified key
config (ESP_KEY_SOURCE_BUFFER) as a fallback on both the server and client
paths. The interface was added to esp-tls after v6.0, so it is detected via
__has_include("esp_key_config.h") to keep building on v6.0 and earlier (which
only have the *_buf fields).
port/esp_tls_wolfssl.c includes esp_tls_custom_stack.h, which only exists in
ESP-IDF v6.0+. Exclude it from the sources when CONFIG_ESP_TLS_CUSTOM_STACK is
unset, so the component still builds on v5.5 and earlier (native wolfSSL API).
Lets application code feature-detect the wolfSSL backend with
#ifdef ESP_TLS_HAS_WOLFSSL, mirroring the macro ESP-IDF defined when wolfSSL was
a built-in esp-tls backend. Migrated from esp-idf#17682 (supersedes PR espressif#29).
The component is consumed by cloning it and adding a path-based dependency;
remove the IDF Component Registry / add-dependency instructions.
@hrushikesh430
hrushikesh430 force-pushed the feature/add_idf_component_yml_and_server_key branch from 6d9a06e to 8fe8b0c Compare July 14, 2026 09:24
@hrushikesh430
hrushikesh430 marked this pull request as ready for review July 14, 2026 09:37
@hrushikesh430

Copy link
Copy Markdown
Collaborator Author

@AdityaHPatwardhan PTAL

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.

2 participants