Commit Graph

436 Commits

Author SHA1 Message Date
Shreyas Sheth
53e36b0ce4 fix(wpa_supplicant): Fix issues related to pmkid mismatch and eloop for dpp 2026-07-09 17:38:49 +05:30
Sarvesh Bodakhe
21a5c603e8 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-01 20:18:37 +05:30
Sarvesh Bodakhe
e952a580db 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-01 18:12:24 +05:30
Sarvesh Bodakhe
08e98f6f30 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-01 18:11:52 +05:30
Sarvesh Bodakhe
932a9e33d8 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-01 13:35:15 +05:30
Sajia
c18887b05c 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-06-30 12:58:41 +05:30
Jiang Jiang Jian
87a6c90160 Merge branch 'bugfix/pub_ndp_setup_timeout' into 'master'
fix(nan): Cluster merging and NIK NVS persistence, including pairing and NDP fixes

Closes WIFIBUG-1932, WIFIBUG-1931, WIFIBUG-1927, WIFIBUG-1942, WIFIBUG-1948, WIFIBUG-1955, WIFIBUG-1986, and WIFIBUG-1975

See merge request espressif/esp-idf!49185
2026-06-24 20:57:22 +08:00
Nachiket Kukade
d36416980c feat(nan): Add aes_wrap/unwrap crypto callbacks
- Use crypto callbacks instead of calling internal API's
- Clean up of unused code, flags. Re-arrange functions
2026-06-23 22:08:06 +05:30
Akshat Agrawal
c4b1e06057 Address review comments VNC 2026-06-23 22:08:06 +05:30
Akshat Agrawal
2c134933ec Address review comments and fix build errors 2026-06-23 22:08:06 +05:30
Nachiket Kukade
7d6d7ead9a feat(nan): persist NIK/NPK credentials in NVS
Replace nik/nik_valid in wifi_nan_sync_config_t with reset_current_nvs_creds
and use_nvs_for_caching. On NAN start, load the saved own NIK and peer
credentials from NVS (or erase them when reset is requested); generate and
persist a fresh own NIK only when none is valid and caching is enabled.

PASN reuses the SAE module (PWE/crypto and the comeback-token mechanism),
so define CONFIG_SAE whenever SoftAP-SAE or PASN is enabled. This fixes the
undefined references to check_comeback_token()/auth_build_token_req() when
SOFTAP config is disabled.
2026-06-23 22:08:06 +05:30
Akshat Agrawal
713fee2929 Add pairing followup timeout and post CONFIRM Failure 2026-06-23 22:08:06 +05:30
Akshat Agrawal
92a41a8f37 Address Review comments 2026-06-23 22:08:06 +05:30
Akshat Agrawal
f68fb697f7 fix(nan): fix NAN pairing NIK/NIRA exchange and verification
Register esp_nan_verify_nira, cache NIRA for publish frames, send own_nik
in pairing follow-up, and complete pairing only after peer NIK is stored.
2026-06-23 22:08:06 +05:30
Akshat Agrawal
cd94023075 fix(nan): Add CLUSTER_JOIN Event and Cluster merging feat 2026-06-23 22:08:06 +05:30
Sajia
1d044feba3 feat(ftm): Update ftm calibration values esp32s31 2026-06-22 16:14:52 +08:00
sibeibei
bd7dc2da07 feat(wifi): adpater apb clock is independent 2026-06-08 19:24:30 +08:00
tarun.kumar
108362389e fix(wifi) : Add Mode/threshold checks in esp_wifi_disable_pmf_config()
- Updated API documentation for esp_wifi_disable_pmf_config()
2026-05-25 15:36:41 +05:30
Shreyas Sheth
41b4d70ad4 feat(esp_wifi): Add support for multiconfig support for DPP 2026-05-25 13:57:28 +08:00
Shreyas Sheth
2d3c11b277 fix(esp_wifi): Fix ci pipeline for random mac feature 2026-05-25 11:22:45 +08:00
Aditi
18cbdbf2b1 feat(esp_wifi): Add improvements for privacy extension
1) Add support for MAC randomization in Active scan and connect
  2) Add support for randomizaton of sequence numbers
  3) Add support for randomization of dialog token for GAS frames
2026-05-25 11:22:45 +08:00
Nachiket Kukade
0f8d4b74a0 feat(esp_wifi): NAN Pairing Improvements and bugfixes
- Route NAN pairing bootstrap via NPBA receive path
- extend datapath_req wait time to fit secured M1-M4 handshake
- Plug ND-PMK derived from KDK into NDP
- prefers paired-peer cached ND-PMK (from PASN pairing complete), when available
- carry ND-PMK metadata in pairing install callback
- Extend PASN key-installed callback payload to include role, mapped NDP CSID
  and derived ND-PMK so the NAN layer can populate paired-peer security cache.

