Commit Graph

53288 Commits

Author SHA1 Message Date
Chen Chen
0fbbcd7271 fix: update flash encryption mock build check
Use a non-deprecated bootloader support API in the mock build test.
Keep the test focused on validating the generated bootloader support mock.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-14 17:30:29 +08:00
Vincent Hamp
9980a9f53a fix(mocks): add missing esp_hal_* includes 2026-07-14 17:30:29 +08:00
Mahavir Jain
41582e1777 Merge branch 'ci/fix_esp_tee_cli_app_build_v6.1' into 'release/v6.1'
ci(esp_tee): Fix `tee_cli_app` build failure due to heap size overflow (v6.1)

See merge request espressif/esp-idf!50613
2026-07-10 11:56:40 +05:30
Laukik Hase
87a5664883 ci(esp_tee): Fix tee_cli_app build failure due to heap size overflow
- Also fix the `unused variable` warning while builing the PSA
  AES tests with `tee_test_fw` app
2026-07-10 10:30:02 +05:30
Mahavir Jain
33217d154f Merge branch 'fix/esp_http_client_header_buffer_too_small_v6.1' into 'release/v6.1'
feat(esp_http_client): detect oversized headers in tx buffer at send site (v6.1)

See merge request espressif/esp-idf!50313
2026-07-10 09:41:40 +05:30
Mahavir Jain
5288101bdc Merge branch 'fix/harden_esp_security_v6.1' into 'release/v6.1'
fix(esp_security): harden crypto peripheral error handling (v6.1)

See merge request espressif/esp-idf!50324
2026-07-10 09:39:59 +05:30
Mahavir Jain
f0fbd9d9fa Merge branch 'fix/tls1_3_dynamic_buffer_server_crash_v6.1' into 'release/v6.1'
fix(mbedtls): fixes TLS1.3 server failing with dynamic buffer (v6.1)

See merge request espressif/esp-idf!50386
2026-07-10 09:38:26 +05:30
Mahavir Jain
6fa5704eda Merge branch 'feat/enable_aes_gcm_support_for_esp32s31_v6.1' into 'release/v6.1'
feat: enable AES GCM support for ESP32-S31 (v6.1)

See merge request espressif/esp-idf!50399
2026-07-09 12:29:16 +05:30
Mahavir Jain
9a567fbb87 Merge branch 'feat/update_documentation_and_cleanup_for_esp32h4_v6.1' into 'release/v6.1'
Feat/update documentation and cleanup for esp32h4 (v6.1)

See merge request espressif/esp-idf!50398
2026-07-09 12:02:43 +05:30
Mahavir Jain
eda926af1c Merge branch 'fix/fix_esp_tee_failing_deterministic_ecdsa_sign_v6.1' into 'release/v6.1'
fix(esp_tee): release SHA held by HMAC after crypto peripheral reset (v6.1)

See merge request espressif/esp-idf!50317
2026-07-09 11:52:38 +05:30
Mahavir Jain
ab92370b33 Merge branch 'fix/revert_redundant_rom_pmp_18769_v6.1' into 'release/v6.1'
revert(esp_hw_support): Re-add separate D-ROM PMP entry on C6/H2 (v6.1)

See merge request espressif/esp-idf!50359
2026-07-09 11:52:14 +05:30
Ashish Sharma
1041b69131 feat(esp_http_client): detect oversized headers in tx buffer while sending request 2026-07-07 18:22:08 +08:00
nilesh.kale
c9e90831b8 feat: enable AES GCM support for ESP32-S31 2026-07-06 15:08:38 +05:30
nilesh.kale
7cb0e4c70a feat: added call to aquire clock source for H4 and H21 AES crypto 2026-07-06 15:08:02 +05:30
nilesh.kale
6cf7191e1d feat: update docs for ESP32H4 security chapters 2026-07-06 15:08:02 +05:30
Jiang Jiang Jian
76f1151d72 Merge branch 'fix/ble-log-64-bit-io-setup-support_v6.1' into 'release/v6.1'
fix(ble_log): use BIT64 over BIT to support 64-bit IO setup (6.1)

See merge request espressif/esp-idf!50332
2026-07-06 15:51:27 +08:00
Jiang Jiang Jian
264bc73875 Merge branch 'bugfix/fix_ble_chan_compilation_issue_v6.1' into 'release/v6.1'
fix(nimble): Fix ble_chan_sound_reflector compilation issue (v6.1)

