aboutsummaryrefslogtreecommitdiffstats
path: root/wlantest/rx_data.c
diff options
context:
space:
mode:
authorJouni Malinen <jouni.malinen@atheros.com>2011-01-14 15:43:17 (GMT)
committerJouni Malinen <j@w1.fi>2011-01-14 15:43:17 (GMT)
commit2e479416d1bfa584eddf7d335cf969ea6fe1f89c (patch)
tree0ef076cbd4031ef46afe8e0eeff30062aaa19be7 /wlantest/rx_data.c
parent3558c41ee71ff0e34aca47412b33019630c8e922 (diff)
downloadhostap-2e479416d1bfa584eddf7d335cf969ea6fe1f89c.zip
hostap-2e479416d1bfa584eddf7d335cf969ea6fe1f89c.tar.gz
hostap-2e479416d1bfa584eddf7d335cf969ea6fe1f89c.tar.bz2
wlantest: Add support for decrypting WEP frames
Diffstat (limited to 'wlantest/rx_data.c')
-rw-r--r--wlantest/rx_data.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/wlantest/rx_data.c b/wlantest/rx_data.c
index a8312b6..95daaf2 100644
--- a/wlantest/rx_data.c
+++ b/wlantest/rx_data.c
@@ -144,7 +144,8 @@ static void rx_data_bss_prot_group(struct wlantest *wt,
}
keyid = data[3] >> 6;
- if (bss->gtk_len[keyid] == 0) {
+ if (bss->gtk_len[keyid] == 0 && bss->group_cipher != WPA_CIPHER_WEP40)
+ {
wpa_printf(MSG_MSGDUMP, "No GTK known to decrypt the frame "
"(A2=" MACSTR " KeyID=%d)",
MAC2STR(hdr->addr2), keyid);
@@ -153,6 +154,8 @@ static void rx_data_bss_prot_group(struct wlantest *wt,
if (bss->group_cipher == WPA_CIPHER_TKIP)
tkip_get_pn(pn, data);
+ else if (bss->group_cipher == WPA_CIPHER_WEP40)
+ goto skip_replay_det;
else
ccmp_get_pn(pn, data);
if (os_memcmp(pn, bss->rsc[keyid], 6) <= 0) {
@@ -167,9 +170,12 @@ static void rx_data_bss_prot_group(struct wlantest *wt,
wpa_hexdump(MSG_INFO, "RSC", bss->rsc[keyid], 6);
}
+skip_replay_det:
if (bss->group_cipher == WPA_CIPHER_TKIP)
decrypted = tkip_decrypt(bss->gtk[keyid], hdr, data, len,
&dlen);
+ else if (bss->group_cipher == WPA_CIPHER_WEP40)
+ decrypted = wep_decrypt(wt, hdr, data, len, &dlen);
else
decrypted = ccmp_decrypt(bss->gtk[keyid], hdr, data, len,
&dlen);
@@ -237,7 +243,9 @@ static void rx_data_bss_prot(struct wlantest *wt,
}
}
}
- if ((sta == NULL || !sta->ptk_set) && tk == NULL) {
+ if ((sta == NULL ||
+ (!sta->ptk_set && sta->pairwise_cipher != WPA_CIPHER_WEP40)) &&
+ tk == NULL) {
wpa_printf(MSG_MSGDUMP, "No PTK known to decrypt the frame");
return;
}
@@ -300,6 +308,8 @@ static void rx_data_bss_prot(struct wlantest *wt,
if (tk == NULL && sta->pairwise_cipher == WPA_CIPHER_TKIP)
tkip_get_pn(pn, data);
+ else if (sta->pairwise_cipher == WPA_CIPHER_WEP40)
+ goto skip_replay_det;
else
ccmp_get_pn(pn, data);
if (os_memcmp(pn, rsc, 6) <= 0) {
@@ -314,10 +324,13 @@ static void rx_data_bss_prot(struct wlantest *wt,
wpa_hexdump(MSG_INFO, "RSC", rsc, 6);
}
+skip_replay_det:
if (tk)
decrypted = ccmp_decrypt(tk, hdr, data, len, &dlen);
else if (sta->pairwise_cipher == WPA_CIPHER_TKIP)
decrypted = tkip_decrypt(sta->ptk.tk1, hdr, data, len, &dlen);
+ else if (sta->pairwise_cipher == WPA_CIPHER_WEP40)
+ decrypted = wep_decrypt(wt, hdr, data, len, &dlen);
else
decrypted = ccmp_decrypt(sta->ptk.tk1, hdr, data, len, &dlen);
if (decrypted) {