Skip to contentSkip to conversation

wifi: brcmfmac: configure SAE PWE method for external SAE AP

PATCH In review Bogdan Nicolae 3 participants 12 messages Jul 29 – Aug 10 2 messages not in the archive Broadcom BRCM80211 IEEE802.11 wireless drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: brcmfmac: configure SAE PWE method for external SAE AP

When bringing up a WPA3-SAE SoftAP with external (user space) SAE, the driver never told the firmware which SAE Password Element (PWE) method to accept. The firmware was observed to corrupt its heap over time due to this omission, leading to firmware trap (data abort in heap allocator).

Parse the beacon IEs on start_ap() and set the extsae_pwe iovar
accordingly: 2 when the RSNX IE advertises H2E, 1 when an H2E-only membership selector is present, 0 otherwise. This matches the behaviour of the upstream/vendor driver and only applies to SAE-capable APs when external SAE is supported.

---
 .../broadcom/brcm80211/brcmfmac/cfg80211.c    | 75 +++++++++++++++++++
 1 file changed, 75 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +75 -0
index d32b35ce0..335647916 100644
@@ -60,6 +60,10 @@
 #define RSN_AKM_SHA256_1X		5	/* SHA256, 802.1X */
 #define RSN_AKM_SHA256_PSK		6	/* SHA256, Pre-shared Key */
 #define RSN_AKM_SAE			8	/* SAE */
+#define BSS_MEMBERSHIP_SELECTOR_SAE_H2E_ONLY 123
+#define BSS_MEMBERSHIP_SELECTOR_SET	0x80
+#define SAE_H2E_ONLY_ENABLE		(BSS_MEMBERSHIP_SELECTOR_SAE_H2E_ONLY | \
+					 BSS_MEMBERSHIP_SELECTOR_SET)
 #define RSN_CAP_LEN			2	/* Length of RSN capabilities */
 #define RSN_CAP_PTK_REPLAY_CNTR_MASK	(BIT(2) | BIT(3))
 #define RSN_CAP_MFPR_MASK		BIT(6)
@@ -5091,6 +5095,73 @@ brcmf_config_ap_mgmt_ie(struct brcmf_cfg80211_vif *vif,
 	return err;
 }
 