See merge request espressif/esp-idf!50363
2026-07-06 15:51:18 +08:00
Ashish Sharma
8ca83a0fa9 fix(mbedtls): fixes TLS1.3 server failing with dynamic buffer 2026-07-06 15:18:23 +08:00
Rahul Tank
e44969a390 fix(nimble): Fix ble_chan_sound_reflector compilation issue 2026-07-06 07:52:43 +05:30
Jiang Jiang Jian
169aded5b1 Merge branch 'fix/backport_nan_fixes_v6.1' into 'release/v6.1'
Backport NAN features and a few fixes to v6.1 (Backport v6.1)

See merge request espressif/esp-idf!50349
2026-07-04 01:03:16 +08:00
Nachiket Kukade
02da1d5807 feat(lwip): Add IPv6 static neighbor cache entry support
Add esp_netif_add_static_neighbor() and esp_netif_remove_static_neighbor(),
gated by CONFIG_LWIP_ND6_SUPPORT_STATIC_ENTRIES. These API's let callers
install/remove permanent IPv6->MAC mappings that bypass Neighbor Discovery
(no NS/NA). The calls run in the TCP/IP context and wrap the underlying lwIP
nd6_add_static_neighbor()/nd6_remove_static_neighbor() functions.
2026-07-04 00:05:20 +08:00
Sarvesh Bodakhe
1b59e8a526 refactor(wifi): astyle-format wifi_netif.c
The ternary continuation in esp_wifi_netif_set_static_neighbor() was not
astyle-formatted; re-indent it so the pre-commit astyle hook passes in CI.
2026-07-04 00:05:20 +08:00
Sarvesh Bodakhe
24b2c12490 refactor(nan): drop '##' debug marker from key hexdump tags
The six key-material hexdumps (ND-IGTK/BIGTK/TK/GTK and the peer IGTK/BIGTK)
kept a leftover '##' dev-grep marker on their tag string. Drop it; the
descriptive labels stay and the dumps remain at ESP_LOG_DEBUG.
2026-07-04 00:05:20 +08:00
Sarvesh Bodakhe
b13c9880cc change(wifi): sync NAN/netif wifi headers + rebuilt libs [d3da506]
- injected esp_wifi_netif.h: add esp_wifi_netif_get_ip6_linklocal_from_mac()
  and esp_wifi_netif_set_static_neighbor() (static ND6 IPv6-pin API).
- esp_wifi_types_generic.h (public + injected): rename the NCS-GTK cipher
  suites CCM_128 -> CCMP_128 / GCM_256 -> GCMP_256 to match Wi-Fi Aware v4.0
  (Table 121, section 9.5.21.1); refresh NAN group-protection docs. Enum
  values (5/6), struct layout and on-air behaviour are unchanged.
- nan_security.c: use the renamed macros and update the advertise log.
- esp_wifi/lib: bump to the rebuilt blobs carrying the renamed MD5-checked
  header (han2 d3da506).
2026-07-04 00:05:20 +08:00
Sarvesh Bodakhe
8a1ff4f9ff fix(nan): restrict GTK Key ID to 1/2 and ignore cleartext group KDEs
- Tighten the own GTK Key ID guard from ">3" (which admitted 0 and 3) to
  the spec range 1..2 (Wi-Fi Aware v4.0 §7.1.3.2).
- When the Encrypted-Key-Data bit is clear, ignore the Key Data instead of
  parsing KDEs from the clear: group KDEs are only ever carried KEK-wrapped
  (§7.1.3.5; 802.11-2020 §12.7.2). Also store the peer IPN/BIPN from the
  IGTK/BIGTK KDEs for the BIP RX replay-counter seed.