Co-authored-by: Akshat Agrawal <akshat.agrawal@espressif.com>
Co-authored-by: Sarvesh Bodakhe <sarvesh.bodakhe@espressif.com>
2026-05-22 11:30:00 +05:30
Nachiket Kukade
9f361f478d feat(esp_wifi): Add NAN Pairing support
- Add container struct for internal extra params for follow-up
- Support for parsing Shared Key Desc in Pairing follow-up
- Implement NAN Pairing API's with required parameters
- In KeyData set cipher_ver to 0, Key Info to 0x12C8
  (AKM-defined | Pairwise | Install | ACK |
   Secure | Encrypted Key Data) for iOS compatibility
- Move NAN PASN into esp_nan_supplicant.c, move declarations
  to esp_private/esp_supp_nan.h
- Align PASN/ND-PMK derivation with hostap

Co-authored-by: Sajia <sajia.ali@espressif.com>
Co-authored-by: Akshat Agrawal <akshat.agrawal@espressif.com>
Co-authored-by: Sarvesh Bodakhe <sarvesh.bodakhe@espressif.com>
2026-05-22 13:01:51 +08:00
Nachiket Kukade
e731ff3598 feat(wpa_supplicant): Add PASN Support to for NAN Pairing
- Create pasn module from upstream. Changes till 1a791e9c
- Add ecdh prime len api to MbedTLS port
- Integrate nan and pasn modules for PIN code method
- Fix KCK length and add auth timeout
- Add NAN Pairing PASN support
2026-05-22 13:01:51 +08:00
Nachiket Kukade
38182e38c0 feat(esp_wifi): Add NAN pairing bootstrapping APIs for Wi-Fi Aware 4.0
- Implement the bootstrapping handshake phase of NAN pairing (spec 7.6.4.1).
- Add pairing support to NAN Publish/Subscribe APIs:
- Add dummy NIRA , MME Attributes
2026-05-22 13:01:51 +08:00
sibeibei
68c9de209b feat(wifi): add sleep retention attach/detach in hw start/stop 2026-05-21 11:46:16 +08:00
Sarvesh Bodakhe
b3512ccf7d change(wifi): NAN security_cfg as pointer
security_cfg in wifi_nan_publish_cfg_t / wifi_nan_subscribe_cfg_t is a
large struct; pass it by pointer so callers don't bloat their cfg copy.
Driver deep-copies during publish/subscribe, so caller may free right
after the API returns. Add NULL-check when security_reqd is set.

Update both example apps to declare a local security_cfg and assign its
address. Add help text on EXAMPLE_NAN_SECURITY_ENABLED.
2026-05-19 16:54:17 +05:30
Sarvesh Bodakhe
caba5dcfea refactor(wifi): NAN datapath header cleanups and docs
- Rename NAN_IPV6_ADDR_ID_LEN / IS_ZERO_NAN_ADDR_ID to ..._IPV6_IDENTIFIER
  so the names no longer read like MAC-address constants; drop the
  duplicate macro definition in esp_nan.h.
- Replace literal lengths with named macros: WIFI_OUI_LEN for
  nan_vendor_ie_t.vendor_oui, and a new WIFI_MAC_ADDR_LEN (private)
  applied to the NAN-related structs and callbacks in esp_private/wifi.h.
- Document each callback in struct nan_sync_callbacks and each helper
  in struct nan_secure_dp_funcs: when fired / when invoked, what each
  argument means, and the matching spec section where useful.
- Note in wifi_nan_datapath_req_t / wifi_nan_datapath_resp_t that they
  cover the NCS-SK credential model only; pairing-based cipher suites
  (NCS-PK-PASN) install per-peer ND-PMKs via a separate pairing API
  without changing these structs. Record why per-NDP credential
  injection at response time is not viable: the responder's PMKID
  lookup happens at M1 receive time, before the indication event
  surfaces to the host.
2026-05-19 16:54:12 +05:30
Sarvesh Bodakhe
cfecf60986 feat(wifi): NAN multi-credential discovery security
Replace scalar passphrase/PMK in wifi_nan_discovery_security_params_t
with wifi_nan_credential_t[N] array (cap 4) per Wi-Fi Aware v4.0
§9.5.21.4. Drop public PMKID array and service-level csid_bitmap.

Rename wifi_nan_datapath_security_params_t -> wifi_nan_security_params_t;
add wifi_nan_peer_sdf_security_t for multi-PMKID peer-RX. The
derive_security_params callback takes (svc_name, sec_cfg, out_derived[])
and runs once per credential on the WiFi task. Split nan_record_own_svc
into claim/finalize so the WiFi-task callback finds the pending slot
by name and mirrors derived material — no main-task PBKDF2.
2026-05-19 11:11:55 +05:30
Sarvesh Bodakhe
94f226d73b feat(wifi): NAN encrypted datapath (Wi-Fi Aware M1-M4 handshake)
Implement the NAN Data Path encrypted datapath per Wi-Fi Aware v4.0
(§7.1.3.5, §9.5.16):

- Responder + initiator sides of the M1-M4 Shared-Key Descriptor
  exchange, with MIC compute/verify, PTK derivation, and PMK/PMKID
  derivation via PBKDF2-SHA256 over passphrase or pre-shared PMK.
