]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
SAE: Allow SAE password to be configured separately (AP)
authorJouni Malinen <jouni@qca.qualcomm.com>
Wed, 11 Oct 2017 20:07:08 +0000 (23:07 +0300)
committerJouni Malinen <j@w1.fi>
Wed, 11 Oct 2017 20:10:19 +0000 (23:10 +0300)
The new sae_password hostapd configuration parameter can now be used to
set the SAE password instead of the previously used wpa_passphrase
parameter. This allows shorter than 8 characters and longer than 63
characters long passwords to be used. In addition, this makes it
possible to configure a BSS with both WPA-PSK and SAE enabled to use
different passphrase/password based on which AKM is selected.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
hostapd/config_file.c
hostapd/hostapd.conf
src/ap/ap_config.c
src/ap/ap_config.h
src/ap/ieee802_11.c

index fd3ad0a734735d30b147c39e535ccb8123aecf06..cd72f7a3109a8fdc1b756cd9fe51dad5d3249a7a 100644 (file)
@@ -3594,6 +3594,9 @@ static int hostapd_config_fill(struct hostapd_config *conf,
        } else if (os_strcmp(buf, "sae_commit_override") == 0) {
                wpabuf_free(bss->sae_commit_override);
                bss->sae_commit_override = wpabuf_parse_bin(pos);
+       } else if (os_strcmp(buf, "sae_password") == 0) {
+               os_free(bss->sae_password);
+               bss->sae_password = os_strdup(pos);
 #endif /* CONFIG_TESTING_OPTIONS */
        } else if (os_strcmp(buf, "vendor_elements") == 0) {
                if (parse_wpabuf_hex(line, buf, &bss->vendor_elements, pos))
index d2e884c59b628431fe8959aa83bbbd530afc490c..c25f2e494d7c6e4e02884b57894abdaf1f818685 100644 (file)
@@ -1378,6 +1378,15 @@ own_ip_addr=127.0.0.1
 # 1 = enabled
 #okc=1
 
+# SAE password
+# This parameter can be used to set a password for SAE. By default, the
+# wpa_passphrase value is used if this separate parameter is not used, but
+# wpa_passphrase follows the WPA-PSK constraints (8..63 characters) even though
+# SAE passwords do not have such constraints. If the BSS enabled both SAE and
+# WPA-PSK and both values are set, SAE uses the sae_password value and WPA-PSK
+# uses the wpa_passphrase value.
+#sae_password=secret
+
 # SAE threshold for anti-clogging mechanism (dot11RSNASAEAntiCloggingThreshold)
 # This parameter defines how many open SAE instances can be in progress at the
 # same time before the anti-clogging mechanism is taken into use.
index 0e1ab02b54e2d3e93ee7f7bc3a69c9ca4ea24806..10cacfb8ab9fdca7dabe030dbfc26699cc2a7ac7 100644 (file)
@@ -634,6 +634,8 @@ void hostapd_config_free_bss(struct hostapd_bss_config *conf)
        wpabuf_free(conf->dpp_csign);
 #endif /* CONFIG_DPP */
 
+       os_free(conf->sae_password);
+
        os_free(conf);
 }
 
index 76929250ad764cf389672f2ab338d4171bb4eb52..124ff4a07f962451b7120c517fb7fcc760ba2a4e 100644 (file)
@@ -582,6 +582,7 @@ struct hostapd_bss_config {
 
        unsigned int sae_anti_clogging_threshold;
        int *sae_groups;
+       char *sae_password;
 
        char *wowlan_triggers; /* Wake-on-WLAN triggers */
 
index e0edcc53c81296e1a731d4ada06f81dffa8c0f92..7146d3dcfeb8a273352ca03b41d7ff5bd1dc275a 100644 (file)
@@ -361,16 +361,19 @@ static struct wpabuf * auth_build_sae_commit(struct hostapd_data *hapd,
                                             struct sta_info *sta, int update)
 {
        struct wpabuf *buf;
+       const char *password;
 
-       if (hapd->conf->ssid.wpa_passphrase == NULL) {
+       password = hapd->conf->sae_password;
+       if (!password)
+               password = hapd->conf->ssid.wpa_passphrase;
+       if (!password) {
                wpa_printf(MSG_DEBUG, "SAE: No password available");
                return NULL;
        }
 
        if (update &&
            sae_prepare_commit(hapd->own_addr, sta->addr,
-                              (u8 *) hapd->conf->ssid.wpa_passphrase,
-                              os_strlen(hapd->conf->ssid.wpa_passphrase),
+                              (u8 *) password, os_strlen(password),
                               sta->sae) < 0) {
                wpa_printf(MSG_DEBUG, "SAE: Could not pick PWE");
                return NULL;