From 606ef7d3287e76b1f5f5baeb2af6d9a3fec85922 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Wed, 11 Oct 2017 23:10:03 +0300 Subject: [PATCH] tests: SAE with sae_password Signed-off-by: Jouni Malinen --- tests/hwsim/test_sae.py | 44 ++++++++++++++++++++++++++++++++++++ tests/hwsim/wpasupplicant.py | 2 +- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/tests/hwsim/test_sae.py b/tests/hwsim/test_sae.py index 00866a5f8..79ddae1da 100644 --- a/tests/hwsim/test_sae.py +++ b/tests/hwsim/test_sae.py @@ -1033,3 +1033,47 @@ def test_sae_invalid_anti_clogging_token_req(dev, apdev): dev[0].dump_monitor() dev[0].request("DISCONNECT") + +def test_sae_password(dev, apdev): + """SAE and sae_password in hostapd configuration""" + if "SAE" not in dev[0].get_capability("auth_alg"): + raise HwsimSkip("SAE not supported") + params = hostapd.wpa2_params(ssid="test-sae", + passphrase="12345678") + params['wpa_key_mgmt'] = 'SAE WPA-PSK' + params['sae_password'] = "sae-password" + hapd = hostapd.add_ap(apdev[0], params) + + dev[0].request("SET sae_groups ") + dev[0].connect("test-sae", psk="sae-password", key_mgmt="SAE", + scan_freq="2412") + dev[1].connect("test-sae", psk="12345678", scan_freq="2412") + dev[2].request("SET sae_groups ") + dev[2].connect("test-sae", sae_password="sae-password", key_mgmt="SAE", + scan_freq="2412") + +def test_sae_password_short(dev, apdev): + """SAE and short password""" + if "SAE" not in dev[0].get_capability("auth_alg"): + raise HwsimSkip("SAE not supported") + params = hostapd.wpa2_params(ssid="test-sae") + params['wpa_key_mgmt'] = 'SAE' + params['sae_password'] = "secret" + hapd = hostapd.add_ap(apdev[0], params) + + dev[0].request("SET sae_groups ") + dev[0].connect("test-sae", sae_password="secret", key_mgmt="SAE", + scan_freq="2412") + +def test_sae_password_long(dev, apdev): + """SAE and long password""" + if "SAE" not in dev[0].get_capability("auth_alg"): + raise HwsimSkip("SAE not supported") + params = hostapd.wpa2_params(ssid="test-sae") + params['wpa_key_mgmt'] = 'SAE' + params['sae_password'] = 100*"A" + hapd = hostapd.add_ap(apdev[0], params) + + dev[0].request("SET sae_groups ") + dev[0].connect("test-sae", sae_password=100*"A", key_mgmt="SAE", + scan_freq="2412") diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index 109a53c7d..c80e16088 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/tests/hwsim/wpasupplicant.py @@ -1010,7 +1010,7 @@ class WpaSupplicant: "private_key2", "phase1", "phase2", "domain_suffix_match", "altsubject_match", "subject_match", "pac_file", "dh_file", "bgscan", "ht_mcs", "id_str", "openssl_ciphers", - "domain_match", "dpp_connector" ] + "domain_match", "dpp_connector", "sae_password" ] for field in quoted: if field in kwargs and kwargs[field]: self.set_network_quoted(id, field, kwargs[field])