tests: FILS SK and STA requesting PTK rekeying

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2024-01-28 19:02:55 +02:00
parent 3f60fcdd88
commit 846534c2a3

View 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)