From f636cbd04822afe2679e6854bee7c80a5c6cdb9a Mon Sep 17 00:00:00 2001 From: Vinay Gannevaram Date: Sun, 18 Sep 2022 18:57:31 +0530 Subject: [PATCH] PASN: Remove wpa_s dependency for SAE wrapped data functions Use struct wpas_pasn (i.e., &wpa_s->pasn) as the function argument for the SAE functionality that does not need the full struct wpa_supplicant context. This is a step towards allowing PASN to be used outside the context of wpa_supplicant. Signed-off-by: Jouni Malinen --- wpa_supplicant/pasn_supplicant.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/wpa_supplicant/pasn_supplicant.c b/wpa_supplicant/pasn_supplicant.c index 2c8c086eb..62a853922 100644 --- a/wpa_supplicant/pasn_supplicant.c +++ b/wpa_supplicant/pasn_supplicant.c @@ -102,9 +102,8 @@ static void wpas_pasn_auth_status(struct wpa_supplicant *wpa_s, const u8 *bssid, #ifdef CONFIG_SAE -static struct wpabuf * wpas_pasn_wd_sae_commit(struct wpa_supplicant *wpa_s) +static struct wpabuf * wpas_pasn_wd_sae_commit(struct wpas_pasn *pasn) { - struct wpas_pasn *pasn = &wpa_s->pasn; struct wpabuf *buf = NULL; int ret; @@ -140,9 +139,8 @@ static struct wpabuf * wpas_pasn_wd_sae_commit(struct wpa_supplicant *wpa_s) } -static int wpas_pasn_wd_sae_rx(struct wpa_supplicant *wpa_s, struct wpabuf *wd) +static int wpas_pasn_wd_sae_rx(struct wpas_pasn *pasn, struct wpabuf *wd) { - struct wpas_pasn *pasn = &wpa_s->pasn; const u8 *data; size_t buf_len; u16 len, res, alg, seq, status; @@ -240,9 +238,8 @@ static int wpas_pasn_wd_sae_rx(struct wpa_supplicant *wpa_s, struct wpabuf *wd) } -static struct wpabuf * wpas_pasn_wd_sae_confirm(struct wpa_supplicant *wpa_s) +static struct wpabuf * wpas_pasn_wd_sae_confirm(struct wpas_pasn *pasn) { - struct wpas_pasn *pasn = &wpa_s->pasn; struct wpabuf *buf = NULL; /* Need to add the entire authentication frame body */ @@ -876,9 +873,9 @@ static struct wpabuf * wpas_pasn_get_wrapped_data(struct wpa_supplicant *wpa_s) case WPA_KEY_MGMT_SAE: #ifdef CONFIG_SAE if (pasn->trans_seq == 0) - return wpas_pasn_wd_sae_commit(wpa_s); + return wpas_pasn_wd_sae_commit(pasn); if (pasn->trans_seq == 2) - return wpas_pasn_wd_sae_confirm(wpa_s); + return wpas_pasn_wd_sae_confirm(pasn); #endif /* CONFIG_SAE */ wpa_printf(MSG_ERROR, "PASN: SAE: Cannot derive wrapped data"); @@ -1236,7 +1233,7 @@ static int wpas_pasn_set_pmk(struct wpa_supplicant *wpa_s, if (pasn->akmp == WPA_KEY_MGMT_SAE) { int ret; - ret = wpas_pasn_wd_sae_rx(wpa_s, wrapped_data); + ret = wpas_pasn_wd_sae_rx(pasn, wrapped_data); if (ret) { wpa_printf(MSG_DEBUG, "PASN: Failed processing SAE wrapped data");