[PATCH 4/6] SAE: Add sae_password to wpas global password list
Peter Åstrand
astrand at lysator.liu.se
Fri Jan 22 09:58:43 EST 2021
For Mesh, add the global password list to bss->conf.
Signed-off-by: Peter Astrand <peter.astrand at etteplan.com>
---
wpa_supplicant/ap.c | 25 -------------------------
wpa_supplicant/mesh.c | 3 +++
wpa_supplicant/wpa_supplicant.c | 24 ++++++++++++++++++++++++
3 files changed, 27 insertions(+), 25 deletions(-)
diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c
index e0185ac2d..2405ccb60 100644
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -479,31 +479,6 @@ static int wpa_supplicant_conf_ap(struct wpa_supplicant *wpa_s,
/* Add all global SAE passwords */
bss->sae_passwords = wpa_s->conf->sae_passwords;
- if (ssid->sae_password) {
- struct sae_password_entry *pw;
-
- pw = os_zalloc(sizeof(*pw));
- if (!pw)
- return -1;
- os_memset(pw->peer_addr, 0xff, ETH_ALEN);
- pw->password = os_strdup(ssid->sae_password);
- if (!pw->password) {
- os_free(pw);
- return -1;
- }
- if (ssid->sae_password_id) {
- pw->identifier = os_strdup(ssid->sae_password_id);
- if (!pw->identifier) {
- str_clear_free(pw->password);
- os_free(pw);
- return -1;
- }
- }
-
- pw->next = bss->sae_passwords;
- bss->sae_passwords = pw;
- }
-
bss->sae_pwe = wpa_s->conf->sae_pwe;
#endif /* CONFIG_SAE */
diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c
index 34be40a40..2d31a6123 100644
--- a/wpa_supplicant/mesh.c
+++ b/wpa_supplicant/mesh.c
@@ -199,6 +199,9 @@ static int wpas_mesh_init_rsn(struct wpa_supplicant *wpa_s)
len = os_strlen(password);
bss->conf->ssid.wpa_passphrase = dup_binstr(password, len);
+ /* Add all global SAE passwords */
+ bss->conf->sae_passwords = wpa_s->conf->sae_passwords;
+
wpa_s->mesh_rsn = mesh_rsn_auth_init(wpa_s, ifmsh->mconf);
return !wpa_s->mesh_rsn ? -1 : 0;
}
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index c3e747260..dd120a0b2 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -2078,6 +2078,30 @@ static void wpa_s_setup_sae_pt(struct wpa_config *conf, struct wpa_ssid *ssid)
int default_groups[] = { 19, 20, 21, 0 };
const char *password;
+ /* Add ssid SAE password to global list */
+ if (ssid->sae_password) {
+ pw = os_zalloc(sizeof(*pw));
+ if (!pw)
+ return;
+ os_memset(pw->peer_addr, 0xff, ETH_ALEN);
+ pw->password = os_strdup(ssid->sae_password);
+ if (!pw->password) {
+ os_free(pw);
+ return;
+ }
+ if (ssid->sae_password_id) {
+ pw->identifier = os_strdup(ssid->sae_password_id);
+ if (!pw->identifier) {
+ str_clear_free(pw->password);
+ os_free(pw);
+ return;
+ }
+ }
+
+ pw->next = conf->sae_passwords;
+ conf->sae_passwords = pw;
+ }
+
if (!groups || groups[0] <= 0)
groups = default_groups;
--
2.17.1
Br,
Peter Åstrand
More information about the Hostap
mailing list