+static s32
+brcmf_parse_configure_sae_pwe(struct brcmf_if *ifp,
+			      struct cfg80211_ap_settings *settings)
+{
+	s32 err = 0;
+	const struct brcmf_tlv *rsnx_ie;
+	const struct brcmf_tlv *ext_rate_ie;
+	const struct brcmf_tlv *supp_rate_ie;
+	u8 ie_len, i;
+	u32 wpa_auth = 0;
+	/* SAE PWE method(s) to accept: 0 = Hunting-and-Pecking only,
+	 * 1 = H2E only, 2 = both.
+	 */
+	u32 sae_pwe = 0;
+
+	if (!brcmf_feat_is_enabled(ifp, BRCMF_FEAT_SAE_EXT))
+		return 0;
+
+	err = brcmf_fil_bsscfg_int_get(ifp, "wpa_auth", &wpa_auth);
+	if (err || (wpa_auth & WPA3_AUTH_SAE_PSK) == 0) {
+		brcmf_dbg(INFO, "wpa_auth is not SAE:0x%x\n", wpa_auth);
+		return 0;
+	}
+
+	rsnx_ie = brcmf_parse_tlvs((u8 *)settings->beacon.tail,
+				   settings->beacon.tail_len, WLAN_EID_RSNX);
+	if (rsnx_ie && rsnx_ie->len &&
+	    (rsnx_ie->data[0] & WLAN_RSNX_CAPA_SAE_H2E))
+		sae_pwe = 2;
+
+	if (sae_pwe == 2) {
+		supp_rate_ie = brcmf_parse_tlvs((u8 *)settings->beacon.head,
+						settings->beacon.head_len,
+						WLAN_EID_SUPP_RATES);
+		ext_rate_ie = brcmf_parse_tlvs((u8 *)settings->beacon.tail,
+					       settings->beacon.tail_len,
+					       WLAN_EID_EXT_SUPP_RATES);
+		if (ext_rate_ie) {
+			ie_len = ext_rate_ie->len;
+			for (i = 0; i < ie_len; i++) {
+				if (ext_rate_ie->data[i] == SAE_H2E_ONLY_ENABLE) {
+					sae_pwe = 1;
+					break;
+				}
+			}
+		}
+		if (sae_pwe == 2 && supp_rate_ie) {
+			ie_len = supp_rate_ie->len;
+			for (i = 0; i < ie_len; i++) {
+				if (supp_rate_ie->data[i] == SAE_H2E_ONLY_ENABLE) {
+					sae_pwe = 1;
+					break;
+				}
+			}
+		}
+	}
+
+	err = brcmf_fil_iovar_int_set(ifp, "extsae_pwe", sae_pwe);
+	if (err) {
+		brcmf_err("extsae_pwe iovar not supported\n");
+		return -EOPNOTSUPP;
+	}
+
+	brcmf_dbg(INFO, "extsae_pwe=%u\n", sae_pwe);
+	return 0;
+}
+
 static s32
 brcmf_parse_configure_security(struct brcmf_if *ifp,
 			       struct cfg80211_ap_settings *settings,
@@ -5124,6 +5195,10 @@ brcmf_parse_configure_security(struct brcmf_if *ifp,
 			err = brcmf_configure_wpaie(ifp, tmp_ie, true);
 			if (err < 0)
 				return err;
+
+			err = brcmf_parse_configure_sae_pwe(ifp, settings);
+			if (err < 0)
+				return err;
 		}
 	} else {
 		brcmf_dbg(TRACE, "No WPA(2) IEs found\n");
Signature · 1 line
2.55.0
maintainer
#1 lore raw
Quoted 10 lines · Bogdan Nicolae

When bringing up a WPA3-SAE SoftAP with external (user space) SAE, the driver never told the firmware which SAE Password Element (PWE) method to accept. The firmware was observed to corrupt its heap over time due to this omission, leading to firmware trap (data abort in heap allocator).

Parse the beacon IEs on start_ap() and set the extsae_pwe iovar
accordingly: 2 when the RSNX IE advertises H2E, 1 when an H2E-only membership selector is present, 0 otherwise. This matches the behaviour of the upstream/vendor driver and only applies to SAE-capable APs when external SAE is supported.

This makes sense, but may I ask what device do you have? Suspect it is a Cypress/Infineon chip. I could not find the iovar in our (Broadcom bca) code base so I suspect it is vendor specific.

Regards,
Arend

#2 lore raw
Quoted 12 lines · Arend van Spriel
Quoted 10 lines · Bogdan Nicolae

When bringing up a WPA3-SAE SoftAP with external (user space) SAE, the driver never told the firmware which SAE Password Element (PWE) method to accept. The firmware was observed to corrupt its heap over time due to this omission, leading to firmware trap (data abort in heap allocator).

Parse the beacon IEs on start_ap() and set the extsae_pwe iovar
accordingly: 2 when the RSNX IE advertises H2E, 1 when an H2E-only membership selector is present, 0 otherwise. This matches the behaviour of the upstream/vendor driver and only applies to SAE-capable APs when external SAE is supported.

Quoted 3 lines

This makes sense, but may I ask what device do you have? Suspect it is a Cypress/Infineon chip. I could not find the iovar in our (Broadcom bca) code base so I suspect it is vendor specific.

Arend, yes, this an Infineon vendor specific Firmware IOVAR. Seems like he got the patch from Infineon's downstream brcmfmac github and applied it on upstream brcmfmac driver as it is with minor changes.

Bogdan, from Infineon we are currently working on a patch to adopt our "extsae_pwe" vendor changes for the upstream brcmfmac driver. Because it can't be applied as it is on upstream brcmfmac without affecting other firmware vendors.

We will submit our "extsae_pwe" patch for upstream review in a few days. Kindly wait.

Regards,
Gokul

A message that is not in the archive (sent off-list or not yet received): CA+ORkNQntwC4k2arcngGdYB3mwsbJCkCRNTJRJ2GoRxjdGXLzA@mail.gmail.com

maintainer
#4 lore raw
Quoted 20 lines · Bogdan Nicolae
Quoted 20 lines · On Wed, Jul 29, 2026, 04:48 Arend van Spriel <[email protected]…

On 29/07/2026 07:34, Bogdan Nicolae wrote:
> When bringing up a WPA3-SAE SoftAP with external (user space)
SAE, the
> driver never told the firmware which SAE Password Element (PWE)
method to
> accept. The firmware was observed to corrupt its heap over time
due to
> this omission, leading to firmware trap (data abort in heap
allocator).
>
> Parse the beacon IEs on start_ap() and set the extsae_pwe iovar > accordingly: 2 when the RSNX IE advertises H2E, 1 when an H2E-only > membership selector is present, 0 otherwise. This matches the
behaviour
> of the upstream/vendor driver and only applies to SAE-capable APs
when
> external SAE is supported.

Quoted 7 lines
Quoted 4 lines

This makes sense, but may I ask what device do you have? Suspect it is a
Cypress/Infineon chip. I could not find the iovar in our (Broadcom bca) code base so I suspect it is vendor specific.

Hi Arend,

Indeed, this is a bcm43455 as found on Raspberry Pi SoCs.

Than we should only invoke the parse function for cyw vendor.

Regards,
Arend

A message that is not in the archive (sent off-list or not yet received): CA+ORkNSsb8Z5eUVH1GRvWtO_he6A+_b67ov2Cm6VJuWciJeKZQ@mail.gmail.com

#6 lore raw

Gokul,

Looks like this is also missing, can you please add it in your patch:

(quoted diff) +0 -0

b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index d32b35ce0..455f5619f 100644

drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +0 -0
@@ -77,6 +77,11 @@
 

#define DOT11_BCN_PRB_FIXED_LEN 12 /* beacon/probe
fixed length */

+#define WL_IOV_OP_BSSCFG_DISABLE 0
+#define WL_IOV_OP_BSSCFG_ENABLE 1
+#define WL_IOV_OP_MANUAL_STA_BSSCFG_CREATE 2
+#define WL_IOV_OP_MANUAL_AP_BSSCFG_CREATE 3
+

#define BRCMF_SCAN_JOIN_ACTIVE_DWELL_TIME_MS   320
#define BRCMF_SCAN_JOIN_PASSIVE_DWELL_TIME_MS  400
#define BRCMF_SCAN_JOIN_PROBE_INTERVAL_MS      20
@@ -5260,6 +5265,19 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy,
struct net_device *ndev,
               if ((brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) && (!mbss))
                       brcmf_fil_iovar_int_set(ifp, "mbss", 1);

+ if (!test_bit(BRCMF_VIF_STATUS_AP_CREATED,
&ifp->vif->sme_state)) {
+ bss_enable.bsscfgidx = cpu_to_le32(ifp->bsscfgidx);
+ bss_enable.enable =
+ cpu_to_le32(WL_IOV_OP_MANUAL_AP_BSSCFG_CREATE);
+ err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable,
+ sizeof(bss_enable));
+ if (err < 0) {
+ bphy_err(drvr, "bss_enable config failed %d\n",
+ err);
+ goto exit;
+ }
+ }
+

               err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 1);
               if (err < 0) {
                       bphy_err(drvr, "setting AP mode failed %d\n",

Thanks,
Bogdan

Quoted 44 lines · Bogdan Nicolae

Gokul,

Great to hear. Are there any other changes you are planning to submit?
I found this to be the minimal working config at least for WPA3 personal, but would like to know if I am missing anything else.

Thanks,
Bogdan

Quoted 34 lines · On Wed, Jul 29, 2026, 07:28 Arend van Spriel <[email protected]>…
Quoted 21 lines · Bogdan Nicolae
Quoted 21 lines

On Wed, Jul 29, 2026, 04:48 Arend van Spriel <[email protected] <mailto:[email protected]>> wrote:

On 29/07/2026 07:34, Bogdan Nicolae wrote:
> When bringing up a WPA3-SAE SoftAP with external (user space)
SAE, the
> driver never told the firmware which SAE Password Element (PWE)
method to
> accept. The firmware was observed to corrupt its heap over time
due to
> this omission, leading to firmware trap (data abort in heap
allocator).
>
> Parse the beacon IEs on start_ap() and set the extsae_pwe iovar > accordingly: 2 when the RSNX IE advertises H2E, 1 when an H2E-only > membership selector is present, 0 otherwise. This matches the
behaviour
> of the upstream/vendor driver and only applies to SAE-capable APs
when
> external SAE is supported.

Quoted 7 lines
Quoted 4 lines

This makes sense, but may I ask what device do you have? Suspect it is a
Cypress/Infineon chip. I could not find the iovar in our (Broadcom bca) code base so I suspect it is vendor specific.

Hi Arend,

Indeed, this is a bcm43455 as found on Raspberry Pi SoCs.

Than we should only invoke the parse function for cyw vendor.

Regards,
Arend

#7 lore raw
Quoted 3 lines · Bogdan Nicolae

Gokul,

Looks like this is also missing, can you please add it in your patch:

sure, we will include the quoted patch while submitting our "extsae_pwe" patchset for community review.

Kindly avoid top-posting while sending your email replies. Need to use interleaved quoting.
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

Quoted 41 lines
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +0 -0
index d32b35ce0..455f5619f 100644
@@ -77,6 +77,11 @@
 
 #define        DOT11_BCN_PRB_FIXED_LEN         12      /* beacon/probe

fixed length */

drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +5 -0
+#define WL_IOV_OP_BSSCFG_DISABLE               0
+#define WL_IOV_OP_BSSCFG_ENABLE                        1
+#define WL_IOV_OP_MANUAL_STA_BSSCFG_CREATE     2
+#define WL_IOV_OP_MANUAL_AP_BSSCFG_CREATE      3
+
#define BRCMF_SCAN_JOIN_ACTIVE_DWELL_TIME_MS   320
#define BRCMF_SCAN_JOIN_PASSIVE_DWELL_TIME_MS  400
#define BRCMF_SCAN_JOIN_PROBE_INTERVAL_MS      20
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +13 -0
@@ -5260,6 +5265,19 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy,
 struct net_device *ndev,
               if ((brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) && (!mbss))
                       brcmf_fil_iovar_int_set(ifp, "mbss", 1);
 
+               if (!test_bit(BRCMF_VIF_STATUS_AP_CREATED,
 &ifp->vif->sme_state)) {
+                       bss_enable.bsscfgidx = cpu_to_le32(ifp->bsscfgidx);
+                       bss_enable.enable =
+                               cpu_to_le32(WL_IOV_OP_MANUAL_AP_BSSCFG_CREATE);
+                       err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable,
+                                                      sizeof(bss_enable));
+                       if (err < 0) {
+                               bphy_err(drvr, "bss_enable config failed %d\n",
+                                        err);
+                               goto exit;
+                       }
+               }
+
               err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 1);

