Add more verbose debugging for EAPOL-Key Key Data field IEs/KDEs

This commit is contained in:
Jouni Malinen 2010-04-10 21:42:01 +03:00
parent 55046414b1
commit 48de343cd4
2 changed files with 47 additions and 0 deletions

View file

@ -416,6 +416,8 @@ static int wpa_parse_generic(const u8 *pos, const u8 *end,
pos[2 + WPA_SELECTOR_LEN + 1] == 0) { pos[2 + WPA_SELECTOR_LEN + 1] == 0) {
ie->wpa_ie = pos; ie->wpa_ie = pos;
ie->wpa_ie_len = pos[1] + 2; ie->wpa_ie_len = pos[1] + 2;
wpa_hexdump(MSG_DEBUG, "WPA: WPA IE in EAPOL-Key",
ie->wpa_ie, ie->wpa_ie_len);
return 0; return 0;
} }
@ -423,6 +425,8 @@ static int wpa_parse_generic(const u8 *pos, const u8 *end,
pos[1] >= RSN_SELECTOR_LEN + PMKID_LEN && pos[1] >= RSN_SELECTOR_LEN + PMKID_LEN &&
RSN_SELECTOR_GET(pos + 2) == RSN_KEY_DATA_PMKID) { RSN_SELECTOR_GET(pos + 2) == RSN_KEY_DATA_PMKID) {
ie->pmkid = pos + 2 + RSN_SELECTOR_LEN; ie->pmkid = pos + 2 + RSN_SELECTOR_LEN;
wpa_hexdump(MSG_DEBUG, "WPA: PMKID in EAPOL-Key",
pos, pos[1] + 2);
return 0; return 0;
} }
@ -430,6 +434,8 @@ static int wpa_parse_generic(const u8 *pos, const u8 *end,
RSN_SELECTOR_GET(pos + 2) == RSN_KEY_DATA_GROUPKEY) { RSN_SELECTOR_GET(pos + 2) == RSN_KEY_DATA_GROUPKEY) {
ie->gtk = pos + 2 + RSN_SELECTOR_LEN; ie->gtk = pos + 2 + RSN_SELECTOR_LEN;
ie->gtk_len = pos[1] - RSN_SELECTOR_LEN; ie->gtk_len = pos[1] - RSN_SELECTOR_LEN;
wpa_hexdump_key(MSG_DEBUG, "WPA: GTK in EAPOL-Key",
pos, pos[1] + 2);
return 0; return 0;
} }
@ -437,6 +443,8 @@ static int wpa_parse_generic(const u8 *pos, const u8 *end,
RSN_SELECTOR_GET(pos + 2) == RSN_KEY_DATA_MAC_ADDR) { RSN_SELECTOR_GET(pos + 2) == RSN_KEY_DATA_MAC_ADDR) {
ie->mac_addr = pos + 2 + RSN_SELECTOR_LEN; ie->mac_addr = pos + 2 + RSN_SELECTOR_LEN;
ie->mac_addr_len = pos[1] - RSN_SELECTOR_LEN; ie->mac_addr_len = pos[1] - RSN_SELECTOR_LEN;
wpa_hexdump(MSG_DEBUG, "WPA: MAC Address in EAPOL-Key",
pos, pos[1] + 2);
return 0; return 0;
} }
@ -445,6 +453,8 @@ static int wpa_parse_generic(const u8 *pos, const u8 *end,
RSN_SELECTOR_GET(pos + 2) == RSN_KEY_DATA_SMK) { RSN_SELECTOR_GET(pos + 2) == RSN_KEY_DATA_SMK) {
ie->smk = pos + 2 + RSN_SELECTOR_LEN; ie->smk = pos + 2 + RSN_SELECTOR_LEN;
ie->smk_len = pos[1] - RSN_SELECTOR_LEN; ie->smk_len = pos[1] - RSN_SELECTOR_LEN;
wpa_hexdump_key(MSG_DEBUG, "WPA: SMK in EAPOL-Key",
pos, pos[1] + 2);
return 0; return 0;
} }
@ -452,6 +462,8 @@ static int wpa_parse_generic(const u8 *pos, const u8 *end,
RSN_SELECTOR_GET(pos + 2) == RSN_KEY_DATA_NONCE) { RSN_SELECTOR_GET(pos + 2) == RSN_KEY_DATA_NONCE) {
ie->nonce = pos + 2 + RSN_SELECTOR_LEN; ie->nonce = pos + 2 + RSN_SELECTOR_LEN;
ie->nonce_len = pos[1] - RSN_SELECTOR_LEN; ie->nonce_len = pos[1] - RSN_SELECTOR_LEN;
wpa_hexdump(MSG_DEBUG, "WPA: Nonce in EAPOL-Key",
pos, pos[1] + 2);
return 0; return 0;
} }
@ -459,6 +471,8 @@ static int wpa_parse_generic(const u8 *pos, const u8 *end,
RSN_SELECTOR_GET(pos + 2) == RSN_KEY_DATA_LIFETIME) { RSN_SELECTOR_GET(pos + 2) == RSN_KEY_DATA_LIFETIME) {
ie->lifetime = pos + 2 + RSN_SELECTOR_LEN; ie->lifetime = pos + 2 + RSN_SELECTOR_LEN;
ie->lifetime_len = pos[1] - RSN_SELECTOR_LEN; ie->lifetime_len = pos[1] - RSN_SELECTOR_LEN;
wpa_hexdump(MSG_DEBUG, "WPA: Lifetime in EAPOL-Key",
pos, pos[1] + 2);
return 0; return 0;
} }
@ -466,6 +480,8 @@ static int wpa_parse_generic(const u8 *pos, const u8 *end,
RSN_SELECTOR_GET(pos + 2) == RSN_KEY_DATA_ERROR) { RSN_SELECTOR_GET(pos + 2) == RSN_KEY_DATA_ERROR) {
ie->error = pos + 2 + RSN_SELECTOR_LEN; ie->error = pos + 2 + RSN_SELECTOR_LEN;
ie->error_len = pos[1] - RSN_SELECTOR_LEN; ie->error_len = pos[1] - RSN_SELECTOR_LEN;
wpa_hexdump(MSG_DEBUG, "WPA: Error in EAPOL-Key",
pos, pos[1] + 2);
return 0; return 0;
} }
#endif /* CONFIG_PEERKEY */ #endif /* CONFIG_PEERKEY */
@ -475,6 +491,8 @@ static int wpa_parse_generic(const u8 *pos, const u8 *end,
RSN_SELECTOR_GET(pos + 2) == RSN_KEY_DATA_IGTK) { RSN_SELECTOR_GET(pos + 2) == RSN_KEY_DATA_IGTK) {
ie->igtk = pos + 2 + RSN_SELECTOR_LEN; ie->igtk = pos + 2 + RSN_SELECTOR_LEN;
ie->igtk_len = pos[1] - RSN_SELECTOR_LEN; ie->igtk_len = pos[1] - RSN_SELECTOR_LEN;
wpa_hexdump_key(MSG_DEBUG, "WPA: IGTK in EAPOL-Key",
pos, pos[1] + 2);
return 0; return 0;
} }
#endif /* CONFIG_IEEE80211W */ #endif /* CONFIG_IEEE80211W */
@ -515,10 +533,35 @@ int wpa_supplicant_parse_ies(const u8 *buf, size_t len,
if (*pos == WLAN_EID_RSN) { if (*pos == WLAN_EID_RSN) {
ie->rsn_ie = pos; ie->rsn_ie = pos;
ie->rsn_ie_len = pos[1] + 2; ie->rsn_ie_len = pos[1] + 2;
wpa_hexdump(MSG_DEBUG, "WPA: RSN IE in EAPOL-Key",
ie->rsn_ie, ie->rsn_ie_len);
#ifdef CONFIG_IEEE80211R #ifdef CONFIG_IEEE80211R
} else if (*pos == WLAN_EID_MOBILITY_DOMAIN) { } else if (*pos == WLAN_EID_MOBILITY_DOMAIN) {
ie->mdie = pos; ie->mdie = pos;
ie->mdie_len = pos[1] + 2; ie->mdie_len = pos[1] + 2;
wpa_hexdump(MSG_DEBUG, "WPA: MDIE in EAPOL-Key",
ie->mdie, ie->mdie_len);
} else if (*pos == WLAN_EID_FAST_BSS_TRANSITION) {
ie->ftie = pos;
ie->ftie_len = pos[1] + 2;
wpa_hexdump(MSG_DEBUG, "WPA: FTIE in EAPOL-Key",
ie->ftie, ie->ftie_len);
} else if (*pos == WLAN_EID_TIMEOUT_INTERVAL && pos[1] >= 5) {
if (pos[2] == WLAN_TIMEOUT_REASSOC_DEADLINE) {
ie->reassoc_deadline = pos;
wpa_hexdump(MSG_DEBUG, "WPA: Reassoc Deadline "
"in EAPOL-Key",
ie->reassoc_deadline, pos[1] + 2);
} else if (pos[2] == WLAN_TIMEOUT_KEY_LIFETIME) {
ie->key_lifetime = pos;
wpa_hexdump(MSG_DEBUG, "WPA: KeyLifetime "
"in EAPOL-Key",
ie->key_lifetime, pos[1] + 2);
} else {
wpa_hexdump(MSG_DEBUG, "WPA: Unrecognized "
"EAPOL-Key Key Data IE",
pos, 2 + pos[1]);
}
#endif /* CONFIG_IEEE80211R */ #endif /* CONFIG_IEEE80211R */
} else if (*pos == WLAN_EID_VENDOR_SPECIFIC) { } else if (*pos == WLAN_EID_VENDOR_SPECIFIC) {
ret = wpa_parse_generic(pos, end, ie); ret = wpa_parse_generic(pos, end, ie);

View file

@ -42,6 +42,10 @@ struct wpa_eapol_ie_parse {
#ifdef CONFIG_IEEE80211R #ifdef CONFIG_IEEE80211R
const u8 *mdie; const u8 *mdie;
size_t mdie_len; size_t mdie_len;
const u8 *ftie;
size_t ftie_len;
const u8 *reassoc_deadline;
const u8 *key_lifetime;
#endif /* CONFIG_IEEE80211R */ #endif /* CONFIG_IEEE80211R */
}; };