From ebb9539d17a19f71264e48cd8f961c5d158d3e64 Mon Sep 17 00:00:00 2001 From: Sarvesh Bodakhe Date: Wed, 1 Jul 2026 17:29:14 +0530 Subject: [PATCH] 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. --- components/esp_wifi/wifi_apps/nan_app/src/nan_i.h | 13 +++---------- .../esp_supplicant/src/esp_wifi_driver.h | 2 ++ 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/components/esp_wifi/wifi_apps/nan_app/src/nan_i.h b/components/esp_wifi/wifi_apps/nan_app/src/nan_i.h index 767f6f32736..74d038e6b15 100644 --- a/components/esp_wifi/wifi_apps/nan_app/src/nan_i.h +++ b/components/esp_wifi/wifi_apps/nan_app/src/nan_i.h @@ -178,16 +178,9 @@ extern void *s_nan_data_lock; #define NAN_KEY_FLAG_TX BIT(3) #define NAN_KEY_FLAG_PAIRWISE BIT(5) -/* NAN key-type selector passed as the last arg of esp_wifi_set_nan_key_internal; - * tells the blob which NAN SA the key belongs to. Values match the blob's - * key-type enum. */ -typedef enum { - NAN_KEY_ND_TK = 0, - NAN_KEY_ND_GTK = 1, - NAN_KEY_NM_TK = 2, - NAN_KEY_ND_IGTK = 3, - NAN_KEY_ND_BIGTK = 4, -} nan_key_type_t; +/* NAN key-type selector (nan_key_type_t: NAN_KEY_ND_TK / ND_GTK / NM_TK / ND_IGTK / + * ND_BIGTK), passed as the last arg of esp_wifi_set_nan_key_internal, is defined in + * esp_wifi_driver.h (included above) and shared with the blob. */ /* Handshake state */ enum nan_handshake_state { diff --git a/components/wpa_supplicant/esp_supplicant/src/esp_wifi_driver.h b/components/wpa_supplicant/esp_supplicant/src/esp_wifi_driver.h index 1ee7ff95827..e58fa811542 100644 --- a/components/wpa_supplicant/esp_supplicant/src/esp_wifi_driver.h +++ b/components/wpa_supplicant/esp_supplicant/src/esp_wifi_driver.h @@ -238,6 +238,8 @@ typedef enum { NAN_KEY_ND_TK = 0, NAN_KEY_ND_GTK, NAN_KEY_NM_TK, + NAN_KEY_ND_IGTK, /* 3 - NAN Integrity Group Temporal Key (BIP-CMAC-128) */ + NAN_KEY_ND_BIGTK, /* 4 - NAN Beacon Integrity Group Temporal Key (BIP-CMAC-128) */ } nan_key_type_t; typedef struct {