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 <quic_jouni@quicinc.com>
This commit is contained in:
Jouni Malinen 2022-09-05 21:16:44 +03:00 committed by Jouni Malinen
parent b5db77840f
commit 32592935fe

View 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); hdr = (const struct wpa_eapol_key *) (eapol + 1);
mic_len = wpa_mic_len(sta->key_mgmt, PMK_LEN); mic_len = wpa_mic_len(sta->key_mgmt, PMK_LEN);
mic = (const u8 *) (hdr + 1); 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)) { if (!is_zero(hdr->key_rsc, 8)) {
add_note(wt, MSG_INFO, "EAPOL-Key 2/4 from " MACSTR add_note(wt, MSG_INFO, "EAPOL-Key 2/4 from " MACSTR
" used non-zero Key RSC", MAC2STR(src)); " 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); rx_data_eapol_key_1_of_4(wt, dst, src, data, len);
break; break;
case WPA_KEY_INFO_MIC: 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, rx_data_eapol_key_4_of_4(wt, dst, src, data,
len); len);
else else
@ -1281,7 +1278,8 @@ static void rx_data_eapol_key(struct wlantest *wt, const u8 *bssid,
break; break;
case WPA_KEY_INFO_SECURE | WPA_KEY_INFO_MIC: case WPA_KEY_INFO_SECURE | WPA_KEY_INFO_MIC:
case WPA_KEY_INFO_SECURE: 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, rx_data_eapol_key_4_of_4(wt, dst, src, data,
len); len);
else else