2026-07-04 00:05:20 +08:00
Sarvesh Bodakhe
7f287f6288 fix(nan): seed peer BIP RX replay counter from the KDE IPN/BIPN
The peer IGTK/BIGTK were installed with an all-zero seq, so the blob's BIP
RX replay counter started at 0 instead of the peer's advertised value. Store
the 6-octet IPN/BIPN from the IGTK/BIGTK KDE (the octets after the 2-byte
Key ID, per 802.11 Fig 12-42/12-47) into the NDL and pass them as the
install seq. The parser side of this lands with the group-KDE guards.
2026-07-04 00:05:20 +08:00
Sarvesh Bodakhe
52cc89a299 change(wifi): update libs [2e77d2e]
Rebuilt libs with NAN group-key (GTK/IGTK/BIGTK) support, matching the
nan_key_type_t and group-protection header updates so the MD5-checked
esp_wifi_driver.h and esp_wifi_types_generic.h verify.
2026-07-04 00:05:20 +08:00
Sarvesh Bodakhe
b7cc272074 docs(nan): document group-protection fields, CSID ciphers and NIRA
Refresh stale/missing documentation now that the features are implemented:
- group_data_prot / group_mgmt_prot in wifi_nan_discovery_security_params_t
  (esp_wifi_types_generic.h) and wifi_nan_security_params_t (esp_private/
  wifi.h): describe GTKSA / IGTKSA+BIGTKSA instead of "not supported".
- CSID enum: document NCS-GTK-CCM-128 (set internally via group_data_prot,
  not user-selectable) and NCS-PK-PASN-128 (NAN Pairing, via the Wi-Fi
  Aware component).
- Drop "dummy" from the esp_nan_construct_nira() doc (it builds a real
  NIRA) and a stale "IGTK/BIGTK are placeholders" comment.
2026-07-04 00:05:20 +08:00
Sarvesh Bodakhe
d8c5ce149d refactor(nan): use shared nan_key_type_t from esp_wifi_driver.h
The NAN key-type selectors are defined by the blob in esp_wifi_driver.h
(nan_key_type_t), which nan_i.h already includes. Add the group-integrity
key types NAN_KEY_ND_IGTK (3) and NAN_KEY_ND_BIGTK (4) there to match the
blob, and drop the duplicate host definitions from nan_i.h so a single
shared enum is used. Resolves the review request to declare these in
nan_key_type_t and avoids redefining the typedef.
2026-07-04 00:05:20 +08:00
Sarvesh Bodakhe
77a3bbe029 refactor(nan): declare NAN key types as nan_key_type_t enum
Move the NAN_KEY_ND_TK/ND_GTK/NM_TK/ND_IGTK/ND_BIGTK selectors from #defines
into a nan_key_type_t enum, and finalize their doc wording (drop the
"provisional" note now that the IGTK/BIGTK values are verified against the
blob ABI). They are still passed to esp_wifi_set_nan_key_internal() as the
int key_flag argument, so no call-site or ABI change. Also tidy the
surrounding doc comments.
2026-07-04 00:05:20 +08:00
Sarvesh Bodakhe
23f7bf021c refactor(nan): put RSN KDE OUI in one array, drop dead OUI byte macros
Replace the three NAN_KDE_OUI_RSN_* byte writes in nan_kde_put_hdr() with a
single nan_kde_rsn_oui[] array, and remove the now-unused NAN_KDE_OUI_RSN_*
byte macros and the never-used NAN_KDE_OUI_WFA_* byte macros. The combined
NAN_KDE_OUI_RSN / NAN_KDE_OUI_WFA (used by the KDE parser) are kept.
2026-07-04 00:05:20 +08:00
Sarvesh Bodakhe
2d1b163e5e refactor(nan): drop commented-out debug logging
Remove the dead commented-out ESP_LOGI debug prints flagged in review: the
"Sent Publish to Peer" line in nan_app.c, and the SCIA-construct,
CSIA-construct and CSIA-len-getter blocks in nan_security.c.
2026-07-04 00:05:20 +08:00
Sarvesh Bodakhe
461d9231d3 fix(nan): pass no event payload to NAN netif bring-up action
The NAN-started handler brought the netif up via esp_netif_action_connected()
using the NAN-started event's base/event_id/data. Feeding a "connected"
action from a "started" event and handing it an unrelated event payload is
fragile: it would misbehave if the action handler ever interpreted data
(which is not a wifi_event_sta_connected_t here).

