From patchwork Mon Feb 6 17:39:02 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: rsn_supp: Don't encrypt EAPOL-Key 4/4. Date: Mon, 06 Feb 2012 07:39:02 -0000 From: Nicolas Cavallari X-Patchwork-Id: 139777 Message-Id: <1328549942-10112-1-git-send-email-cavallar@lri.fr> To: hostap@lists.shmoo.com When the 4/4 pairwise handshake is lost, the authenticator will retry 3/4 and we would resent 4/4, but encrypted. 802.11 spec implies that EAPOL 4/4 should not be encrypted, but because setprotection is not implemented by any (non-testing) driver, clear the key before sending EAPOL-Key 4/4 and reset the key just after. Signed-hostap: Nicolas Cavallari --- This is just a proposed solution to a problem that i'm having. I don't think it is the best nor it does not break something else, so i'm asking what would be the right approach here. I was also thinking about reusing hostapd's eapol_send. I'm currently experimenting with a IBSS RSN network of 4 station, but while testing, there are always two or more handshakes that fails, because of a lost EAPOL-Key 4/4 frame. In IBSS mode, the two station will not retry association, so the network will not recover and will eventually split. Also, between the time where 3/4 was received by the supplicant and 4/4 was received by the authenticator, the opposite four way handshake is stalled for the same reason. diff --git a/src/rsn_supp/wpa.c b/src/rsn_supp/wpa.c index 225489e..b24cc53 100644 --- a/src/rsn_supp/wpa.c +++ b/src/rsn_supp/wpa.c @@ -1141,6 +1141,9 @@ static void wpa_supplicant_process_3_of_4(struct wpa_sm *sm, break; } + // Reset the PTK just before sending, so we don't sent 4/4 encrypted. + wpa_sm_set_key(sm, WPA_ALG_NONE, sm->bssid, 0, 0, NULL, 0, NULL, 0); + if (wpa_supplicant_send_4_of_4(sm, sm->bssid, key, ver, key_info, NULL, 0, &sm->ptk)) { goto failed;