if (err < 0) {
bphy_err(drvr, "setting AP mode failed %d\n",

Quoted 10 lines

Thanks,
Bogdan

Quoted 6 lines · Bogdan Nicolae

Gokul,

Great to hear. Are there any other changes you are planning to submit? I found this to be the minimal working config at least for WPA3 personal, but would like to know if I am missing anything else.

Could you help us with the exact version of 43455 firmware, Raspbian distro and kernel that you are currently using in your RPi ?

Regards,
Gokul

#8 lore raw

Gokul,

A detailed explanation is available in this issue:
https://github.com/raspberrypi/linux/issues/7528

Quoted 3 lines · Gokul Sivakumar

Could you help us with the exact version of 43455 firmware, Raspbian distro and kernel that you are currently using in your RPi ?

Kernel 6.18.39 (fork form official rpi kernel):
https://github.com/bnicolae/linux-rpi (main adds code to capture firmware trap; wpa3 branch configures the new iovars)
Firmware: BCM4345/6 wl0: Oct 28 2024 23:27:00 version 7.45.286 (be70ab3 CY) FWID 01-95efe7fa
Infineon Backports (used as a reference): v6.1.145

Quoted 2 lines

Regards,
Gokul

maintainer
#9 lore raw
In reply to Bogdan Nicolae
Quoted 11 lines · Bogdan Nicolae

When bringing up a WPA3-SAE SoftAP with external (user space) SAE, the driver never told the firmware which SAE Password Element (PWE) method to accept. The firmware was observed to corrupt its heap over time due to this omission, leading to firmware trap (data abort in heap allocator).

Parse the beacon IEs on start_ap() and set the extsae_pwe iovar
accordingly: 2 when the RSNX IE advertises H2E, 1 when an H2E-only membership selector is present, 0 otherwise. This matches the behaviour of the upstream/vendor driver and only applies to SAE-capable APs when external SAE is supported.

Quoted 4 lines
---
 .../broadcom/brcm80211/brcmfmac/cfg80211.c    | 75 +++++++++++++++++++
 1 file changed, 75 insertions(+)

As discussed the extsae_pwe iovar is vendor specific so the fix needs to be gated on the CYW vendor. The cleanest approach would be to add a fwvid hook (following the pattern of set_sae_password in brcmfmac/cyw/) so brcmf_parse_configure_sae_pwe() is only invoked for CYW chipsets.

[...]

Quoted 1 line

+#define BSS_MEMBERSHIP_SELECTOR_SAE_H2E_ONLY 123

This is already defined as BSS_MEMBERSHIP_SELECTOR_SAE_H2E in <linux/ieee80211.h>. Please reuse the existing constant.

[...]

Regards,
Arend

#10 lore raw

Gokul (representing Infineon) promised he would send a patch a while back. This would be a preferred solution as it comes directly from the vendor. But it also takes time. I can send a revised patch next week.

Regards,
Bogdan

Quoted 34 lines · Arend van Spriel
Quoted 11 lines · Bogdan Nicolae

When bringing up a WPA3-SAE SoftAP with external (user space) SAE, the driver never told the firmware which SAE Password Element (PWE) method to accept. The firmware was observed to corrupt its heap over time due to this omission, leading to firmware trap (data abort in heap allocator).

Parse the beacon IEs on start_ap() and set the extsae_pwe iovar
accordingly: 2 when the RSNX IE advertises H2E, 1 when an H2E-only membership selector is present, 0 otherwise. This matches the behaviour of the upstream/vendor driver and only applies to SAE-capable APs when external SAE is supported.

Quoted 4 lines
---
 .../broadcom/brcm80211/brcmfmac/cfg80211.c    | 75 +++++++++++++++++++
 1 file changed, 75 insertions(+)

As discussed the extsae_pwe iovar is vendor specific so the fix needs to be gated on the CYW vendor. The cleanest approach would be to add a fwvid hook (following the pattern of set_sae_password in brcmfmac/cyw/) so brcmf_parse_configure_sae_pwe() is only invoked for CYW chipsets.

[...]

Quoted 1 line

+#define BSS_MEMBERSHIP_SELECTOR_SAE_H2E_ONLY 123

This is already defined as BSS_MEMBERSHIP_SELECTOR_SAE_H2E in <linux/ieee80211.h>. Please reuse the existing constant.

[...]

Regards,
Arend

maintainer
#11 lore raw

Op 8 augustus 2026 02:00:22 schreef Bogdan Nicolae <[email protected]>:

Quoted 3 lines

Gokul (representing Infineon) promised he would send a patch a while back. This would be a preferred solution as it comes directly from the vendor. But it also takes time. I can send a revised patch next week.

Yeah. With Johannes being on vacation I say we can give Infineon bit more time to provide their patch.

Regards,
Arend

#12 lore raw
Quoted 9 lines · Arend van Spriel

Op 8 augustus 2026 02:00:22 schreef Bogdan Nicolae <[email protected]>:

Quoted 3 lines

Gokul (representing Infineon) promised he would send a patch a while back. This would be a preferred solution as it comes directly from the vendor. But it also takes time. I can send a revised patch next week.

Yeah. With Johannes being on vacation I say we can give Infineon bit more time to provide their patch.

Sounds good, Arend. Gokul, I'm available to test/collaborate, just let me know.

Best,
Bogdan

#13 lore raw
Quoted 5 lines · Bogdan Nicolae
Quoted 3 lines · Arend van Spriel

Op 8 augustus 2026 02:00:22 schreef Bogdan Nicolae <[email protected]>:

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

Gokul (representing Infineon) promised he would send a patch a while back. This would be a preferred solution as it comes directly from the vendor. But it also takes time. I can send a revised patch next week.

Yeah. With Johannes being on vacation I say we can give Infineon bit more time to provide their patch.

Sounds good, Arend. Gokul, I'm available to test/collaborate, just let me know.

Sure, we will send the Infineon patchset for review within few days.

Regards,
Gokul