From 76793cbbcacd35828b438f541c75000216a587f7 Mon Sep 17 00:00:00 2001 From: Veerendranath Jakkam Date: Mon, 8 Aug 2022 15:48:53 +0530 Subject: [PATCH] SAE: Make sure H2E PT is derived for external auth SSID profile The driver's SME may choose a BSS of a different ESS (SSID) compared to the current SSID and trigger external authentication. If the chosen SSID is not associated/selected before by wpa_supplicant it won't have the H2E PT derived. Make sure to derive PT for SSID indicated in the external authentication request. Signed-off-by: Veerendranath Jakkam --- wpa_supplicant/sme.c | 6 +++++- wpa_supplicant/wpa_supplicant.c | 2 +- wpa_supplicant/wpa_supplicant_i.h | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c index 2dad36ddc..af761243b 100644 --- a/wpa_supplicant/sme.c +++ b/wpa_supplicant/sme.c @@ -1136,8 +1136,12 @@ static int sme_handle_external_auth_start(struct wpa_supplicant *wpa_s, if (!wpas_network_disabled(wpa_s, ssid) && ssid_str_len == ssid->ssid_len && os_memcmp(ssid_str, ssid->ssid, ssid_str_len) == 0 && - (ssid->key_mgmt & (WPA_KEY_MGMT_SAE | WPA_KEY_MGMT_FT_SAE))) + (ssid->key_mgmt & (WPA_KEY_MGMT_SAE | + WPA_KEY_MGMT_FT_SAE))) { + /* Make sure PT is derived */ + wpa_s_setup_sae_pt(wpa_s->conf, ssid); break; + } } if (!ssid || sme_external_auth_send_sae_commit(wpa_s, data->external_auth.bssid, diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index deb51a721..4e79402b7 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -2257,7 +2257,7 @@ int wpas_update_random_addr_disassoc(struct wpa_supplicant *wpa_s) } -static void wpa_s_setup_sae_pt(struct wpa_config *conf, struct wpa_ssid *ssid) +void wpa_s_setup_sae_pt(struct wpa_config *conf, struct wpa_ssid *ssid) { #ifdef CONFIG_SAE int *groups = conf->sae_groups; diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index 076081ec8..f027bd64b 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -1833,6 +1833,7 @@ static inline int wpas_mode_to_ieee80211_mode(enum wpas_mode mode) int wpas_network_disabled(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid); int wpas_get_ssid_pmf(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid); int pmf_in_use(struct wpa_supplicant *wpa_s, const u8 *addr); +void wpa_s_setup_sae_pt(struct wpa_config *conf, struct wpa_ssid *ssid); int wpas_init_ext_pw(struct wpa_supplicant *wpa_s);