[PATCH 36/92] NAN: Add NAN KDE parsing to key data parsing

Andrei Otcheretianski andrei.otcheretianski at intel.com
Wed Apr 22 05:23:27 PDT 2026


From: Avraham Stern <avraham.stern at intel.com>

The NAN Shared Key Descriptor attribute includes a RSNA Key Descriptor
with NAN KDEs. Parse the NAN KDEs in wpa_parse_kde_ies().

Signed-off-by: Avraham Stern <avraham.stern at intel.com>
---
 src/common/wpa_common.c | 22 ++++++++++++++++++++++
 src/common/wpa_common.h |  4 ++++
 2 files changed, 26 insertions(+)

diff --git a/src/common/wpa_common.c b/src/common/wpa_common.c
index 14032fcdec..f14cfa02ff 100644
--- a/src/common/wpa_common.c
+++ b/src/common/wpa_common.c
@@ -20,6 +20,7 @@
 #include "ieee802_11_common.h"
 #include "defs.h"
 #include "wpa_common.h"
+#include "common/nan_defs.h"
 
 
 static unsigned int wpa_kck_len(int akmp, size_t pmk_len)
@@ -4043,6 +4044,27 @@ static int wpa_parse_generic(const u8 *pos, struct wpa_eapol_ie_parse *ie)
 		return 0;
 	}
 
+#if defined(CONFIG_NAN) || defined(CONFIG_PASN)
+	if (left == sizeof(struct nan_nik_kde) &&
+	    selector == NAN_KEY_DATA_NIK) {
+		ie->nan_nik = p;
+		ie->nan_nik_len = left;
+		wpa_hexdump_key(MSG_DEBUG, "WPA: NAN NIK KDE in EAPOL-Key",
+				ie->nan_nik, ie->nan_nik_len);
+		return 0;
+	}
+
+	if (left == sizeof(struct nan_key_lifetime_kde) &&
+	    selector == NAN_KEY_DATA_LIFETIME) {
+		ie->nan_key_lifetime = p;
+		ie->nan_key_lifetime_len = left;
+		wpa_hexdump_key(MSG_DEBUG,
+				"WPA: NAN Key Lifetime KDE in EAPOL-Key",
+				ie->nan_key_lifetime, ie->nan_key_lifetime_len);
+		return 0;
+	}
+#endif /* CONFIG_NAN || CONFIG_PASN */
+
 	return 2;
 }
 
diff --git a/src/common/wpa_common.h b/src/common/wpa_common.h
index 79a31c9a4d..71df9db86e 100644
--- a/src/common/wpa_common.h
+++ b/src/common/wpa_common.h
@@ -740,6 +740,10 @@ struct wpa_eapol_ie_parse {
 	size_t rsne_override_2_len;
 	const u8 *rsnxe_override;
 	size_t rsnxe_override_len;
+	const u8 *nan_nik;
+	size_t nan_nik_len;
+	const u8 *nan_key_lifetime;
+	size_t nan_key_lifetime_len;
 	u16 valid_mlo_gtks; /* bitmap of valid link GTK KDEs */
 	const u8 *mlo_gtk[MAX_NUM_MLD_LINKS];
 	size_t mlo_gtk_len[MAX_NUM_MLD_LINKS];
-- 
2.53.0




More information about the Hostap mailing list