From 5ee94a997e582409f6d6c0a8694c855f5d63090f Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 7 Jun 2020 11:53:00 +0300 Subject: [PATCH] tests: Replace sae_pk_only with sae_pk to match implementation Signed-off-by: Jouni Malinen --- tests/hwsim/test_sae_pk.py | 33 ++++++++++++++++++++++++++++++--- tests/hwsim/wpasupplicant.py | 2 +- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/tests/hwsim/test_sae_pk.py b/tests/hwsim/test_sae_pk.py index 94a8a743e..3f7f0f461 100644 --- a/tests/hwsim/test_sae_pk.py +++ b/tests/hwsim/test_sae_pk.py @@ -156,7 +156,7 @@ def test_sae_pk_only(dev, apdev): params['sae_password'] = pw hapd = hostapd.add_ap(apdev[0], params) - dev[0].connect(ssid, sae_password=pw, key_mgmt="SAE", sae_pk_only="1", + dev[0].connect(ssid, sae_password=pw, key_mgmt="SAE", sae_pk="1", scan_freq="2412", wait_connect=False) ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED", "CTRL-EVENT-NETWORK-NOT-FOUND"], timeout=10) @@ -181,6 +181,33 @@ def test_sae_pk_only(dev, apdev): if dev[0].get_status_field("sae_pk") != "1": raise Exception("SAE-PK was not used") +def test_sae_pk_modes(dev, apdev): + """SAE-PK modes""" + check_sae_pk_capab(dev[0]) + dev[0].set("sae_groups", "") + + ssid = "SAE-PK test" + pw = "dwxm-zv66-p5ue" + m = "431ff8322f93b9dc50ded9f3d14ace22" + pk = "MHcCAQEEIAJIGlfnteonDb7rQyP/SGQjwzrZAnfrXIm4280VWajYoAoGCCqGSM49AwEHoUQDQgAEeRkstKQV+FSAMqBayqFknn2nAQsdsh/MhdX6tiHOTAFin/sUMFRMyspPtIu7YvlKdsexhI0jPVhaYZn1jKWhZg==" + + params = hostapd.wpa2_params(ssid=ssid) + params['wpa_key_mgmt'] = 'SAE' + params["ieee80211w"] = "2" + params['sae_password'] = ['%s|pk=%s:%s' % (pw, m, pk)] + hapd = hostapd.add_ap(apdev[0], params) + + tests = [(2, 0), (1, 1), (0, 1)] + for sae_pk, expected in tests: + dev[0].connect(ssid, sae_password=pw, key_mgmt="SAE", + sae_pk=str(sae_pk), ieee80211w="2", scan_freq="2412") + val = dev[0].get_status_field("sae_pk") + if val != str(expected): + raise Exception("Unexpected sae_pk=%d result %s" % (sae_pk, val)) + dev[0].request("REMOVE_NETWORK *") + dev[0].wait_disconnected() + dev[0].dump_monitor() + def test_sae_pk_transition_disable(dev, apdev): """SAE-PK transition disable indication""" check_sae_pk_capab(dev[0]) @@ -204,6 +231,6 @@ def test_sae_pk_transition_disable(dev, apdev): if ev.split(' ')[1] != "02": raise Exception("Unexpected transition disable bitmap: " + ev) - val = dev[0].get_network(id, "sae_pk_only") + val = dev[0].get_network(id, "sae_pk") if val != "1": - raise Exception("Unexpected sae_pk_only value: " + str(val)) + raise Exception("Unexpected sae_pk value: " + str(val)) diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index 2c94162fa..88e64340a 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/tests/hwsim/wpasupplicant.py @@ -1102,7 +1102,7 @@ class WpaSupplicant: "dpp_netaccesskey", "dpp_netaccesskey_expiry", "dpp_pfs", "group_mgmt", "owe_group", "owe_only", "owe_ptk_workaround", - "transition_disable", "sae_pk_only", + "transition_disable", "sae_pk", "roaming_consortium_selection", "ocv", "multi_ap_backhaul_sta", "rx_stbc", "tx_stbc", "ft_eap_pmksa_caching", "beacon_prot",