From 9ff2b85e733d39b6f90308b0d408038b3170e66b Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 28 Apr 2019 16:03:03 +0300 Subject: [PATCH] tests: FT-EAP and PMKSA caching for initial mobility domain association Signed-off-by: Jouni Malinen --- tests/hwsim/test_ap_ft.py | 54 +++++++++++++++++++++++++++++++++++- tests/hwsim/wpasupplicant.py | 3 +- 2 files changed, 55 insertions(+), 2 deletions(-) diff --git a/tests/hwsim/test_ap_ft.py b/tests/hwsim/test_ap_ft.py index b42330736..6c780efe3 100644 --- a/tests/hwsim/test_ap_ft.py +++ b/tests/hwsim/test_ap_ft.py @@ -149,6 +149,8 @@ def run_roams(dev, apdev, hapd0, hapd1, ssid, passphrase, over_ds=False, if ocv: copts["ocv"] = ocv if eap: + if pmksa_caching: + copts["ft_eap_pmksa_caching"] = "1" if also_non_ft: copts["key_mgmt"] = "WPA-EAP-SUITE-B-192 FT-EAP-SHA384" if sha384 else "WPA-EAP FT-EAP" else: @@ -174,12 +176,16 @@ def run_roams(dev, apdev, hapd0, hapd1, ssid, passphrase, over_ds=False, dev.request("DISCONNECT") dev.wait_disconnected() dev.request("RECONNECT") - ev = dev.wait_event(["CTRL-EVENT-CONNECTED", "CTRL-EVENT-DISCONNECTED"], + ev = dev.wait_event(["CTRL-EVENT-CONNECTED", + "CTRL-EVENT-DISCONNECTED", + "CTRL-EVENT-EAP-STARTED"], timeout=15) if ev is None: raise Exception("Reconnect timed out") if "CTRL-EVENT-DISCONNECTED" in ev: raise Exception("Unexpected disconnection after RECONNECT") + if "CTRL-EVENT-EAP-STARTED" in ev: + raise Exception("Unexpected EAP start after RECONNECT") if dev.get_status_field('bssid') == apdev[0]['bssid']: ap1 = apdev[0] @@ -2845,3 +2851,49 @@ def test_ap_ft_roam_rrm(dev, apdev): dev[0].scan_for_bss(bssid0, freq=2412) dev[0].roam(bssid0) check_beacon_req(hapd0, addr, 3) + +def test_ap_ft_pmksa_caching(dev, apdev): + """FT-EAP and PMKSA caching for initial mobility domain association""" + ssid = "test-ft" + identity = "gpsk user" + + radius = hostapd.radius_params() + params = ft_params1(ssid=ssid) + params['wpa_key_mgmt'] = "FT-EAP" + params["ieee8021x"] = "1" + params["mobility_domain"] = "c3d4" + params = dict(list(radius.items()) + list(params.items())) + hapd = hostapd.add_ap(apdev[0], params) + + params = ft_params2(ssid=ssid) + params['wpa_key_mgmt'] = "FT-EAP" + params["ieee8021x"] = "1" + params["mobility_domain"] = "c3d4" + params = dict(list(radius.items()) + list(params.items())) + hapd1 = hostapd.add_ap(apdev[1], params) + + run_roams(dev[0], apdev, hapd, hapd1, ssid, None, eap=True, + eap_identity=identity, pmksa_caching=True) + +def test_ap_ft_pmksa_caching_sha384(dev, apdev): + """FT-EAP-SHA384 and PMKSA caching for initial mobility domain association""" + ssid = "test-ft" + identity = "gpsk user" + + radius = hostapd.radius_params() + params = ft_params1(ssid=ssid) + params['wpa_key_mgmt'] = "FT-EAP-SHA384" + params["ieee8021x"] = "1" + params["mobility_domain"] = "c3d4" + params = dict(list(radius.items()) + list(params.items())) + hapd = hostapd.add_ap(apdev[0], params) + + params = ft_params2(ssid=ssid) + params['wpa_key_mgmt'] = "FT-EAP-SHA384" + params["ieee8021x"] = "1" + params["mobility_domain"] = "c3d4" + params = dict(list(radius.items()) + list(params.items())) + hapd1 = hostapd.add_ap(apdev[1], params) + + run_roams(dev[0], apdev, hapd, hapd1, ssid, None, eap=True, + eap_identity=identity, pmksa_caching=True, sha384=True) diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index 1543600aa..be1963704 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/tests/hwsim/wpasupplicant.py @@ -1084,7 +1084,8 @@ class WpaSupplicant: "dpp_netaccesskey", "dpp_netaccesskey_expiry", "group_mgmt", "owe_group", "roaming_consortium_selection", "ocv", - "multi_ap_backhaul_sta", "rx_stbc", "tx_stbc"] + "multi_ap_backhaul_sta", "rx_stbc", "tx_stbc", + "ft_eap_pmksa_caching"] for field in not_quoted: if field in kwargs and kwargs[field]: self.set_network(id, field, kwargs[field])