[PATCH v2] MLD STA: Add support for parsing MLO KDEs
Veerendranath Jakkam
quic_vjakkam at quicinc.com
Fri Sep 9 07:18:18 PDT 2022
From: Rohan Dutta <quic_drohan at quicinc.com>
Add support for parsing MLO KDEs as defined in Table 12-10 KDE selectors
in IEEE P802.11be/D2.0.
Co-authored-by: Veerendranath Jakkam <quic_vjakkam at quicinc.com>
Signed-off-by: Veerendranath Jakkam <quic_vjakkam at quicinc.com>
Signed-off-by: Rohan Dutta <quic_drohan at quicinc.com>
---
src/common/wpa_common.c | 63 +++++++++++++++++++++++++++++++++++++++++
src/common/wpa_common.h | 49 ++++++++++++++++++++++++++++++++
2 files changed, 112 insertions(+)
diff --git a/src/common/wpa_common.c b/src/common/wpa_common.c
index 33d9bce39..44b60143c 100644
--- a/src/common/wpa_common.c
+++ b/src/common/wpa_common.c
@@ -3164,6 +3164,7 @@ static int wpa_parse_generic(const u8 *pos, struct wpa_eapol_ie_parse *ie)
u32 selector;
const u8 *p;
size_t left;
+ u8 link_id;
if (len == 0)
return 1;
@@ -3271,6 +3272,68 @@ static int wpa_parse_generic(const u8 *pos, struct wpa_eapol_ie_parse *ie)
return 0;
}
+ if (left >= WPA_MLO_GTK_KDE_PREFIX_LENGTH &&
+ selector == RSN_KEY_DATA_MLO_GTK) {
+ link_id = (p[0] & WPA_MLO_GTK_KDE_PREFIX0_LINK_ID_MASK) >>
+ WPA_MLO_GTK_KDE_PREFIX0_LINK_ID_SHIFT;
+ if (link_id >= MAX_NUM_MLO_LINKS)
+ return 2;
+
+ ie->mlo_gtk_found = true;
+ ie->mlo_gtk[link_id] = p;
+ ie->mlo_gtk_len[link_id] = left;
+ wpa_printf(MSG_DEBUG, "WPA: link id %u", link_id);
+ wpa_hexdump_key(MSG_DEBUG, "WPA: MLO_GTK in EAPOL-Key",
+ pos, dlen);
+ return 0;
+ }
+
+ if (left >= WPA_MLO_IGTK_KDE_PREFIX_LENGTH &&
+ selector == RSN_KEY_DATA_MLO_IGTK) {
+ link_id = (p[8] & WPA_MLO_IGTK_KDE_PREFIX8_LINK_ID_MASK) >>
+ WPA_MLO_IGTK_KDE_PREFIX8_LINK_ID_SHIFT;
+ if (link_id >= MAX_NUM_MLO_LINKS)
+ return 2;
+
+ ie->mlo_igtk_found = true;
+ ie->mlo_igtk[link_id] = p;
+ ie->mlo_igtk_len[link_id] = left;
+ wpa_printf(MSG_DEBUG, "WPA: link id %u", link_id);
+ wpa_hexdump_key(MSG_DEBUG, "WPA: MLO_IGTK in EAPOL-Key",
+ pos, dlen);
+ return 0;
+ }
+
+ if (left >= WPA_MLO_BIGTK_KDE_PREFIX_LENGTH &&
+ selector == RSN_KEY_DATA_MLO_BIGTK) {
+ link_id = (p[8] & WPA_MLO_BIGTK_KDE_PREFIX8_LINK_ID_MASK) >>
+ WPA_MLO_BIGTK_KDE_PREFIX8_LINK_ID_SHIFT;
+ if (link_id >= MAX_NUM_MLO_LINKS)
+ return 2;
+
+ ie->mlo_bigtk[link_id] = p;
+ ie->mlo_bigtk_len[link_id] = left;
+ wpa_printf(MSG_DEBUG, "WPA: link id %u", link_id);
+ wpa_hexdump_key(MSG_DEBUG, "WPA: MLO_BIGTK in EAPOL-Key",
+ pos, dlen);
+ return 0;
+ }
+
+ if (left >= WPA_MLO_LINK_KDE_FIXED_LENGTH &&
+ selector == RSN_KEY_DATA_MLO_LINK) {
+ link_id = (p[0] & WPA_MLO_LINK_KDE_LI_LINK_ID_MASK) >>
+ WPA_MLO_LINK_KDE_LI_LINK_ID_SHIFT;
+ if (link_id >= MAX_NUM_MLO_LINKS)
+ return 2;
+
+ ie->mlo_link[link_id] = p;
+ ie->mlo_link_len[link_id] = left;
+ wpa_printf(MSG_DEBUG, "WPA: link id %u", link_id);
+ wpa_hexdump(MSG_DEBUG, "WPA: MLO_LINK in EAPOL-Key",
+ pos, dlen);
+ return 0;
+ }
+
return 2;
}
diff --git a/src/common/wpa_common.h b/src/common/wpa_common.h
index c01ddaa6b..310c928b2 100644
--- a/src/common/wpa_common.h
+++ b/src/common/wpa_common.h
@@ -132,6 +132,10 @@ WPA_CIPHER_BIP_CMAC_256)
#define RSN_KEY_DATA_MULTIBAND_KEYID RSN_SELECTOR(0x00, 0x0f, 0xac, 12)
#define RSN_KEY_DATA_OCI RSN_SELECTOR(0x00, 0x0f, 0xac, 13)
#define RSN_KEY_DATA_BIGTK RSN_SELECTOR(0x00, 0x0f, 0xac, 14)
+#define RSN_KEY_DATA_MLO_GTK RSN_SELECTOR(0x00, 0x0f, 0xac, 16)
+#define RSN_KEY_DATA_MLO_IGTK RSN_SELECTOR(0x00, 0x0f, 0xac, 17)
+#define RSN_KEY_DATA_MLO_BIGTK RSN_SELECTOR(0x00, 0x0f, 0xac, 18)
+#define RSN_KEY_DATA_MLO_LINK RSN_SELECTOR(0x00, 0x0f, 0xac, 19)
#define WFA_KEY_DATA_IP_ADDR_REQ RSN_SELECTOR(0x50, 0x6f, 0x9a, 4)
#define WFA_KEY_DATA_IP_ADDR_ALLOC RSN_SELECTOR(0x50, 0x6f, 0x9a, 5)
@@ -339,6 +343,40 @@ struct wpa_bigtk_kde {
u8 bigtk[WPA_BIGTK_MAX_LEN];
} STRUCT_PACKED;
+#define WPA_MLO_GTK_KDE_PREFIX_LENGTH (1 + 6)
+#define WPA_MLO_GTK_KDE_PREFIX0_KEY_ID_MASK 0x03
+#define WPA_MLO_GTK_KDE_PREFIX0_TX 0x04
+#define WPA_MLO_GTK_KDE_PREFIX0_LINK_ID_SHIFT 4
+#define WPA_MLO_GTK_KDE_PREFIX0_LINK_ID_MASK 0xF0
+
+#define WPA_MLO_IGTK_KDE_PREFIX_LENGTH (2 + 6 + 1)
+#define WPA_MLO_IGTK_KDE_PREFIX8_LINK_ID_SHIFT 4
+#define WPA_MLO_IGTK_KDE_PREFIX8_LINK_ID_MASK 0xF0
+struct wpa_mlo_igtk_kde {
+ u8 keyid[2];
+ u8 pn[6];
+ u8 prefix8;
+ u8 igtk[WPA_IGTK_MAX_LEN];
+} STRUCT_PACKED;
+
+#define WPA_MLO_BIGTK_KDE_PREFIX_LENGTH (2 + 6 + 1)
+#define WPA_MLO_BIGTK_KDE_PREFIX8_LINK_ID_SHIFT 4
+#define WPA_MLO_BIGTK_KDE_PREFIX8_LINK_ID_MASK 0xF0
+struct wpa_mlo_bigtk_kde {
+ u8 keyid[2];
+ u8 pn[6];
+ u8 prefix8;
+ u8 bigtk[WPA_BIGTK_MAX_LEN];
+} STRUCT_PACKED;
+
+#define WPA_MLO_LINK_KDE_FIXED_LENGTH (1 + 6)
+#define WPA_MLO_LINK_KDE_LINK_INFO_INDEX 0
+#define WPA_MLO_LINK_KDE_LI_LINK_ID_SHIFT 0
+#define WPA_MLO_LINK_KDE_LI_LINK_ID_MASK 0x0F
+#define WPA_MLO_LINK_KDE_LI_RSNE_INFO 0x10
+#define WPA_MLO_LINK_KDE_LI_RSNXE_INFO 0x20
+#define WPA_MLO_LINK_KDE_LINK_MAC_INDEX 1
+
struct rsn_mdie {
u8 mobility_domain[MOBILITY_DOMAIN_ID_LEN];
u8 ft_capab;
@@ -616,6 +654,17 @@ struct wpa_eapol_ie_parse {
u16 aid;
const u8 *wmm;
size_t wmm_len;
+#define MAX_NUM_MLO_LINKS 15
+ bool mlo_gtk_found;
+ bool mlo_igtk_found;
+ const u8 *mlo_gtk[MAX_NUM_MLO_LINKS];
+ size_t mlo_gtk_len[MAX_NUM_MLO_LINKS];
+ const u8 *mlo_igtk[MAX_NUM_MLO_LINKS];
+ size_t mlo_igtk_len[MAX_NUM_MLO_LINKS];
+ const u8 *mlo_bigtk[MAX_NUM_MLO_LINKS];
+ size_t mlo_bigtk_len[MAX_NUM_MLO_LINKS];
+ const u8 *mlo_link[MAX_NUM_MLO_LINKS];
+ size_t mlo_link_len[MAX_NUM_MLO_LINKS];
};
int wpa_parse_kde_ies(const u8 *buf, size_t len, struct wpa_eapol_ie_parse *ie);
--
2.25.1
More information about the Hostap
mailing list