esp_netif_up() is private to the esp_netif component, so keep the public
esp_netif_action_connected() but pass NULL base, 0 event_id, NULL data. This
is safe because the NAN netif is not a DHCP client: the handler only calls
esp_netif_up() and never reads the event args.
2026-07-04 00:05:20 +08:00
Sarvesh Bodakhe
07892c59db fix(nan): restore SCIA length getter debug log
The MR had turned the active ESP_LOGD("GET SCIA LEN") into a commented-out
ESP_LOGI. Restore the original ESP_LOGD so the log stays live at DEBUG and
no dead commented code is left behind.
2026-07-04 00:05:20 +08:00
Sarvesh Bodakhe
9325ffbea0 fix(nan): source group_mgmt_prot from start config, not blob read-back
esp_nan_action_start() read group_mgmt_prot back from the blob via
esp_wifi_get_config() and defaulted to true when the read failed, which
force-enabled device-global IGTK/BIGTK (BIP beacons, forced GTKSA) on a
path where the user's intent is unknown. group_mgmt_prot is a pure
pass-through user flag, so capture it directly into s_nan_ctx from the
config in esp_wifi_nan_sync_start() (next to use_nvs_for_caching) and drop
the read-back and its ambiguous default. Behaviour now follows the user's
config exactly (default false via WIFI_NAN_SYNC_CONFIG_DEFAULT).
2026-07-04 00:05:20 +08:00
Sarvesh Bodakhe
a08ad13fd1 fix(nan): set group_mgmt_prot in WIFI_NAN_SYNC_CONFIG_DEFAULT
The default initializer explicitly sets every other bool field but omitted
the new group_mgmt_prot, leaving the intended default ambiguous. Set it to
false so the macro stays exhaustive; both example apps use it.
2026-07-04 00:05:20 +08:00
Sarvesh Bodakhe
96a421e851 fix(nan): clear group keys on NAN stop and peer NDP teardown
Fix group-key lifecycle gaps on the secured NDP path:

- On NAN stop, reset the device-global IGTK/BIGTK state via new
  nan_security_reset_own_group_keys() so the next start regenerates fresh
  keys. Previously the one-shot nan_ensure_own_igtk/bigtk kept own_*_set,
  so restart re-installed the stale key with IPN/BIPN=0, resetting the
  blob's monotonic replay counter (and reusing keys if the NMI changed).

- On peer teardown (nan_app_clear_one_peer_tks), remove the peer RX
  IGTK/BIGTK from the blob (they were installed against the peer NMI at
  NDP confirm) and scrub ndl->igtk/bigtk + flags. Previously only the GTK
  was removed, leaving stale BIP keys installed and key bytes in memory.

- Copy the GTK Key RSC into the descriptor only when a GTK KDE is present,
  matching the comment and avoiding stale RSC on an IGTK/BIGTK-only path.
2026-07-04 00:05:20 +08:00
Sarvesh Bodakhe
c64ec928f4 fix(nan): scrub group keys from stack, demote key hexdumps to DEBUG
Harden group-key material handling on the secured NDP path:

- Zero the stack buffers that hold plaintext/decrypted group keys before
  they leave scope: pad in nan_kek_wrap_key_data, plain in
  nan_append_own_group_kdes (single-exit cleanup), and the decrypted plain
  in esp_nan_parse_ndp_key_desc. Mirrors the existing forced_memzero(pmk)
  scrubs so GTK/IGTK/BIGTK bytes do not persist on the stack.

- Demote the ND-TK / GTK / IGTK / BIGTK ESP_LOG_BUFFER_HEXDUMP calls (own
  keys in nan_security.c, pairwise and peer keys in nan_app.c) from
  ESP_LOG_INFO to ESP_LOG_DEBUG so raw key bytes are not printed at the
  default log level.
2026-07-04 00:05:20 +08:00
Sarvesh Bodakhe
f50ba727d1 fix(nan): detect ND-TK install failure at NDP confirm
The ND-TK (pairwise data key) install return value was overwritten by the
subsequent NM-TK install before being checked, so an ND-TK failure went
undetected: the NDP was marked accepted and NDP_CONFIRM posted while
unicast data frames had no encryption key installed. Check ND-TK first
and tear down on failure, then install and check NM-TK separately.
2026-07-04 00:05:20 +08:00
Sarvesh Bodakhe
f2cf9d7486 fix(nan): free NDL slot and deny peer when get_mac fails on NDP resp
The NDP indication handler recorded an NDL slot, then on esp_wifi_get_mac
failure unlocked and returned without releasing the slot or answering the
peer: the slot leaked (counting against the NDL limit) and the peer waited
indefinitely. On failure now reset the NDL and send a deny response,
mirroring the existing allocation-failure cleanup path.

