]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wlantest: Distinguish EAPOL-Key msg 4/4 from 2/4 based on Key Nonce
authorJouni Malinen <quic_jouni@quicinc.com>
Mon, 5 Sep 2022 18:16:44 +0000 (21:16 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 5 Sep 2022 18:16:44 +0000 (21:16 +0300)
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 <quic_jouni@quicinc.com>
wlantest/rx_eapol.c

index 7e8d28f25a90ef6232dc3fa037a71a06b18044f7..9f5c6c3b666c5012d0384d1f2edee314d3716da4 100644 (file)
@@ -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