aboutsummaryrefslogtreecommitdiffstats
path: root/wlantest/rx_data.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2010-11-09 23:16:32 (GMT)
committerJouni Malinen <j@w1.fi>2010-11-09 23:16:32 (GMT)
commitf0a782979d14bfabebcf0fdb22b91f3b79678c9d (patch)
tree9e375578e2fe6dac87a7c627e3c5fc37c55d219e /wlantest/rx_data.c
parentc09caa588250accf144095e249a4d38d5049b6d4 (diff)
downloadhostap-f0a782979d14bfabebcf0fdb22b91f3b79678c9d.zip
hostap-f0a782979d14bfabebcf0fdb22b91f3b79678c9d.tar.gz
hostap-f0a782979d14bfabebcf0fdb22b91f3b79678c9d.tar.bz2
wlantest: Parse KDEs from message 2/4
Diffstat (limited to 'wlantest/rx_data.c')
-rw-r--r--wlantest/rx_data.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/wlantest/rx_data.c b/wlantest/rx_data.c
index 15813cf..ac24c25 100644
--- a/wlantest/rx_data.c
+++ b/wlantest/rx_data.c
@@ -165,7 +165,9 @@ static void rx_data_eapol_key_2_of_4(struct wlantest *wt, const u8 *dst,
struct wlantest_sta *sta;
const struct ieee802_1x_hdr *eapol;
const struct wpa_eapol_key *hdr;
- u16 key_info;
+ const u8 *key_data;
+ u16 key_info, key_data_len;
+ struct wpa_eapol_ie_parse ie;
wpa_printf(MSG_DEBUG, "EAPOL-Key 2/4 " MACSTR " -> " MACSTR,
MAC2STR(src), MAC2STR(dst));
@@ -180,7 +182,37 @@ static void rx_data_eapol_key_2_of_4(struct wlantest *wt, const u8 *dst,
hdr = (const struct wpa_eapol_key *) (eapol + 1);
os_memcpy(sta->snonce, hdr->key_nonce, WPA_NONCE_LEN);
key_info = WPA_GET_BE16(hdr->key_info);
+ key_data_len = WPA_GET_BE16(hdr->key_data_length);
derive_ptk(wt, bss, sta, key_info & WPA_KEY_INFO_TYPE_MASK, data, len);
+
+ if (!sta->ptk_set) {
+ wpa_printf(MSG_DEBUG, "No PTK known to process EAPOL-Key 2/4");
+ return;
+ }
+
+ if (check_mic(sta->ptk.kck, key_info & WPA_KEY_INFO_TYPE_MASK,
+ data, len) < 0) {
+ wpa_printf(MSG_INFO, "Mismatch in EAPOL-Key 2/4 MIC");
+ return;
+ }
+ wpa_printf(MSG_DEBUG, "Valid MIC found in EAPOL-Key 2/4");
+
+ key_data = (const u8 *) (hdr + 1);
+
+ if (wpa_supplicant_parse_ies(key_data, key_data_len, &ie) < 0) {
+ wpa_printf(MSG_INFO, "Failed to parse EAPOL-Key Key Data");
+ return;
+ }
+
+ if (ie.wpa_ie) {
+ wpa_hexdump(MSG_MSGDUMP, "EAPOL-Key Key Data - WPA IE",
+ ie.wpa_ie, ie.wpa_ie_len);
+ }
+
+ if (ie.rsn_ie) {
+ wpa_hexdump(MSG_MSGDUMP, "EAPOL-Key Key Data - RSN IE",
+ ie.rsn_ie, ie.rsn_ie_len);
+ }
}