wlantest: Verify that TKIP/CCMP frames set ExtIV=1

This commit is contained in:
Jouni Malinen 2010-11-13 12:54:07 +02:00
parent 4dac84539e
commit 20062114cd
2 changed files with 27 additions and 1 deletions

View file

@ -971,6 +971,14 @@ static void rx_data_bss_prot_group(struct wlantest *wt,
return; return;
} }
if (bss->group_cipher & (WPA_CIPHER_TKIP | WPA_CIPHER_CCMP) &&
!(data[3] & 0x20)) {
wpa_printf(MSG_INFO, "Expected TKIP/CCMP frame from "
MACSTR " did not have ExtIV bit set to 1",
MAC2STR(bss->bssid));
return;
}
keyid = data[3] >> 6; keyid = data[3] >> 6;
if (bss->gtk_len[keyid] == 0) { if (bss->gtk_len[keyid] == 0) {
wpa_printf(MSG_MSGDUMP, "No GTK known to decrypt the frame " wpa_printf(MSG_MSGDUMP, "No GTK known to decrypt the frame "
@ -1046,6 +1054,14 @@ static void rx_data_bss_prot(struct wlantest *wt,
return; return;
} }
if (sta->pairwise_cipher & (WPA_CIPHER_TKIP | WPA_CIPHER_CCMP) &&
!(data[3] & 0x20)) {
wpa_printf(MSG_INFO, "Expected TKIP/CCMP frame from "
MACSTR " did not have ExtIV bit set to 1",
MAC2STR(src));
return;
}
keyid = data[3] >> 6; keyid = data[3] >> 6;
if (keyid != 0) { if (keyid != 0) {
wpa_printf(MSG_INFO, "Unexpected non-zero KeyID %d in " wpa_printf(MSG_INFO, "Unexpected non-zero KeyID %d in "

View file

@ -676,7 +676,17 @@ static u8 * mgmt_ccmp_decrypt(struct wlantest *wt, const u8 *data, size_t len,
return NULL; return NULL;
} }
keyid = data[3] >> 6; if (len < 24 + 4)
return NULL;
if (!(data[24 + 3] & 0x20)) {
wpa_printf(MSG_INFO, "Expected CCMP frame from " MACSTR
" did not have ExtIV bit set to 1",
MAC2STR(hdr->addr2));
return NULL;
}
keyid = data[24 + 3] >> 6;
if (keyid != 0) { if (keyid != 0) {
wpa_printf(MSG_INFO, "Unexpected non-zero KeyID %d in " wpa_printf(MSG_INFO, "Unexpected non-zero KeyID %d in "
"individually addressed Management frame from " "individually addressed Management frame from "