]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: FILS SK and STA requesting PTK rekeying
authorJouni Malinen <j@w1.fi>
Sun, 28 Jan 2024 17:02:55 +0000 (19:02 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 28 Jan 2024 17:02:55 +0000 (19:02 +0200)
Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/test_fils.py

index 2e4e0986ebf489d5df6a01e87d757727dbe2f70c..5cdc28734706e94a7580b3421e0edee83b605943 100644 (file)
@@ -2564,3 +2564,42 @@ def test_fils_sk_okc(dev, apdev, params):
         raise Exception("OKC not indicated in PMKSA entry")
     if pmksa['pmkid'] != pmksa2['pmkid']:
         raise Exception("Unexpected PMKID change")
+
+def test_fils_sk_ptk_rekey_request(dev, apdev, params):
+    """FILS SK and STA requesting PTK rekeying"""
+    check_fils_capa(dev[0])
+    check_erp_capa(dev[0])
+
+    start_erp_as(msk_dump=os.path.join(params['logdir'], "msk.lst"))
+
+    bssid = apdev[0]['bssid']
+    params = hostapd.wpa2_eap_params(ssid="fils")
+    params['wpa_key_mgmt'] = "FILS-SHA256"
+    params['auth_server_port'] = "18128"
+    params['erp_send_reauth_start'] = '1'
+    params['erp_domain'] = 'example.com'
+    params['fils_realm'] = 'example.com'
+    hapd = hostapd.add_ap(apdev[0]['ifname'], params)
+
+    dev[0].flush_scan_cache()
+    dev[0].scan_for_bss(bssid, freq=2412)
+    dev[0].request("ERP_FLUSH")
+    dev[0].connect("fils", key_mgmt="FILS-SHA256",
+                   eap="PSK", identity="psk.user@example.com",
+                   password_hex="0123456789abcdef0123456789abcdef",
+                   erp="1", scan_freq="2412")
+    hapd.wait_sta()
+
+    time.sleep(0.1)
+    anonce1 = dev[0].request("GET anonce")
+    if "OK" not in dev[0].request("KEY_REQUEST 0 1"):
+        raise Exception("KEY_REQUEST failed")
+    ev = dev[0].wait_event(["WPA: Key negotiation completed"])
+    if ev is None:
+        raise Exception("PTK rekey timed out")
+    anonce2 = dev[0].request("GET anonce")
+    if anonce1 == anonce2:
+        raise Exception("AP did not update ANonce in requested PTK rekeying")
+
+    time.sleep(0.1)
+    hwsim_utils.test_connectivity(dev[0], hapd)