From 32592935feefb4742dd14bf6192595113e93132b Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 5 Sep 2022 21:16:44 +0300 Subject: [PATCH] wlantest: Distinguish EAPOL-Key msg 4/4 from 2/4 based on Key Nonce IEEE P802.11be adds the MAC Address KDE into the EAPOL-Key msg 4/4 when MLO is used and as such, the previously used check for Key Data Length value 0 is not sufficient for recognizing the EAPOL-Key msg 4/4 anymore. Also check for an all zero Key Nonce value since that field is supposed to be zero in EAPOL-Key msg 4/4 and it has to be a random value in EAPOL-Key msg 2/4. Signed-off-by: Jouni Malinen --- wlantest/rx_eapol.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/wlantest/rx_eapol.c b/wlantest/rx_eapol.c index 7e8d28f25..9f5c6c3b6 100644 --- a/wlantest/rx_eapol.c +++ b/wlantest/rx_eapol.c @@ -306,10 +306,6 @@ static void rx_data_eapol_key_2_of_4(struct wlantest *wt, const u8 *dst, hdr = (const struct wpa_eapol_key *) (eapol + 1); mic_len = wpa_mic_len(sta->key_mgmt, PMK_LEN); mic = (const u8 *) (hdr + 1); - if (is_zero(hdr->key_nonce, WPA_NONCE_LEN)) { - add_note(wt, MSG_INFO, "EAPOL-Key 2/4 from " MACSTR - " used zero nonce", MAC2STR(src)); - } if (!is_zero(hdr->key_rsc, 8)) { add_note(wt, MSG_INFO, "EAPOL-Key 2/4 from " MACSTR " used non-zero Key RSC", MAC2STR(src)); @@ -1261,7 +1257,8 @@ static void rx_data_eapol_key(struct wlantest *wt, const u8 *bssid, rx_data_eapol_key_1_of_4(wt, dst, src, data, len); break; case WPA_KEY_INFO_MIC: - if (key_data_length == 0) + if (key_data_length == 0 || + is_zero(hdr->key_nonce, WPA_NONCE_LEN)) rx_data_eapol_key_4_of_4(wt, dst, src, data, len); else @@ -1281,7 +1278,8 @@ static void rx_data_eapol_key(struct wlantest *wt, const u8 *bssid, break; case WPA_KEY_INFO_SECURE | WPA_KEY_INFO_MIC: case WPA_KEY_INFO_SECURE: - if (key_data_length == 0) + if (key_data_length == 0 || + is_zero(hdr->key_nonce, WPA_NONCE_LEN)) rx_data_eapol_key_4_of_4(wt, dst, src, data, len); else