]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
SAE H2E: Do not use sae_h2e param in AP mode if SAE is disabled
authorJouni Malinen <jouni@codeaurora.org>
Thu, 28 Nov 2019 22:07:57 +0000 (00:07 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 28 Nov 2019 22:07:57 +0000 (00:07 +0200)
Previously, nonzero sae_h2e parameter values were used to perform SAE
H2E specific operations (deriving PT, adding RSNXE, adding H2E-only BSS
membership selector) in AP mode even if SAE was not enabled for the
network. This could result in unexpected behavior if sae_pwe=1 or
sae_pwe=2 were set in the configuration. Fix this by making the SAE
operations conditional on SAE being actually enabled.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
src/ap/ap_config.c
src/ap/ieee802_11.c
src/ap/ieee802_11_shared.c

index 58fc3e9880236a4c685c15cd0a6856ac9658f232..d4a3404846ca088f0b3004ce9c1f81835d97fa59 100644 (file)
@@ -441,7 +441,7 @@ int hostapd_setup_sae_pt(struct hostapd_bss_config *conf)
        struct hostapd_ssid *ssid = &conf->ssid;
        struct sae_password_entry *pw;
 
-       if (conf->sae_pwe == 0)
+       if (conf->sae_pwe == 0 || !wpa_key_mgmt_sae(conf->wpa_key_mgmt))
                return 0; /* PT not needed */
 
        sae_deinit_pt(ssid->pt);
index 92ae026e5f7bb6e9673bc8ba5f5842706d35f43b..07723d0cf4c27fe908ea93bc7f61c3622ac3239e 100644 (file)
@@ -98,7 +98,8 @@ u8 * hostapd_eid_supp_rates(struct hostapd_data *hapd, u8 *eid)
                num++;
        if (hapd->iconf->ieee80211ac && hapd->iconf->require_vht)
                num++;
-       if (hapd->conf->sae_pwe == 1)
+       if (hapd->conf->sae_pwe == 1 &&
+           wpa_key_mgmt_sae(hapd->conf->wpa_key_mgmt))
                num++;
        if (num > 8) {
                /* rest of the rates are encoded in Extended supported
@@ -126,7 +127,9 @@ u8 * hostapd_eid_supp_rates(struct hostapd_data *hapd, u8 *eid)
                *pos++ = 0x80 | BSS_MEMBERSHIP_SELECTOR_VHT_PHY;
        }
 
-       if (hapd->conf->sae_pwe == 1 && count < 8) {
+       if (hapd->conf->sae_pwe == 1 &&
+           wpa_key_mgmt_sae(hapd->conf->wpa_key_mgmt) &&
+           count < 8) {
                count++;
                *pos++ = 0x80 | BSS_MEMBERSHIP_SELECTOR_SAE_H2E_ONLY;
        }
@@ -148,7 +151,8 @@ u8 * hostapd_eid_ext_supp_rates(struct hostapd_data *hapd, u8 *eid)
                num++;
        if (hapd->iconf->ieee80211ac && hapd->iconf->require_vht)
                num++;
-       if (hapd->conf->sae_pwe == 1)
+       if (hapd->conf->sae_pwe == 1 &&
+           wpa_key_mgmt_sae(hapd->conf->wpa_key_mgmt))
                num++;
        if (num <= 8)
                return eid;
@@ -179,7 +183,8 @@ u8 * hostapd_eid_ext_supp_rates(struct hostapd_data *hapd, u8 *eid)
                        *pos++ = 0x80 | BSS_MEMBERSHIP_SELECTOR_VHT_PHY;
        }
 
-       if (hapd->conf->sae_pwe == 1) {
+       if (hapd->conf->sae_pwe == 1 &&
+           wpa_key_mgmt_sae(hapd->conf->wpa_key_mgmt)) {
                count++;
                if (count > 8)
                        *pos++ = 0x80 | BSS_MEMBERSHIP_SELECTOR_SAE_H2E_ONLY;
index 0b828e96f3e56f7ab970bfb8687c1bbeed2ad88e..1e1cc3825a4b19667bf1caa1081cedcfb396da61 100644 (file)
@@ -1011,6 +1011,7 @@ u8 * hostapd_eid_rsnxe(struct hostapd_data *hapd, u8 *eid, size_t len)
        u8 *pos = eid;
 
        if (!(hapd->conf->wpa & WPA_PROTO_RSN) ||
+           !wpa_key_mgmt_sae(hapd->conf->wpa_key_mgmt) ||
            (hapd->conf->sae_pwe != 1 && hapd->conf->sae_pwe != 2) ||
            len < 3)
                return pos;