]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
SAE: Allow SAE-only network profile with sae_password to be written
authorSachin Shelke <sachin.shelke@nxp.com>
Sun, 1 Mar 2020 23:48:41 +0000 (05:18 +0530)
committerJouni Malinen <j@w1.fi>
Mon, 2 Mar 2020 09:49:19 +0000 (11:49 +0200)
The commit a34ca59e (SAE: Allow SAE password to be configured separately
(STA)) added sae_password configuration option. We should also consider
sae_password in the wpa_config_write() function which stores the valid
network block details to an external database.

Fixes: a34ca59e4db0 ("SAE: Allow SAE password to be configured separately (STA)")
Signed-off-by: Sachin Shelke <sachin.shelke@nxp.com>
Signed-off-by: Cathy Luo <xiaohua.luo@nxp.com>
Signed-off-by: Ganapathi Bhat <ganapathi.bhat@nxp.com>
src/common/defs.h
wpa_supplicant/config_file.c

index 1e21ec2de44893f52dd478264ed0ac7952a74607..6358c3158022724af53afa15534c57d10b66d1bf 100644 (file)
@@ -82,6 +82,13 @@ static inline int wpa_key_mgmt_wpa_ieee8021x(int akm)
                         WPA_KEY_MGMT_FT_FILS_SHA384));
 }
 
+static inline int wpa_key_mgmt_wpa_psk_no_sae(int akm)
+{
+       return !!(akm & (WPA_KEY_MGMT_PSK |
+                        WPA_KEY_MGMT_FT_PSK |
+                        WPA_KEY_MGMT_PSK_SHA256));
+}
+
 static inline int wpa_key_mgmt_wpa_psk(int akm)
 {
        return !!(akm & (WPA_KEY_MGMT_PSK |
index d100d74cb19ad7460147430026038490fcf07033..4c37b61a0787b51fbf7d6cee33c2a2979df03eed 100644 (file)
@@ -1642,8 +1642,11 @@ int wpa_config_write(const char *name, struct wpa_config *config)
        for (ssid = config->ssid; ssid; ssid = ssid->next) {
                if (ssid->key_mgmt == WPA_KEY_MGMT_WPS || ssid->temporary)
                        continue; /* do not save temporary networks */
-               if (wpa_key_mgmt_wpa_psk(ssid->key_mgmt) && !ssid->psk_set &&
-                   !ssid->passphrase)
+               if (wpa_key_mgmt_wpa_psk_no_sae(ssid->key_mgmt) &&
+                   !ssid->psk_set && !ssid->passphrase)
+                       continue; /* do not save invalid network */
+               if (wpa_key_mgmt_sae(ssid->key_mgmt) &&
+                   !ssid->passphrase && !ssid->sae_password)
                        continue; /* do not save invalid network */
                fprintf(f, "\nnetwork={\n");
                wpa_config_write_network(f, ssid);