[PATCH] rsn_supp: Don't encrypt EAPOL-Key 4/4.

Nicolas Cavallari Nicolas.Cavallari at lri.fr
Mon Feb 6 12:39:02 EST 2012

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 <cavallar at lri.fr>

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,
+	// 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;

More information about the HostAP mailing list