From e3c476bd8c88b54fafc325574ecc5f0fd39365f2 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 13 Dec 2019 03:05:38 +0200 Subject: [PATCH] SAE H2E: Fix RSNXE override in EAPOL-Key msg 2/4 for testing purposes The previous implementation missed the case where EAPOL-Key frame may be reported as having been received before the association event is processed. This would have resulted in not using the RSNXE override for EAPOL-Key msg 2/4 when the pending EAPOL-Key frame gets processed immediately after processing the association event. Fix this by moving the override case to be handled before that. Fixes: 132565539784 ("SAE H2E: RSNXE override for testing purposes") Signed-off-by: Jouni Malinen --- wpa_supplicant/events.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 2316037e2..852f41e40 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -2946,6 +2946,16 @@ static void wpa_supplicant_event_assoc(struct wpa_supplicant *wpa_s, wpa_s->last_eapol_matches_bssid = 0; +#ifdef CONFIG_TESTING_OPTIONS + if (wpa_s->rsnxe_override_eapol) { + wpa_printf(MSG_DEBUG, + "TESTING: RSNXE EAPOL-Key msg 2/4 override"); + wpa_sm_set_assoc_rsnxe(wpa_s->wpa, + wpabuf_head(wpa_s->rsnxe_override_eapol), + wpabuf_len(wpa_s->rsnxe_override_eapol)); + } +#endif /* CONFIG_TESTING_OPTIONS */ + if (wpa_s->pending_eapol_rx) { struct os_reltime now, age; os_get_reltime(&now); @@ -3017,16 +3027,6 @@ static void wpa_supplicant_event_assoc(struct wpa_supplicant *wpa_s, #ifdef CONFIG_MBO wpas_mbo_check_pmf(wpa_s, bss, wpa_s->current_ssid); #endif /* CONFIG_MBO */ - -#ifdef CONFIG_TESTING_OPTIONS - if (wpa_s->rsnxe_override_eapol) { - wpa_printf(MSG_DEBUG, - "TESTING: RSNXE EAPOL-Key msg 2/4 override"); - wpa_sm_set_assoc_rsnxe(wpa_s->wpa, - wpabuf_head(wpa_s->rsnxe_override_eapol), - wpabuf_len(wpa_s->rsnxe_override_eapol)); - } -#endif /* CONFIG_TESTING_OPTIONS */ }