[PATCH 03/15] tests: Security Profile element override in msg 3/4
Andrei Otcheretianski
andrei.otcheretianski at intel.com
Tue Nov 24 00:52:59 PST 2026
From: Ilan Peer <ilan.peer at intel.com>
Verify that the station rejects EAPOL-Key msg 3/4 when the Security
Profile element is different from the one in Beacon and Probe Response
frames, or is missing, both without and with MLO.
Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
tests/hwsim/test_security_profiles.py | 78 ++++++++++++++++++++++++++-
1 file changed, 77 insertions(+), 1 deletion(-)
diff --git a/tests/hwsim/test_security_profiles.py b/tests/hwsim/test_security_profiles.py
index a1d0484e7a..ff3aa1044d 100644
--- a/tests/hwsim/test_security_profiles.py
+++ b/tests/hwsim/test_security_profiles.py
@@ -512,7 +512,81 @@ def test_sp9_sp_mlo_two_link(dev, apdev):
check_security_profile(hapd0, wpas, 9, akm='00-0f-ac-24')
hwsim_utils.test_connectivity(wpas, hapd0)
-def start_sae_ap_security_profile_9(apdev):
+def wait_sec_prof_m3_failure(dev, reason):
+ ev = dev.wait_event(["Security Profile element", "CTRL-EVENT-CONNECTED"],
+ timeout=15)
+ if ev is None:
+ raise Exception("No Security Profile element failure reported")
+ if "CTRL-EVENT-CONNECTED" in ev:
+ raise Exception("Connected despite msg 3/4 Security Profile element issue")
+ if reason not in ev:
+ raise Exception("Unexpected Security Profile element failure: " + ev)
+ dev.wait_disconnected()
+ dev.request("REMOVE_NETWORK all")
+ dev.dump_monitor()
+
+def run_security_profile_9_m3(dev, apdev, sp_elem, reason):
+ hapd, passphrase = start_sae_ap_security_profile_9(
+ apdev[0], {'sec_profile_override_eapol': sp_elem})
+
+ try:
+ enable_sta_security_profiles(dev[0], 9)
+ dev[0].set("sae_pwe", "2")
+ dev[0].set("sae_groups", "")
+ dev[0].connect("sp9-sae", psk=passphrase, key_mgmt="SAE-EXT-KEY",
+ ieee80211w="2", beacon_prot="1",
+ pairwise="GCMP-256", group="GCMP-256",
+ group_mgmt="BIP-GMAC-256", scan_freq="2412",
+ wait_connect=False)
+ wait_sec_prof_m3_failure(dev[0], reason)
+ finally:
+ sta_cleanup(dev[0])
+
+def test_security_profile_9_m3_mismatch(dev, apdev):
+ """Security Profile 9 - Security Profile element mismatch in msg 3/4"""
+ run_security_profile_9_m3(dev, apdev, "ff07a20002000220ff",
+ "does not match")
+
+def test_security_profile_9_m3_missing(dev, apdev):
+ """Security Profile 9 - Security Profile element missing from msg 3/4"""
+ run_security_profile_9_m3(dev, apdev, "", "absent in EAPOL-Key msg 3/4")
+
+def run_sp9_sp_mlo_m3(dev, apdev, sp_elem, reason):
+ with HWSimRadio(use_mlo=True) as (hapd_radio, hapd_iface), \
+ HWSimRadio(use_mlo=True) as (wpas_radio, wpas_iface):
+ wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
+ wpas.interface_add(wpas_iface)
+
+ passphrase = '1234567890'
+ ssid = "test-sp9-sp"
+ params = eht_mld_ap_wpa2_params(ssid, passphrase,
+ key_mgmt="SAE-EXT-KEY ", mfp="2", pwe='1',
+ beacon_prot=1)
+ params['rsn_pairwise'] = "CCMP GCMP-256"
+ params['security_profiles'] = '9'
+ params['sec_profile_override_eapol'] = sp_elem
+ eht_mld_enable_ap(hapd_iface, 0, params)
+
+ params['channel'] = '6'
+ eht_mld_enable_ap(hapd_iface, 1, params)
+
+ enable_sta_security_profiles(wpas, 9)
+ wpas.set("pasn_groups", "")
+ wpas.set("sae_pwe", "1")
+ wpas.connect(ssid, sae_password=passphrase, scan_freq="2412 2437",
+ key_mgmt="SAE-EXT-KEY", ieee80211w="2", beacon_prot="1",
+ pairwise="CCMP GCMP-256", wait_connect=False)
+ wait_sec_prof_m3_failure(wpas, reason)
+
+def test_sp9_sp_mlo_m3_mismatch(dev, apdev):
+ """Security Profile element mismatch in msg 3/4 on MLO with two links"""
+ run_sp9_sp_mlo_m3(dev, apdev, "ff07a20002000220ff", "does not match")
+
+def test_sp9_sp_mlo_m3_missing(dev, apdev):
+ """Security Profile element missing from msg 3/4 on MLO with two links"""
+ run_sp9_sp_mlo_m3(dev, apdev, "", "absent in EAPOL-Key msg 3/4")
+
+def start_sae_ap_security_profile_9(apdev, extra_params=None):
"""Start SAE AP with Security Profile 9"""
ssid = "sp9-sae"
passphrase = "12345678"
@@ -527,6 +601,8 @@ def start_sae_ap_security_profile_9(apdev):
params['beacon_prot'] = '1'
params['sae_pwe'] = '2'
params['security_profiles'] = '9'
+ if extra_params:
+ params.update(extra_params)
try:
hapd = hostapd.add_ap(apdev, params)
--
2.56.1
More information about the Hostap
mailing list