[PATCH 06/55] FT: Support 0 octet MIC in FTE
Ilan Peer
ilan.peer at intel.com
Thu Dec 3 02:44:05 PST 2026
IEEE P802.11bi/D6.0 adds MIC Length subfield value 3 indicating a
0 octet MIC field in the FTE. Support parsing such an FTE, and
building one with the MIC field omitted and the Element Count set
to 0.
Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
src/ap/wpa_auth.c | 6 +++---
src/ap/wpa_auth_ft.c | 32 +++++++++++++++++++++++++++-----
src/ap/wpa_auth_i.h | 2 +-
src/common/wpa_common.c | 4 +++-
src/common/wpa_common.h | 1 +
5 files changed, 35 insertions(+), 10 deletions(-)
diff --git a/src/ap/wpa_auth.c b/src/ap/wpa_auth.c
index 1db1632c5de1..a8f7551102bf 100644
--- a/src/ap/wpa_auth.c
+++ b/src/ap/wpa_auth.c
@@ -5324,7 +5324,7 @@ SM_STATE(WPA_PTK, PTKINITNEGOTIATING)
conf->r0_key_holder_len,
NULL, NULL, pos,
kde + kde_len - pos,
- NULL, 0, 0);
+ NULL, 0, 0, false);
}
if (res < 0) {
wpa_printf(MSG_ERROR,
@@ -7660,7 +7660,7 @@ int wpa_auth_write_fte(struct wpa_authenticator *wpa_auth,
return wpa_write_ftie(conf, sm->wpa_key_mgmt, sm->xxkey_len,
conf->r0_key_holder, conf->r0_key_holder_len,
- NULL, NULL, buf, len, NULL, 0, 0);
+ NULL, NULL, buf, len, NULL, 0, 0, false);
}
#endif /* CONFIG_IEEE80211R_AP */
@@ -7934,7 +7934,7 @@ int wpa_auth_resend_m3(struct wpa_state_machine *sm,
conf->r0_key_holder_len,
NULL, NULL, pos,
kde + kde_len - pos,
- NULL, 0, 0);
+ NULL, 0, 0, false);
}
if (res < 0) {
wpa_printf(MSG_ERROR,
diff --git a/src/ap/wpa_auth_ft.c b/src/ap/wpa_auth_ft.c
index 527f8f60f2ca..914b3fdd1664 100644
--- a/src/ap/wpa_auth_ft.c
+++ b/src/ap/wpa_auth_ft.c
@@ -801,7 +801,7 @@ int wpa_write_ftie(struct wpa_auth_config *conf, int key_mgmt, size_t key_len,
const u8 *r0kh_id, size_t r0kh_id_len,
const u8 *anonce, const u8 *snonce,
u8 *buf, size_t len, const u8 *subelem,
- size_t subelem_len, int rsnxe_used)
+ size_t subelem_len, int rsnxe_used, bool no_mic)
{
u8 *pos = buf, *ielen;
size_t hdrlen;
@@ -821,6 +821,9 @@ int wpa_write_ftie(struct wpa_auth_config *conf, int key_mgmt, size_t key_len,
else
hdrlen = sizeof(struct rsn_ftie);
+ if (no_mic)
+ hdrlen = 2 + 2 * WPA_NONCE_LEN;
+
if (len < 2 + hdrlen + 2 + FT_R1KH_ID_LEN + 2 + r0kh_id_len +
subelem_len)
return -1;
@@ -828,8 +831,27 @@ int wpa_write_ftie(struct wpa_auth_config *conf, int key_mgmt, size_t key_len,
*pos++ = WLAN_EID_FAST_BSS_TRANSITION;
ielen = pos++;
- if (key_mgmt == WPA_KEY_MGMT_FT_SAE_EXT_KEY &&
- key_len == SHA512_MAC_LEN) {
+ /* Zero octet MIC, Element Count 0 */
+ if (no_mic) {
+ mic_control |= FTE_MIC_LEN_0 << FTE_MIC_CTRL_MIC_LEN_SHIFT;
+ WPA_PUT_LE16(pos, mic_control);
+ pos += 2;
+
+ if (anonce)
+ os_memcpy(pos, anonce, WPA_NONCE_LEN);
+ else
+ os_memset(pos, 0, WPA_NONCE_LEN);
+
+ pos += WPA_NONCE_LEN;
+
+ if (snonce)
+ os_memcpy(pos, snonce, WPA_NONCE_LEN);
+ else
+ os_memset(pos, 0, WPA_NONCE_LEN);
+
+ pos += WPA_NONCE_LEN;
+ } else if (key_mgmt == WPA_KEY_MGMT_FT_SAE_EXT_KEY &&
+ key_len == SHA512_MAC_LEN) {
struct rsn_ftie_sha512 *hdr = (struct rsn_ftie_sha512 *) pos;
os_memset(hdr, 0, sizeof(*hdr));
@@ -2840,7 +2862,7 @@ u8 * wpa_sm_write_assoc_resp_ies(struct wpa_state_machine *sm, u8 *pos,
res = wpa_write_ftie(conf, sm->wpa_key_mgmt, key_len,
r0kh_id, r0kh_id_len,
anonce, snonce, pos, end - pos,
- subelem, subelem_len, rsnxe_used);
+ subelem, subelem_len, rsnxe_used, false);
os_free(subelem);
if (res < 0)
return NULL;
@@ -3520,7 +3542,7 @@ pmk_r1_derived:
ret = wpa_write_ftie(conf, parse.key_mgmt, pmk_r1_len,
parse.r0kh_id, parse.r0kh_id_len,
sm->ANonce, sm->SNonce, pos, end - pos, NULL, 0,
- 0);
+ 0, false);
if (ret < 0)
goto fail;
pos += ret;
diff --git a/src/ap/wpa_auth_i.h b/src/ap/wpa_auth_i.h
index 363ef41b82e7..f21a9cd9d324 100644
--- a/src/ap/wpa_auth_i.h
+++ b/src/ap/wpa_auth_i.h
@@ -346,7 +346,7 @@ int wpa_write_ftie(struct wpa_auth_config *conf, int key_mgmt, size_t key_len,
const u8 *r0kh_id, size_t r0kh_id_len,
const u8 *anonce, const u8 *snonce,
u8 *buf, size_t len, const u8 *subelem,
- size_t subelem_len, int rsnxe_used);
+ size_t subelem_len, int rsnxe_used, bool no_mic);
int wpa_auth_derive_ptk_ft(struct wpa_state_machine *sm, struct wpa_ptk *ptk,
u8 *pmk_r0, u8 *pmk_r1, u8 *pmk_r0_name,
size_t *key_len, size_t kdk_len);
diff --git a/src/common/wpa_common.c b/src/common/wpa_common.c
index 9343acd5db6f..43577773ca0d 100644
--- a/src/common/wpa_common.c
+++ b/src/common/wpa_common.c
@@ -1401,7 +1401,9 @@ static int wpa_ft_parse_fte(int key_mgmt, const u8 *ie, size_t len,
parse->fte_elem_count = pos[1];
pos += 2;
- if (key_mgmt == WPA_KEY_MGMT_FT_SAE_EXT_KEY) {
+ if (mic_len_info == FTE_MIC_LEN_0) {
+ mic_len = 0;
+ } else if (key_mgmt == WPA_KEY_MGMT_FT_SAE_EXT_KEY) {
switch (mic_len_info) {
case FTE_MIC_LEN_16:
mic_len = 16;
diff --git a/src/common/wpa_common.h b/src/common/wpa_common.h
index d2513846fbb6..9c1662b4686f 100644
--- a/src/common/wpa_common.h
+++ b/src/common/wpa_common.h
@@ -219,6 +219,7 @@ enum ft_mic_len_subfield {
FTE_MIC_LEN_16 = 0,
FTE_MIC_LEN_24 = 1,
FTE_MIC_LEN_32 = 2,
+ FTE_MIC_LEN_0 = 3,
};
--
2.55.0
More information about the Hostap
mailing list