diff --git a/wlantest/rx_eapol.c b/wlantest/rx_eapol.c index 5a38123ac..629aa973b 100644 --- a/wlantest/rx_eapol.c +++ b/wlantest/rx_eapol.c @@ -34,17 +34,20 @@ static int is_zero(const u8 *buf, size_t len) static size_t determine_mic_len(struct wlantest_sta *sta) { size_t pmk_len = PMK_LEN; + int group = 0; - if (sta && wpa_key_mgmt_sae_ext_key(sta->key_mgmt) && - sta->sae_group) { - switch (sta->sae_group) { - case 20: - pmk_len = 48; - break; - case 21: - pmk_len = 64; - break; - } + if (sta && wpa_key_mgmt_sae_ext_key(sta->key_mgmt)) + group = sta->sae_group; + else if (sta && sta->key_mgmt == WPA_KEY_MGMT_OWE) + group = sta->owe_group; + + switch (group) { + case 20: + pmk_len = 48; + break; + case 21: + pmk_len = 64; + break; } return wpa_mic_len(sta->key_mgmt, pmk_len); diff --git a/wlantest/rx_mgmt.c b/wlantest/rx_mgmt.c index 62adaa848..ba98034bd 100644 --- a/wlantest/rx_mgmt.c +++ b/wlantest/rx_mgmt.c @@ -932,6 +932,11 @@ static void rx_mgmt_assoc_req(struct wlantest *wt, const u8 *data, size_t len) sta->rsnxe_len = elems.rsnxe_len; } + if (elems.owe_dh && elems.owe_dh_len >= 2) { + sta->owe_group = WPA_GET_LE16(elems.owe_dh); + wpa_printf(MSG_DEBUG, "OWE using group %u", sta->owe_group); + } + sta->assocreq_capab_info = le_to_host16(mgmt->u.assoc_req.capab_info); sta->assocreq_listen_int = le_to_host16(mgmt->u.assoc_req.listen_interval); @@ -1014,6 +1019,7 @@ static void rx_mgmt_assoc_resp(struct wlantest *wt, const u8 *data, size_t len) struct wlantest_bss *bss; struct wlantest_sta *sta; u16 capab, status, aid; + struct ieee802_11_elems elems; const u8 *ies; size_t ies_len; struct wpa_ft_ies parse; @@ -1063,16 +1069,15 @@ static void rx_mgmt_assoc_resp(struct wlantest *wt, const u8 *data, size_t len) } } + if (ieee802_11_parse_elems(ies, ies_len, &elems, 0) == ParseFailed) { + add_note(wt, MSG_INFO, + "Failed to parse IEs in AssocResp from " MACSTR, + MAC2STR(mgmt->sa)); + } + if (status == WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY) { - struct ieee802_11_elems elems; - if (ieee802_11_parse_elems(ies, ies_len, &elems, 0) == - ParseFailed) { - add_note(wt, MSG_INFO, "Failed to parse IEs in " - "AssocResp from " MACSTR, - MAC2STR(mgmt->sa)); - } else if (elems.timeout_int == NULL || - elems.timeout_int[0] != - WLAN_TIMEOUT_ASSOC_COMEBACK) { + if (!elems.timeout_int || + elems.timeout_int[0] != WLAN_TIMEOUT_ASSOC_COMEBACK) { add_note(wt, MSG_INFO, "No valid Timeout Interval IE " "with Assoc Comeback time in AssocResp " "(status=30) from " MACSTR, @@ -1115,6 +1120,11 @@ static void rx_mgmt_assoc_resp(struct wlantest *wt, const u8 *data, size_t len) if (parse.r1kh_id) os_memcpy(bss->r1kh_id, parse.r1kh_id, FT_R1KH_ID_LEN); } + + if (elems.owe_dh && elems.owe_dh_len >= 2) { + sta->owe_group = WPA_GET_LE16(elems.owe_dh); + wpa_printf(MSG_DEBUG, "OWE using group %u", sta->owe_group); + } } @@ -1179,6 +1189,11 @@ static void rx_mgmt_reassoc_req(struct wlantest *wt, const u8 *data, sta->rsnxe_len = elems.rsnxe_len; } + if (elems.owe_dh && elems.owe_dh_len >= 2) { + sta->owe_group = WPA_GET_LE16(elems.owe_dh); + wpa_printf(MSG_DEBUG, "OWE using group %u", sta->owe_group); + } + sta->assocreq_capab_info = le_to_host16(mgmt->u.reassoc_req.capab_info); sta->assocreq_listen_int = @@ -1899,6 +1914,11 @@ static void rx_mgmt_reassoc_resp(struct wlantest *wt, const u8 *data, process_bigtk_subelem(wt, bss, sta, kek, kek_len, parse.bigtk, parse.bigtk_len); } + + if (elems.owe_dh && elems.owe_dh_len >= 2) { + sta->owe_group = WPA_GET_LE16(elems.owe_dh); + wpa_printf(MSG_DEBUG, "OWE using group %u", sta->owe_group); + } } diff --git a/wlantest/wlantest.h b/wlantest/wlantest.h index 6a85cc19e..068cf3efb 100644 --- a/wlantest/wlantest.h +++ b/wlantest/wlantest.h @@ -120,6 +120,7 @@ struct wlantest_sta { u32 rx_tid[16 + 1]; u16 sae_group; + u16 owe_group; }; struct wlantest_tdls {