- CSIA / SCIA attribute build + parse, NCS-SK-128 cipher suite.
- Per-NDL security context on ndl_info::security_ctx; per-svc PMK cache.
- ndp_response_indication callback for initiator peer-NDI binding.
- host<->blob ABI migrated from 27 direct esp_nan_* externs to a single
  nan_secure_dp_funcs callback struct in esp_private/wifi.h.
- nan_security.c split out of nan_app.c (~340 lines de-duplicated into
  shared M1-M4 helpers).
- CONFIG_ESP_WIFI_NAN_ENCRYPTED_DATAPATH gates the secure path so non-
  security builds compile out the crypto/handshake code.
- ROM patch (esp32s31): mask ieee80211_encap_esfbuf to match the
  c5/c6/c61 pattern for NAN-capable chips.

Hardening: PMK stack copies zeroized on every return, NDP attribute
parsers bounds-checked, CSID range-checked before shifting, NDL slot
reuse only when handshake state is IDLE, get_csia/scia_len aligned with
their builders on empty input.

API surface: NDP security types moved out of esp_wifi_types_generic.h
into esp_private/wifi.h (internal-only). security pointer dropped from
struct ndp_cb_peer_info. Discovery-side wifi_nan_security_type_t and
the NDP Info callbacks removed (subsumed by csid_bitmap and SSI
respectively).
2026-05-19 11:07:06 +05:30
muhaidong
a1d2b468e8 fix(wifi): update auth mode threshold doc 2026-05-18 15:49:34 +08:00
muhaidong
b173349c3b fix(wifi): update wifi scan threshold doc 2026-05-18 14:36:01 +08:00
muhaidong
2dcab6cc00 fix(wifi): support weak func for wifi lmac assert 2026-05-15 14:48:04 +08:00
Akshat Agrawal
d66ccc2479 feat(wifi): Add multiple NAN Service Discovery improvements
- Add Country Code, Vendor IE to NAN frames
 - Support parsing of multiple availibility & SDA attributes
 - Add parsing of service response filter
 - Support Bloom filter parsing and generation
 - Record peer_svc for nan_indication_cb
 - Add support for NDPE Extension attribute
2026-05-13 12:08:17 +05:30
yinqingzhao
34ff741b6e feat(regdomain): update regdomain according to wireless-regdb 2026-05-08 12:44:38 +08:00
Nachiket Kukade
4e86f21be9 refactor(ftm): Add dummy FTM calibration values for S31 2026-05-07 18:53:00 +05:30
Akshat Agrawal
e36a818a75 refactor(ftm): Update the FTM Comp Header file 2026-05-07 18:51:29 +05:30
Sajia
e2e93cc572 refactor(ftm): Use ROC mechanism for offchan ftm 2026-05-07 18:51:27 +05:30
Jiang Jiang Jian
1aae08cb12 Merge branch 'fix/fix_lost_ip_event_issue' into 'master'
fix(lwip): add some feature for dhcp and improve api

Closes WIFI-7304

See merge request espressif/esp-idf!47221
2026-05-07 20:53:23 +08:00
yinqingzhao
be8bc4f247 feat(wifi): support disable 11ac and 11ax in efuse 2026-05-07 12:27:46 +08:00
muhaidong
47e680d2cd fix(wifi): fix max connection number issue 2026-05-06 20:48:22 +08:00
tarun.kumar
d698d5345a feat(wifi) : OWE softAP review follow ups
- OWE: clear PRK on HKDF failure; wipe PMK with bin_clear_free; reuse PMK
      buffer when size matches.
    - 4-way handshake: drop extra OWE check so WPA2-PSK can try the next passphrase.
    - SoftAP: simpler OWE key setup and assoc response IEs (skip useless RSNXE step).
2026-05-05 21:40:56 +05:30
Aditi
7d0551257c feat(esp_wifi): Add changes for addressing some review comments
Closes https://github.com/espressif/esp-idf/issues/13457
2026-05-05 21:40:29 +05:30
yinqingzhao
2746df37bf feat(wifi): Add DFS channel handling and CSA support 2026-04-30 14:49:22 +08:00
wangtao@espressif.com
78d59c4cc6 feat(lwip): softap can get sta ip from arp table 2026-04-30 11:52:28 +08:00
yinqingzhao
c3da80ee52 feat(wifi): add esp32s31 wifi support 2026-04-16 20:17:07 +08:00
zhangyanjiao
a74f9daab0 feat(wifi): add new api to return home channel info 2026-03-27 19:30:06 +08:00
zhangyanjiao
a0868299ff feat(wifi): Added new API to return value for vendor ie cb 2026-03-27 15:06:22 +08:00
muhaidong
faf8c4f1c3 feat(wifi): support auto mode connect passive channel hidden ap 2026-03-19 12:15:43 +08:00
Sajia
e5e65ce0ae fix(wifi): Add bss max idle timer and protected keep alive fixes 2026-03-18 17:53:12 +05:30