[v8,08/15] common: Extended Key ID support
diff mbox series

Message ID 20191031091901.2889-9-alexander@wetzel-home.de
State New
Headers show
Series
  • Support seamless PTK rekeys with Extended Key ID
Related show

Commit Message

Alexander Wetzel Oct. 31, 2019, 9:18 a.m. UTC
Prepare common code for the Extended Key ID patches.
 - Add the new driver flag WPA_DRIVER_FLAGS_EXTENDED_KEY_ID
 - RSN parsing for the new attribute KeyID
 - Extend FT IE parser to also store the capabilities

Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
---

All of the changes only make sense with the following Extended Key ID
patches.

 src/common/wpa_common.c | 9 +++++++++
 src/common/wpa_common.h | 2 ++
 src/drivers/driver.h    | 2 ++
 3 files changed, 13 insertions(+)

Patch
diff mbox series

diff --git a/src/common/wpa_common.c b/src/common/wpa_common.c
index ea9f7a21c..8c1e6e234 100644
--- a/src/common/wpa_common.c
+++ b/src/common/wpa_common.c
@@ -963,6 +963,7 @@  int wpa_ft_parse_ies(const u8 *ies, size_t ies_len,
 				parse->rsn_pmkid = data.pmkid;
 			parse->key_mgmt = data.key_mgmt;
 			parse->pairwise_cipher = data.pairwise_cipher;
+			parse->capabilities = data.capabilities;
 			if (update_use_sha384) {
 				use_sha384 =
 					wpa_key_mgmt_sha384(parse->key_mgmt);
@@ -2681,6 +2682,14 @@  static int wpa_parse_generic(const u8 *pos, const u8 *end,
 		return 0;
 	}
 
+	if (pos[1] > RSN_SELECTOR_LEN + 1 &&
+	    RSN_SELECTOR_GET(pos + 2) == RSN_KEY_DATA_KEYID) {
+		ie->key_id = pos + 2 + RSN_SELECTOR_LEN;
+		wpa_hexdump(MSG_DEBUG, "WPA: KeyID in EAPOL-Key",
+			    pos, pos[1] + 2);
+		return 0;
+	}
+
 	if (pos[1] > RSN_SELECTOR_LEN + 2 &&
 	    RSN_SELECTOR_GET(pos + 2) == RSN_KEY_DATA_GROUPKEY) {
 		ie->gtk = pos + 2 + RSN_SELECTOR_LEN;
diff --git a/src/common/wpa_common.h b/src/common/wpa_common.h
index beb1ecd5e..4ef5cd13c 100644
--- a/src/common/wpa_common.h
+++ b/src/common/wpa_common.h
@@ -465,6 +465,7 @@  struct wpa_ft_ies {
 	int pairwise_cipher;
 	const u8 *rsnxe;
 	size_t rsnxe_len;
+	int capabilities;
 };
 
 int wpa_ft_parse_ies(const u8 *ies, size_t ies_len, struct wpa_ft_ies *parse,
@@ -476,6 +477,7 @@  struct wpa_eapol_ie_parse {
 	const u8 *rsn_ie;
 	size_t rsn_ie_len;
 	const u8 *pmkid;
+	const u8 *key_id;
 	const u8 *gtk;
 	size_t gtk_len;
 	const u8 *mac_addr;
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index bf41e9133..bf75d695f 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -1704,6 +1704,8 @@  struct wpa_driver_capa {
 #define WPA_DRIVER_FLAGS_FTM_RESPONDER		0x0100000000000000ULL
 /** Driver support 4-way handshake offload for WPA-Personal */
 #define WPA_DRIVER_FLAGS_4WAY_HANDSHAKE_PSK	0x0200000000000000ULL
+/** Driver supports Extended Key ID */
+#define WPA_DRIVER_FLAGS_EXTENDED_KEY_ID	0x0400000000000000ULL
 	u64 flags;
 
 #define FULL_AP_CLIENT_STATE_SUPP(drv_flags) \