Also drop the redundant pre-branch get_mac/IPv6-derive: its result was
only used on the auto-response path, which recomputes it, so on the
indication path it was dead work and a second leak site.
2026-07-04 00:05:20 +08:00
Sarvesh Bodakhe
12a3342415 fix(wifi): sync wifi-remote injected header for NAN group_mgmt_prot 2026-07-04 00:05:20 +08:00
Sarvesh Bodakhe
added3a060 feat(nan): pin datapath IPv6 neighbor via esp_netif static entry
- Add esp_wifi_netif_set_static_neighbor() that to add/remove IPv6
  static entry using netif API to skip Neighbor Discovery Protocol
- Move the fe80::/64 + EUI-64 derivation to esp_wifi_netif.c
2026-07-04 00:05:20 +08:00
Sarvesh Bodakhe
310b3d6571 feat(wifi): add NAN group data and management frame protection
Add Wi-Fi Aware group-key support to secured NDPs so group-addressed
traffic can be protected, for interop with iOS/macOS peers:

- GTK (NCS-GTK-CCM-128) protects group-addressed data.
- IGTK/BIGTK (BIP) protect group management traffic - multicast SDFs,
  Beacons.

Capabilities are advertised in the CSIA IE: group_data_prot maps to GTKSA,
group_mgmt_prot to IGTKSA/BIGTKSA. The CSIA cannot encode IGTK/BIGTK
without GTK (WiFi Aware spec 9.5.21.2, Table 122), so enabling group_mgmt_prot
forces group_data_prot on for every secured service.

Expose per-service group_data_prot and device-global group_mgmt_prot.
2026-07-04 00:05:20 +08:00
akshat
cd16349be9 bugfix(wifi): Clear Sta TX queue to prevent key 2 send failure
Also, Ensure correct return values for key 2 and key 4.
2026-07-04 00:05:20 +08:00
Nachiket Kukade
3d30b471c6 bugfix(nan): Fix hard/soft reset cases in NAN Pairing verification
- Update pairing complete API to record for peer
- Terminate NAN Datapaths using publish_id after receiving PASN M1
2026-07-04 00:05:20 +08:00
Sajia
bf5907d066 feat(nan): Add support for NAN Pairing Verification
- Add nira attr and verification for pasn auth frames
- Refine key clearing and pairing complete logic for pasn verify
- Add NIRA own-service resolution, cached NIK checks, and dynamic
  pairing IE construction for bootstrap vs verify paths.
- Replace NAN bootstrap events by private callbacks
2026-07-04 00:05:20 +08:00
Akshat Agrawal
0d8cb4445d fix(nan): Move the required variables under the NAN_SYNC block 2026-07-04 00:05:20 +08:00
Jiang Jiang Jian
6d021fcbce Merge branch 'task/buildv2_shim_and_ci_v6.1' into 'release/v6.1'
feat(cmakev2): IDF_BUILD_V2 shim + v1-compat layer + buildv2 CI (v6.1)

See merge request espressif/esp-idf!49725
2026-07-03 23:37:50 +08:00
nilesh.kale
9b243dcf26 fix(esp_hw_support): Keep D-ROM PMP entry so newer apps boot on old bootloaders
ESP32-C6/H2 bootloaders <= v5.2.1 configure and lock PMP entries 3-4 as their
D-ROM region; a locked PMP entry cannot be reconfigured until CPU reset.
Commit 366e4ee944 ("Remove redundant PMP entry for ROM region") dropped the
D-ROM entry, and commit d4167fea60 (which also restructured C6/H2 PMP setup)
then renumbered the regions down, placing the application IRAM/DRAM split on
entries 3-4. On an already-deployed older bootloader those entries are locked,
so IRAM never gains execute permission and the chip resets before app_main()
(GitHub issue #18769).

Restore the separate (redundant) D-ROM PMP entry on indices 3-4 so the
application IRAM/DRAM split stays on entries 5-7, clear of the locked range.
This keeps newer applications bootable on older bootloaders.

Closes https://github.com/espressif/esp-idf/issues/18769
2026-07-03 20:57:04 +05:30
Jiang Jiang Jian
edeec716c4 Merge branch 'fix/fix_sleep_cache_writeback_logic_v6.1' into 'release/v6.1'
fix(esp_hw_support): fix esp32s31 sleeping cache writeback logic (v6.1)

See merge request espressif/esp-idf!50347
2026-07-03 22:23:20 +08:00