[PATCH 48/55] tests: FT with the PQC AKM

Ilan Peer ilan.peer at intel.com
Thu Dec 3 02:44:47 PST 2026


Verify FT initial mobility domain association and the FT protocol with
AKM 00-0F-AC:32 for the FT PQC security profiles 20-23, also with
PMKR0Name privacy.

Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
 tests/hwsim/test_ap_ft.py | 156 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 156 insertions(+)

diff --git a/tests/hwsim/test_ap_ft.py b/tests/hwsim/test_ap_ft.py
index ff6912a48145..01f6256e4038 100644
--- a/tests/hwsim/test_ap_ft.py
+++ b/tests/hwsim/test_ap_ft.py
@@ -3984,6 +3984,162 @@ def test_ap_ft_eap_1x_auth_fte_mismatch(dev, apdev):
     if "CTRL-EVENT-CONNECTED" in ev:
         raise Exception("FTE mismatch in Association Response not detected")
 
+def ft_pqc_ap(apdev, i, ssid, profile, privacy=False):
+    p = (ft_params1 if i == 0 else ft_params2)(ssid=ssid)
+    p = dict(list(hostapd.radius_params().items()) + list(p.items()))
+
+    # FT-EAP enables the FT infrastructure; the PQC AKM is implied by the
+    # FT-PQC security profile.
+    p["wpa_key_mgmt"] = "FT-EAP"
+    p["ieee8021x"] = "1"
+    p["group_mgmt_cipher"] = "BIP-GMAC-256"
+    p["rsn_pairwise"] = "GCMP-256"
+    p["group_cipher"] = "GCMP-256"
+    p["ieee80211w"] = "2"
+    p["security_profiles"] = str(profile)
+    p["eap_using_authentication_frames"] = "1"
+    p["assoc_frame_encryption"] = "1"
+    if privacy:
+        p["pmksa_caching_privacy"] = "1"
+
+    return hostapd.add_ap(apdev[i], p)
+
+def ft_pqc_check_capture(capfile):
+    # Wireshark does not parse Extended Length elements, so look for the PQC
+    # Parameter element (e3 <ext id>) in the raw FT Authentication frames.
+    pqc = "e3%02x%02x" % (WLAN_EID_EXT_LEN_PQC_PARAMETER & 0xff,
+                          WLAN_EID_EXT_LEN_PQC_PARAMETER >> 8)
+
+    for seq in [1, 2]:
+        filt = "wlan.fc.type_subtype == 0x000b && wlan.fixed.auth.alg == 2 && " + \
+               "wlan.fixed.auth_seq == %d" % seq
+        out = run_tshark_json(capfile, filt)
+
+        frames = [p["_source"]["layers"]["frame_raw"][0]
+                  for p in json.loads(out)]
+
+        if not frames or any(pqc not in f for f in frames):
+            raise Exception("No PQC Parameter element in FT Authentication frame %d" % seq)
+
+    for subtype in ["0x0002", "0x0003"]:
+        res = run_tshark(capfile, "wlan.fc.type_subtype == " + subtype,
+                         ["wlan.fc.protected"])
+
+        vals = res.splitlines()
+        if not vals or any(v not in ["1", "True"] for v in vals):
+            raise Exception("Unprotected Reassociation frame (subtype %s): %s" % (subtype, str(vals)))
+
+def run_ap_ft_pqc(dev, apdev, params, profile, privacy=False, mac_addr=False):
+    check_pqc_capab(dev[0])
+    capfile = os.path.join(params['logdir'], "hwsim0.pcapng")
+    ssid = "test-ft-pqc"
+    hapds = [ft_pqc_ap(apdev, i, ssid, profile, privacy) for i in range(2)]
+
+    copts = {}
+    if mac_addr:
+        copts["mac_addr"] = "1"
+
+    dev[0].flush_scan_cache()
+    dev[0].set("security_profiles", "1")
+    dev[0].connect(ssid, key_mgmt="WPA-EAP", ieee80211w="2",
+                   pairwise="GCMP-256", group="GCMP-256", scan_freq="2412",
+                   eap_over_auth_frame="1", security_profiles=str(profile),
+                   eap="GPSK", identity="gpsk user",
+                   password="abcdefghijklmnop0123456789abcdef",
+                   pmksa_privacy="1" if privacy else "0",
+                   bssid=apdev[0]['bssid'], **copts)
+
+    hapds[0].wait_sta()
+    sta = hapds[0].get_sta(dev[0].get_addr())
+    if sta["AKMSuiteSelector"] != "00-0f-ac-32":
+        raise Exception("Unexpected AKM: " + sta["AKMSuiteSelector"])
+
+    hwsim_utils.test_connectivity(dev[0], hapds[0])
+
+    dev[0].scan_for_bss(apdev[1]['bssid'], freq="2412")
+    for i in [1, 0, 1]:
+        logger.info("Roam to " + apdev[i]['bssid'])
+
+        dev[0].roam(apdev[i]['bssid'])
+        hapds[i].wait_sta()
+
+        if hapds[i].get_sta(dev[0].get_addr())['auth_alg'] != '2':
+            raise Exception("FT was not used")
+
+        hwsim_utils.test_connectivity(dev[0], hapds[i])
+
+    ft_pqc_check_capture(capfile)
+
+    if mac_addr:
+        ft_check_new_mac_addrs(capfile, 3)
+        return
+
+    names = ft_pmk_r0_names(capfile, dev[0].own_addr())
+    if len(names) != 3:
+        raise Exception("Unexpected number of PMKR0Names: " + str(names))
+
+    if privacy and len(set(names)) != len(names):
+        raise Exception("PMKR0Name was reused: " + str(names))
+
+    if not privacy and len(set(names)) != 1:
+        raise Exception("Unexpected PMKR0Name change: " + str(names))
+
+def test_ap_ft_pqc_profile_20(dev, apdev, params):
+    """FT-PQC with security profile 20"""
+    run_ap_ft_pqc(dev, apdev, params, 20)
+
+def test_ap_ft_pqc_profile_21(dev, apdev, params):
+    """FT-PQC with security profile 21"""
+    run_ap_ft_pqc(dev, apdev, params, 21)
+
+def test_ap_ft_pqc_profile_22(dev, apdev, params):
+    """FT-PQC with security profile 22"""
+    run_ap_ft_pqc(dev, apdev, params, 22)
+
+def test_ap_ft_pqc_profile_23(dev, apdev, params):
+    """FT-PQC with security profile 23"""
+    run_ap_ft_pqc(dev, apdev, params, 23)
+
+def test_ap_ft_pqc_pmksa_privacy_profile_20(dev, apdev, params):
+    """FT-PQC with PMKR0Name privacy, security profile 20"""
+    run_ap_ft_pqc(dev, apdev, params, 20, privacy=True)
+
+def test_ap_ft_pqc_pmksa_privacy_profile_21(dev, apdev, params):
+    """FT-PQC with PMKR0Name privacy, security profile 21"""
+    run_ap_ft_pqc(dev, apdev, params, 21, privacy=True)
+
+def test_ap_ft_pqc_pmksa_privacy_profile_22(dev, apdev, params):
+    """FT-PQC with PMKR0Name privacy, security profile 22"""
+    run_ap_ft_pqc(dev, apdev, params, 22, privacy=True)
+
+def test_ap_ft_pqc_pmksa_privacy_profile_23(dev, apdev, params):
+    """FT-PQC with PMKR0Name privacy, security profile 23"""
+    run_ap_ft_pqc(dev, apdev, params, 23, privacy=True)
+
+def test_ap_ft_pqc_pmksa_privacy_mac_addr(dev, apdev, params):
+    """FT-PQC with PMKR0Name privacy and a new MAC address for each roam"""
+    try:
+        dev[0].set("rand_addr_lifetime", "0")
+        run_ap_ft_pqc(dev, apdev, params, 21, privacy=True, mac_addr=True)
+    finally:
+        dev[0].set("rand_addr_lifetime", "60")
+
+def test_ap_ft_unexpected_pqc_param(dev, apdev):
+    """FT with an unexpected PQC Parameter element in the second FT message"""
+    ssid = "test-ft"
+    passphrase = "12345678"
+    hostapd.add_ap(apdev[0], ft_params1(ssid=ssid, passphrase=passphrase))
+    params = ft_params2(ssid=ssid, passphrase=passphrase)
+
+    # PQC Parameter element: security profile 22, ML-KEM ciphertext only
+    params["ft_auth_resp_elements"] = "e3" + "0000" + "0200" + "1602"
+    hapd1 = hostapd.add_ap(apdev[1], params)
+
+    dev[0].connect(ssid, psk=passphrase, key_mgmt="FT-PSK", proto="WPA2",
+                   scan_freq="2412")
+    dev[0].scan_for_bss(apdev[1]['bssid'], freq="2412")
+    dev[0].roam(apdev[1]['bssid'], fail_test=True)
+
 def ft_enc_assoc_check_capture(capfile, sta, aps):
     # All FT Authentication frames carry the Diffie-Hellman Parameter element
     filt = "wlan.fc.type_subtype == 0x000b && wlan.fixed.auth.alg == 2 && " + \
-- 
2.55.0




More information about the Hostap mailing list