[PATCH] wpa_supplicant: Don't prefer SAE over PSK without a passphrase
Phil Elwell
phil at raspberrypi.com
Mon Sep 28 07:51:57 PDT 2026
SAE (WPA3) requires a passphrase (or an explicit sae_password) in
order to derive the password element used in the handshake - a raw
PSK, as stored for a network profile that only has a 64-hex-digit PSK
configured, cannot be used with SAE.
For a network profile whose key_mgmt allows both WPA-PSK and SAE
(e.g. connecting to an AP running in WPA2/WPA3 transition mode), the
key management selection logic always preferred SAE when the driver
and AP both support it, regardless of whether the network profile
actually has a passphrase available. If credentials for such a
network were stored as a raw PSK rather than a passphrase (as
happens when a PSK is provided in hex form, e.g. by some device
provisioning flows), this caused the SAE key derivation to fail and
the connection to be rejected, even though falling back to WPA2-PSK
would have worked with the stored PSK.
Only prefer SAE if the profile has a passphrase or an explicit SAE
password configured; otherwise mask out SAE/FT-SAE from the
candidate key_mgmt set so that PSK/FT-PSK can be selected instead.
Signed-off-by: Phil Elwell <phil at raspberrypi.com>
---
wpa_supplicant/wpa_supplicant.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 1111111..2222222 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -1538,6 +1538,11 @@ static int wpa_supplicant_set_suites(struct
wpa_supplicant *wpa_s,
#ifdef CONFIG_SAE
if (!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_SAE))
sel &= ~(WPA_KEY_MGMT_SAE | WPA_KEY_MGMT_FT_SAE);
+ if (!ssid->sae_password && !ssid->passphrase) {
+ wpa_dbg(wpa_s, MSG_DEBUG,
+ "WPA: No SAE password/passphrase available; not preferring SAE/FT-SAE");
+ sel &= ~(WPA_KEY_MGMT_SAE | WPA_KEY_MGMT_FT_SAE);
+ }
#endif /* CONFIG_SAE */
#ifdef CONFIG_IEEE80211R
if (!(wpa_s->drv_flags & (WPA_DRIVER_FLAGS_SME |
More information about the Hostap
mailing list