FT: FTE MIC calculation for MLO Reassociation Request frame

Extend wpa_ft_mic() to take in an array of link addresses to allow the
FTE MIC to be calculated for Reassociation Request frame as described in
IEEE P802.11be/D4.0, 13.8.4. This commit does not change actual
behavior, i.e., this is just preparing wpa_ft_mic() and the existing
callers with a new argument.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
This commit is contained in:
Jouni Malinen 2023-08-24 17:58:25 +03:00 committed by Jouni Malinen
parent 4c079dcc64
commit e6f64a8e1d
5 changed files with 21 additions and 4 deletions

View file

@ -2851,6 +2851,7 @@ u8 * wpa_sm_write_assoc_resp_ies(struct wpa_state_machine *sm, u8 *pos,
rsnie, rsnie_len,
ric_start, ric_start ? pos - ric_start : 0,
rsnxe_len ? rsnxe : NULL, rsnxe_len,
NULL,
fte_mic) < 0) {
wpa_printf(MSG_DEBUG, "FT: Failed to calculate MIC");
return NULL;
@ -3616,6 +3617,7 @@ int wpa_ft_validate_reassoc(struct wpa_state_machine *sm, const u8 *ies,
parse.ric, parse.ric_len,
parse.rsnxe ? parse.rsnxe - 2 : NULL,
parse.rsnxe ? parse.rsnxe_len + 2 : 0,
NULL,
mic) < 0) {
wpa_printf(MSG_DEBUG, "FT: Failed to calculate MIC");
return WLAN_STATUS_UNSPECIFIED_FAILURE;

View file

@ -890,10 +890,11 @@ int wpa_ft_mic(int key_mgmt, const u8 *kck, size_t kck_len, const u8 *sta_addr,
const u8 *rsnie, size_t rsnie_len,
const u8 *ric, size_t ric_len,
const u8 *rsnxe, size_t rsnxe_len,
const u8 link_addr[MAX_NUM_MLO_LINKS][ETH_ALEN],
u8 *mic)
{
const u8 *addr[10];
size_t len[10];
const u8 *addr[10 + MAX_NUM_MLO_LINKS];
size_t len[10 + MAX_NUM_MLO_LINKS];
size_t i, num_elem = 0;
u8 zero_mic[32];
size_t mic_len, fte_fixed_len;
@ -971,6 +972,16 @@ int wpa_ft_mic(int key_mgmt, const u8 *kck, size_t kck_len, const u8 *sta_addr,
num_elem++;
}
if (link_addr) {
for (i = 0; i < MAX_NUM_MLO_LINKS; i++) {
if (is_zero_ether_addr(link_addr[i]))
continue;
addr[num_elem] = link_addr[i];
len[num_elem] = ETH_ALEN;
num_elem++;
}
}
for (i = 0; i < num_elem; i++)
wpa_hexdump(MSG_MSGDUMP, "FT: MIC data", addr[i], len[i]);
res = -1;

View file

@ -452,6 +452,7 @@ struct rsn_rdie {
#pragma pack(pop)
#endif /* _MSC_VER */
#define MAX_NUM_MLO_LINKS 15
int wpa_eapol_key_mic(const u8 *key, size_t key_len, int akmp, int ver,
const u8 *buf, size_t len, u8 *mic);
@ -485,6 +486,7 @@ int wpa_ft_mic(int key_mgmt, const u8 *kck, size_t kck_len, const u8 *sta_addr,
const u8 *rsnie, size_t rsnie_len,
const u8 *ric, size_t ric_len,
const u8 *rsnxe, size_t rsnxe_len,
const u8 link_addr[MAX_NUM_MLO_LINKS][ETH_ALEN],
u8 *mic);
int wpa_derive_pmk_r0(const u8 *xxkey, size_t xxkey_len,
const u8 *ssid, size_t ssid_len,
@ -556,8 +558,6 @@ int wpa_compare_rsn_ie(int ft_initial_assoc,
const u8 *ie2, size_t ie2len);
int wpa_insert_pmkid(u8 *ies, size_t *ies_len, const u8 *pmkid);
#define MAX_NUM_MLO_LINKS 15
struct wpa_ft_ies {
const u8 *mdie;
size_t mdie_len;

View file

@ -472,6 +472,7 @@ static u8 * wpa_ft_gen_req_ies(struct wpa_sm *sm, size_t *len,
ftie_pos, 2 + *ftie_len,
(u8 *) rsnie, 2 + rsnie->len, ric_ies,
ric_ies_len, rsnxe_len ? rsnxe : NULL, rsnxe_len,
NULL,
fte_mic) < 0) {
wpa_printf(MSG_INFO, "FT: Failed to calculate MIC");
os_free(buf);
@ -1146,6 +1147,7 @@ int wpa_ft_validate_reassoc_resp(struct wpa_sm *sm, const u8 *ies,
parse.ric, parse.ric_len,
parse.rsnxe ? parse.rsnxe - 2 : NULL,
parse.rsnxe ? parse.rsnxe_len + 2 : 0,
NULL,
mic) < 0) {
wpa_printf(MSG_DEBUG, "FT: Failed to calculate MIC");
return -1;

View file

@ -1424,6 +1424,7 @@ static void rx_mgmt_reassoc_req(struct wlantest *wt, const u8 *data,
parse.ric, parse.ric_len,
parse.rsnxe ? parse.rsnxe - 2 : NULL,
parse.rsnxe ? parse.rsnxe_len + 2 : 0,
NULL,
mic) < 0) {
add_note(wt, MSG_INFO, "FT: Failed to calculate MIC");
return;
@ -1937,6 +1938,7 @@ static void rx_mgmt_reassoc_resp(struct wlantest *wt, const u8 *data,
parse.ric, parse.ric_len,
parse.rsnxe ? parse.rsnxe - 2 : NULL,
parse.rsnxe ? parse.rsnxe_len + 2 : 0,
NULL,
mic) < 0) {
add_note(wt, MSG_INFO, "FT: Failed to calculate MIC");
return;