[PATCH 01/15] wpa_supplicant: Give Security Profile RSNX caps precedence
Andrei Otcheretianski
andrei.otcheretianski at intel.com
Tue Nov 24 00:52:57 PST 2026
From: Ilan Peer <ilan.peer at intel.com>
Per IEEE P802.11bn/D2.1, 12.2.6, a STA with security profiles activated
uses the Extended RSN Capabilities field of the AP's Security Profile
element instead of the contents of the RSNXE, both for PASN and for
authentication and association. This was not done:
wpas_eppke_ap_rsnx_capab() ORs both sources, PASN other than EPPKE uses
only the RSNXE, the override in wpa_supplicant_set_suites() was
overwritten before use, and the other paths check only the RSNXE.
Add wpas_ap_rsnx_capab() that prefers the Security Profile element when
security profiles are active, make wpas_eppke_ap_rsnx_capab() and
wpas_pasn_ap_rsnx_capab() use it, and use it for all the other AP RSNX
capability checks.
Signed-off-by: Ilan Peer <ilan.peer at intel.com>
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
---
wpa_supplicant/ctrl_iface.c | 10 +-
wpa_supplicant/events.c | 29 +-----
wpa_supplicant/pasn_supplicant.c | 46 +++------
wpa_supplicant/sme.c | 52 ++---------
wpa_supplicant/wpa_supplicant.c | 149 ++++++++++++------------------
wpa_supplicant/wpa_supplicant_i.h | 3 +
6 files changed, 96 insertions(+), 193 deletions(-)
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 244f32d4cf..3a83122c35 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -3190,13 +3190,13 @@ static int wpa_supplicant_ctrl_iface_scan_result(
ie2, 2 + ie2[1]);
}
rsnxe = wpa_bss_get_rsnxe(wpa_s, bss, NULL, false);
- if (ieee802_11_rsnx_capab(rsnxe, WLAN_RSNX_CAPAB_SAE_H2E)) {
+ if (wpas_ap_rsnx_capab(wpa_s, bss, rsnxe, WLAN_RSNX_CAPAB_SAE_H2E)) {
ret = os_snprintf(pos, end - pos, "[SAE-H2E]");
if (os_snprintf_error(end - pos, ret))
return -1;
pos += ret;
}
- if (ieee802_11_rsnx_capab(rsnxe, WLAN_RSNX_CAPAB_SAE_PK)) {
+ if (wpas_ap_rsnx_capab(wpa_s, bss, rsnxe, WLAN_RSNX_CAPAB_SAE_PK)) {
ret = os_snprintf(pos, end - pos, "[SAE-PK]");
if (os_snprintf_error(end - pos, ret))
return -1;
@@ -5668,13 +5668,15 @@ static int print_bss_info(struct wpa_supplicant *wpa_s, struct wpa_bss *bss,
mesh ? "RSN" : "WPA2", ie2,
2 + ie2[1]);
rsnxe = wpa_bss_get_rsnxe(wpa_s, bss, NULL, false);
- if (ieee802_11_rsnx_capab(rsnxe, WLAN_RSNX_CAPAB_SAE_H2E)) {
+ if (wpas_ap_rsnx_capab(wpa_s, bss, rsnxe,
+ WLAN_RSNX_CAPAB_SAE_H2E)) {
ret = os_snprintf(pos, end - pos, "[SAE-H2E]");
if (os_snprintf_error(end - pos, ret))
return 0;
pos += ret;
}
- if (ieee802_11_rsnx_capab(rsnxe, WLAN_RSNX_CAPAB_SAE_PK)) {
+ if (wpas_ap_rsnx_capab(wpa_s, bss, rsnxe,
+ WLAN_RSNX_CAPAB_SAE_PK)) {
ret = os_snprintf(pos, end - pos, "[SAE-PK]");
if (os_snprintf_error(end - pos, ret))
return 0;
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 3eeb467090..b98a69a57f 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -1447,7 +1447,7 @@ static bool sae_pk_acceptable_bss_with_pk(struct wpa_supplicant *wpa_s,
if (bss == orig_bss)
continue;
ie = wpa_bss_get_rsnxe(wpa_s, bss, ssid, false);
- if (!(ieee802_11_rsnx_capab(ie, WLAN_RSNX_CAPAB_SAE_PK)))
+ if (!wpas_ap_rsnx_capab(wpa_s, bss, ie, WLAN_RSNX_CAPAB_SAE_PK))
continue;
/* TODO: Could be more thorough in checking what kind of
@@ -1490,29 +1490,10 @@ static bool wpa_scan_res_ok(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
#ifdef CONFIG_SAE
ie = wpa_bss_get_rsnxe(wpa_s, bss, ssid, false);
- if (ie && ie[0] == WLAN_EID_VENDOR_SPECIFIC && ie[1] >= 4 + 1)
- rsnxe_capa = ie[4 + 2];
- else if (ie && ie[1] >= 1)
- rsnxe_capa = ie[2];
-
- /*
- * Security Profile element preference (IEEE P802.11bn/D2.0, 37.33):
- * The Extended RSN Capabilities in the Security Profile element
- * take precedence over the RSNXE/RSNXOE. If the AP advertises a
- * Security Profile element, merge its RSNX capabilities related to SAE
- * into rsnxe_capa so that SAE H2E and SAE-PK checks below use the
- * security profile values.
- */
- if (wpas_security_profile_active(wpa_s)) {
- const u8 *sp_rsnx;
- size_t sp_rsnx_len;
- const u8 *sp = wpa_bss_get_ie_ext(
- bss, WLAN_EID_EXT_SECURITY_PROFILE);
-
- sp_rsnx = security_profile_get_rsnx(sp, &sp_rsnx_len);
- if (sp_rsnx && sp_rsnx_len >= 1)
- rsnxe_capa |= sp_rsnx[0] & 0xF0;
- }
+ if (wpas_ap_rsnx_capab(wpa_s, bss, ie, WLAN_RSNX_CAPAB_SAE_H2E))
+ rsnxe_capa |= BIT(WLAN_RSNX_CAPAB_SAE_H2E);
+ if (wpas_ap_rsnx_capab(wpa_s, bss, ie, WLAN_RSNX_CAPAB_SAE_PK))
+ rsnxe_capa |= BIT(WLAN_RSNX_CAPAB_SAE_PK);
#endif /* CONFIG_SAE */
check_ssid = wpa || ssid->ssid_len > 0;
diff --git a/wpa_supplicant/pasn_supplicant.c b/wpa_supplicant/pasn_supplicant.c
index 8b8498dba6..50202e4948 100644
--- a/wpa_supplicant/pasn_supplicant.c
+++ b/wpa_supplicant/pasn_supplicant.c
@@ -374,14 +374,14 @@ static int wpas_pasn_get_params_from_bss(struct wpa_supplicant *wpa_s,
#endif /* CONFIG_IEEE80211R */
#ifdef CONFIG_SAE
} else if ((sel & WPA_KEY_MGMT_SAE_EXT_KEY) && ssid &&
- (ieee802_11_rsnx_capab(rsnxe,
- WLAN_RSNX_CAPAB_SAE_H2E)) &&
+ wpas_ap_rsnx_capab(wpa_s, bss, rsnxe,
+ WLAN_RSNX_CAPAB_SAE_H2E) &&
(wpas_pasn_sae_setup_pt(ssid, group) == 0)) {
key_mgmt = WPA_KEY_MGMT_SAE_EXT_KEY;
wpa_printf(MSG_DEBUG, "PASN: using KEY_MGMT SAE (ext key)");
} else if ((sel & WPA_KEY_MGMT_SAE) && ssid &&
- (ieee802_11_rsnx_capab(rsnxe,
- WLAN_RSNX_CAPAB_SAE_H2E)) &&
+ wpas_ap_rsnx_capab(wpa_s, bss, rsnxe,
+ WLAN_RSNX_CAPAB_SAE_H2E) &&
(wpas_pasn_sae_setup_pt(ssid, group) == 0)) {
key_mgmt = WPA_KEY_MGMT_SAE;
wpa_printf(MSG_DEBUG, "PASN: using KEY_MGMT SAE");
@@ -941,19 +941,12 @@ static void wpas_pasn_sec_prof_eppke(struct wpa_supplicant *wpa_s,
#endif /* CONFIG_ENC_ASSOC */
-/*
- * The Security Profile element's copy of the Extended RSN Capabilities is
- * considered only for EPPKE. Other PASN uses the AP's RSNXE.
- */
static bool wpas_pasn_ap_rsnx_capab(struct wpa_supplicant *wpa_s,
- struct wpa_bss *bss, unsigned int auth_alg,
- unsigned int capab)
+ struct wpa_bss *bss, unsigned int capab)
{
- if (auth_alg == WLAN_AUTH_EPPKE)
- return wpas_eppke_ap_rsnx_capab(wpa_s, bss, capab);
-
- return ieee802_11_rsnx_capab(wpa_bss_get_rsnxe(wpa_s, bss, NULL, false),
- capab);
+ return wpas_ap_rsnx_capab(wpa_s, bss,
+ wpa_bss_get_rsnxe(wpa_s, bss, NULL, false),
+ capab);
}
@@ -1007,12 +1000,11 @@ static void wpas_pasn_auth_start_cb(struct wpa_radio_work *work, int deinit)
}
/*
- * Use the RSNXOE, if it was included, for actual AP capability check.
- * With EPPKE, the AP might omit or mask the RSNXE, so the Security
- * Profile element's copy of the Extended RSN Capabilities is also
- * considered.
+ * Use the RSNXOE, if it was included, for actual AP capability check,
+ * unless the Security Profile element's copy of the Extended RSN
+ * Capabilities takes precedence.
*/
- ap_secure_ltf = wpas_pasn_ap_rsnx_capab(wpa_s, bss, awork->auth_alg,
+ ap_secure_ltf = wpas_pasn_ap_rsnx_capab(wpa_s, bss,
WLAN_RSNX_CAPAB_SECURE_LTF);
derive_kdk = (wpa_s->drv_flags2 & WPA_DRIVER_FLAGS2_SEC_LTF_STA) &&
ap_secure_ltf;
@@ -1066,8 +1058,7 @@ static void wpas_pasn_auth_start_cb(struct wpa_radio_work *work, int deinit)
}
}
if ((wpa_s->drv_flags2 & WPA_DRIVER_FLAGS2_SPP_AMSDU) &&
- wpas_pasn_ap_rsnx_capab(wpa_s, bss, awork->auth_alg,
- WLAN_RSNX_CAPAB_SPP_A_MSDU))
+ wpas_pasn_ap_rsnx_capab(wpa_s, bss, WLAN_RSNX_CAPAB_SPP_A_MSDU))
capab |= BIT(WLAN_RSNX_CAPAB_SPP_A_MSDU);
ssid = wpa_config_get_network(wpa_s->conf, awork->network_id);
#ifdef CONFIG_ENC_ASSOC
@@ -1077,14 +1068,6 @@ static void wpas_pasn_auth_start_cb(struct wpa_radio_work *work, int deinit)
"EPPKE: No network profile found");
goto fail;
}
- /*
- * Security Profile element preference (IEEE P802.11bn/D2.0,
- * 37.33):
- * check both the AP RSNXE and the (unmasked) Extended
- * RSN Capabilities embedded in the Security Profile element --
- * the AP might mask capabilities from the RSNXE, but not from
- * the Security Profile element's copy.
- */
if (!wpas_eppke_ap_rsnx_capab(wpa_s, bss,
WLAN_RSNX_CAPAB_KEK_IN_PASN)) {
wpa_printf(MSG_INFO,
@@ -1318,8 +1301,7 @@ int wpas_pasn_auth_start(struct wpa_supplicant *wpa_s,
}
if (ltf_keyseed_required &&
- !wpas_pasn_ap_rsnx_capab(wpa_s, bss, auth_alg,
- WLAN_RSNX_CAPAB_SECURE_LTF)) {
+ !wpas_pasn_ap_rsnx_capab(wpa_s, bss, WLAN_RSNX_CAPAB_SECURE_LTF)) {
wpa_printf(MSG_DEBUG,
"PASN: LTF keyseed required but peer does not support Secure LTF");
return -1;
diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c
index 666a994b02..9a4b4b2dc4 100644
--- a/wpa_supplicant/sme.c
+++ b/wpa_supplicant/sme.c
@@ -337,31 +337,12 @@ static struct wpabuf * sme_auth_build_sae_commit(struct wpa_supplicant *wpa_s,
const u8 *rsnxe;
rsnxe = wpa_bss_get_rsnxe(wpa_s, bss, ssid, false);
- if (rsnxe && rsnxe[0] == WLAN_EID_VENDOR_SPECIFIC &&
- rsnxe[1] >= 1 + 4)
- rsnxe_capa = rsnxe[2 + 4];
- else if (rsnxe && rsnxe[1] >= 1)
- rsnxe_capa = rsnxe[2];
-
- /*
- * Security Profile element preference (IEEE P802.11bn/D2.0,
- * 37.33):
- * The Extended RSN Capabilities in the Security Profile element
- * take precedence over the RSNXE/RSNXOE. Merge the security
- * profile's RSNX capabilities related to SAE into rsnxe_capa so
- * that SAE H2E and SAE-PK checks below use the security
- * profile values.
- */
- if (wpas_security_profile_active(wpa_s)) {
- const u8 *sp_rsnx;
- size_t sp_rsnx_len;
- const u8 *sp = wpa_bss_get_ie_ext(
- bss, WLAN_EID_EXT_SECURITY_PROFILE);
-
- sp_rsnx = security_profile_get_rsnx(sp, &sp_rsnx_len);
- if (sp_rsnx && sp_rsnx_len >= 1)
- rsnxe_capa |= sp_rsnx[0] & 0xF0;
- }
+ if (wpas_ap_rsnx_capab(wpa_s, bss, rsnxe,
+ WLAN_RSNX_CAPAB_SAE_H2E))
+ rsnxe_capa |= BIT(WLAN_RSNX_CAPAB_SAE_H2E);
+ if (wpas_ap_rsnx_capab(wpa_s, bss, rsnxe,
+ WLAN_RSNX_CAPAB_SAE_PK))
+ rsnxe_capa |= BIT(WLAN_RSNX_CAPAB_SAE_PK);
}
sae_pwe = wpas_get_ssid_sae_pwe(wpa_s, ssid);
@@ -1599,13 +1580,6 @@ static int wpas_eppke_initialize(struct wpa_supplicant *wpa_s,
ap_rsnxe, ap_rsnxe_len);
}
- /*
- * Security Profile element preference (IEEE P802.11bn/D2.0, 37.33):
- * check both the AP RSNXE and the (unmasked) Extended RSN Capabilities
- * embedded in the Security Profile element -- the AP might mask
- * capabilities from the RSNXE, but not from the Security Profile
- * element's copy.
- */
if (!wpas_eppke_ap_rsnx_capab(wpa_s, bss, WLAN_RSNX_CAPAB_KEK_IN_PASN))
{
wpa_printf(MSG_DEBUG, "EPPKE: AP does not support KEK_IN_PASN");
@@ -1642,13 +1616,6 @@ static int wpas_eppke_initialize(struct wpa_supplicant *wpa_s,
(wpas_security_profile_active(wpa_s) &&
sec_prof_list_has_sae(ssid->security_profiles))) {
capab |= BIT(WLAN_RSNX_CAPAB_SAE_H2E);
- /*
- * Security Profile element preference (IEEE P802.11bn/D2.0,
- * 37.33): check both the AP RSNXE and the (unmasked)
- * Extended RSN Capabilities embedded in the Security Profile
- * element -- the AP might mask capabilities from the RSNXE,
- * butnot from the Security Profile element's copy.
- */
if (!wpas_eppke_ap_rsnx_capab(wpa_s, bss,
WLAN_RSNX_CAPAB_SAE_H2E)) {
wpa_printf(MSG_DEBUG,
@@ -4555,7 +4522,8 @@ static size_t wpas_get_kdk_len(struct wpa_supplicant *wpa_s)
rsnxe = wpa_bss_get_ie(wpa_s->current_bss, WLAN_EID_RSNX);
- if (rsnxe && ieee802_11_rsnx_capab(rsnxe, WLAN_RSNX_CAPAB_SECURE_LTF))
+ if (wpas_ap_rsnx_capab(wpa_s, wpa_s->current_bss, rsnxe,
+ WLAN_RSNX_CAPAB_SECURE_LTF))
return WPA_KDK_MAX_LEN;
return 0;
@@ -5597,8 +5565,8 @@ mscs_fail:
ssid->security_profiles)) &&
(wpa_s->drv_flags2 &
WPA_DRIVER_FLAGS2_ASSOCIATION_FRAME_ENCRYPTION) &&
- ieee802_11_rsnx_capab(ap_rsnxe,
- WLAN_RSNX_CAPAB_PMKSA_CACHING_PRIVACY)) {
+ wpas_ap_rsnx_capab(wpa_s, wpa_s->current_bss, ap_rsnxe,
+ WLAN_RSNX_CAPAB_PMKSA_CACHING_PRIVACY)) {
size_t len = 3 + NONCE_LEN;
u8 *pos;
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 329fb4b0ca..34950f6cf0 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -2152,8 +2152,6 @@ int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
#endif /* CONFIG_SAE */
const u8 *bss_wpa, *bss_rsn, *bss_rsnx;
const u8 *bss_sp = NULL; /* AP's Security Profile element */
- u8 sp_rsnx_buf[2 + 255]; /* Synthetic RSNXE from Security Profile
- * element */
bool wmm;
struct rsn_pmksa_cache_entry *pmksa;
const struct security_profile_entry *sel_sp = NULL;
@@ -2346,15 +2344,16 @@ int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
*
* 2. RSNX Capabilities: The Extended RSN Capabilities field in the
* Security Profile element takes precedence over the RSNXE/RSNXOE.
+ * This is handled by wpas_ap_rsnx_capab() for each capability
+ * check, since bss_rsnx needs to remain the AP's RSNXE for
+ * wpa_sm_set_ap_rsnxe().
*
- * Apply these overrides now so that all subsequent capability checks
- * (MFPC, ExtKeyID, SSID protection, association encryption, SPP A-MSDU,
- * etc.) use the security profile values.
+ * Apply the RSN Capabilities override now so that all subsequent
+ * capability checks (MFPC, ExtKeyID, etc.) use the security profile
+ * values.
*/
if (bss_sp && proto == WPA_PROTO_RSN) {
int sp_rsn_caps = security_profile_get_rsn_caps(bss_sp);
- size_t ext_rsnx_len;
- const u8 *ext_rsnx;
if (sp_rsn_caps && sp_rsn_caps != ie.capabilities) {
wpa_dbg(wpa_s, MSG_DEBUG,
@@ -2362,32 +2361,6 @@ int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
ie.capabilities, sp_rsn_caps);
ie.capabilities = sp_rsn_caps;
}
-
- /*
- * Override bss_rsnx with the Extended RSN Capabilities from
- * the Security Profile element. The field is encoded in the
- * same wire format as an RSNXE body (length prefix in bits
- * 0-3 of the first octet), so ieee802_11_rsnx_capab_len() can
- * consume it directly.
- *
- * We synthesise a minimal two-byte RSNXE header (EID=244,
- * Length) so that ieee802_11_rsnx_capab() - which expects a
- * full element starting at EID - works without modification.
- * The synthetic element is stored in a local buffer and
- * bss_rsnx is pointed at it for the remainder of this
- * function.
- */
- ext_rsnx = security_profile_get_rsnx(bss_sp, &ext_rsnx_len);
-
- if (ext_rsnx && ext_rsnx_len > 0 &&
- ext_rsnx_len <= sizeof(sp_rsnx_buf) - 2) {
- sp_rsnx_buf[0] = WLAN_EID_RSNX;
- sp_rsnx_buf[1] = (u8) ext_rsnx_len;
- os_memcpy(sp_rsnx_buf + 2, ext_rsnx, ext_rsnx_len);
- wpa_dbg(wpa_s, MSG_DEBUG,
- "RSN: Security Profile element overrides RSNX capabilities");
- bss_rsnx = sp_rsnx_buf;
- }
}
wpa_s->wpa_proto = proto;
@@ -2755,20 +2728,9 @@ int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
/* Enable SSID protection based on the AP advertising support
* for it to avoid potential interoperability issues with
* incorrect AP behavior if we were to send an "unexpected"
- * RSNXE with multiple octets of payload.
- *
- * Security Profile element preference (IEEE P802.11bn/D2.0,
- * 37.33):
- * bss_rsnx was already reassigned back to the AP's RSNXE
- * above (for wpa_sm_set_ap_rsnxe()), so also consult the
- * Security Profile element's unmasked copy here -- an AP
- * that strips this bit from its RSNXE still advertises the true
- * capability through the Security Profile element. */
- ssid_prot = ieee802_11_rsnx_capab(
- bss_rsnx, WLAN_RSNX_CAPAB_SSID_PROTECTION) ||
- (bss && wpas_eppke_ap_rsnx_capab(
- wpa_s, bss,
- WLAN_RSNX_CAPAB_SSID_PROTECTION));
+ * RSNXE with multiple octets of payload. */
+ ssid_prot = wpas_ap_rsnx_capab(
+ wpa_s, bss, bss_rsnx, WLAN_RSNX_CAPAB_SSID_PROTECTION);
if (!skip_default_rsne)
wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_SSID_PROTECTION,
proto == WPA_PROTO_RSN && ssid_prot);
@@ -2786,20 +2748,10 @@ int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
* advertising support for it to avoid potential
* interoperability issues with incorrect AP behavior if we
* were to send an "unexpected" RSNXE with multiple octets of
- * payload.
- *
- * Security Profile element preference (IEEE P802.11bn/D2.0,
- * 37.33):
- * bss_rsnx was already reassigned back to the AP's RSNXE above
- * (for wpa_sm_set_ap_rsnxe()), so also consult the
- * Security Profile element's unmasked copy here -- an AP
- * that strips this bit from its RSNXE still advertises the true
- * capability through the Security Profile element. */
- assoc_enc = ieee802_11_rsnx_capab(
- bss_rsnx, WLAN_RSNX_CAPAB_ASSOC_FRAME_ENCRYPTION) ||
- (bss && wpas_eppke_ap_rsnx_capab(
- wpa_s, bss,
- WLAN_RSNX_CAPAB_ASSOC_FRAME_ENCRYPTION));
+ * payload. */
+ assoc_enc = wpas_ap_rsnx_capab(
+ wpa_s, bss, bss_rsnx,
+ WLAN_RSNX_CAPAB_ASSOC_FRAME_ENCRYPTION);
if (!skip_default_rsne)
wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_ASSOC_ENC,
assoc_enc);
@@ -2810,8 +2762,8 @@ int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_SPP_AMSDU,
(wpa_s->drv_flags2 & WPA_DRIVER_FLAGS2_SPP_AMSDU) &&
- ieee802_11_rsnx_capab(bss_rsnx,
- WLAN_RSNX_CAPAB_SPP_A_MSDU) &&
+ wpas_ap_rsnx_capab(wpa_s, bss, bss_rsnx,
+ WLAN_RSNX_CAPAB_SPP_A_MSDU) &&
wpa_s->pairwise_cipher & (WPA_CIPHER_CCMP_256 |
WPA_CIPHER_GCMP_256 |
WPA_CIPHER_CCMP |
@@ -2910,8 +2862,8 @@ int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
wpa_bss_get_ie(bss, WLAN_EID_RSNX);
eap_over_auth =
- ieee802_11_rsnx_capab(
- bss_rsnxe,
+ wpas_ap_rsnx_capab(
+ wpa_s, bss, bss_rsnxe,
WLAN_RSNX_CAPAB_ASSOC_FRAME_ENCRYPTION) &&
(wpa_s->drv_flags2 &
WPA_DRIVER_FLAGS2_ASSOCIATION_FRAME_ENCRYPTION);
@@ -4592,39 +4544,54 @@ static bool wpas_set_802_1x_auth_alg(struct wpa_supplicant *wpa_s,
/*
- * wpas_eppke_ap_rsnx_capab - Check an RSNX capability bit for EPPKE purposes,
- * consulting both the AP's RSNXE and the (unmasked) Extended RSN
- * Capabilities embedded in its Security Profile element.
- *
- * The AP is expected to build the Security Profile element's Extended RSN
- * Capabilities field from the full, unmasked RSNXE while it might mask some
- * capabilities from the RSNXE. So a deployment that intentionally strips a
- * capability bit from the RSNXE can still advertise the true capability through
- * the Security Profile element, per IEEE P802.11bn/D2.0, 37.33 where the
- * Security Profile element takes precedence over the RSNXE. Treat the bit as
- * present if either source sets it.
+ * wpas_ap_rsnx_capab - Check an Extended RSN Capability of an AP
+ * @wpa_s: Pointer to wpa_supplicant data
+ * @bss: The BSS of the AP or %NULL
+ * @rsnxe: RSNXE (or RSNXOE) of the AP to fall back to or %NULL
+ * @capab: Extended RSN Capability (WLAN_RSNX_CAPAB_*) to check
+ * Returns: Whether the AP advertises the capability
*/
-bool wpas_eppke_ap_rsnx_capab(struct wpa_supplicant *wpa_s,
- struct wpa_bss *bss, unsigned int capab)
+bool wpas_ap_rsnx_capab(struct wpa_supplicant *wpa_s,
+ const struct wpa_bss *bss,
+ const u8 *rsnxe, unsigned int capab)
{
- const u8 *ap_rsnxe = wpa_bss_get_rsnxe(wpa_s, bss, NULL, false);
-
- if (ieee802_11_rsnx_capab(ap_rsnxe, capab))
- return true;
-
- if (wpas_security_profile_active(wpa_s)) {
- const u8 *sp_rsnx;
+ /*
+ * Per IEEE P802.11bn/D2.1, 12.2.6 the Extended RSN Capabilities field
+ * of the Security Profile element takes precedence over the RSNXE, so
+ * when security profiles are used and the AP advertises the field,
+ * the RSNXE is ignored.
+ */
+ if (bss && wpas_security_profile_active(wpa_s)) {
+ const u8 *sp, *sp_rsnx;
size_t sp_rsnx_len;
- const u8 *sp = wpa_bss_get_ie_ext(
- bss, WLAN_EID_EXT_SECURITY_PROFILE);
+ sp = wpa_bss_get_ie_ext(bss, WLAN_EID_EXT_SECURITY_PROFILE);
sp_rsnx = security_profile_get_rsnx(sp, &sp_rsnx_len);
- if (sp_rsnx &&
- ieee802_11_rsnx_capab_len(sp_rsnx, sp_rsnx_len, capab))
- return true;
+ if (sp_rsnx)
+ return ieee802_11_rsnx_capab_len(sp_rsnx, sp_rsnx_len,
+ capab);
}
- return false;
+ return ieee802_11_rsnx_capab(rsnxe, capab);
+}
+
+
+/*
+ * wpas_eppke_ap_rsnx_capab - Check an RSNX capability bit for EPPKE purposes
+ * using the AP's RSNXOE/RSNXE, or the Extended RSN Capabilities of its Security
+ * Profile element, which takes precedence (see wpas_ap_rsnx_capab()).
+ *
+ * @wpa_s: Pointer to wpa_supplicant data
+ * @bss: The BSS of the AP or %NULL
+ * @capab: Extended RSN Capability (WLAN_RSNX_CAPAB_*) to check
+ * Returns: Whether the AP advertises the capability
+ */
+bool wpas_eppke_ap_rsnx_capab(struct wpa_supplicant *wpa_s,
+ struct wpa_bss *bss, unsigned int capab)
+{
+ return wpas_ap_rsnx_capab(wpa_s, bss,
+ wpa_bss_get_rsnxe(wpa_s, bss, NULL, false),
+ capab);
}
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index a1d8029b67..7dcbfc8fd4 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -2288,6 +2288,9 @@ bool wpas_eppke_ap_capable(struct wpa_supplicant *wpa_s,
struct wpa_bss *bss, bool unauth_eppke);
bool wpas_eppke_ap_rsnx_capab(struct wpa_supplicant *wpa_s,
struct wpa_bss *bss, unsigned int capab);
+bool wpas_ap_rsnx_capab(struct wpa_supplicant *wpa_s,
+ const struct wpa_bss *bss,
+ const u8 *rsnxe, unsigned int capab);
bool wpas_security_profile_active(struct wpa_supplicant *wpa_s);
--
2.56.1
More information about the Hostap
mailing list