From a6cf5cd655f566551f5a9e0a5c000b8e7bff95af Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 29 Dec 2013 12:24:25 +0200 Subject: [PATCH] tests: Verify SAE anti-clogging mechanism Signed-hostap: Jouni Malinen --- tests/hwsim/test_sae.py | 21 +++++++++++++++++++++ tests/hwsim/wpasupplicant.py | 4 +++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/tests/hwsim/test_sae.py b/tests/hwsim/test_sae.py index 39d745f3b..3461c54c6 100644 --- a/tests/hwsim/test_sae.py +++ b/tests/hwsim/test_sae.py @@ -63,3 +63,24 @@ def test_sae_group_nego(dev, apdev): scan_freq="2412") if dev[0].get_status_field('sae_group') != '19': raise Exception("Expected SAE group not used") + +def test_sae_anti_clogging(dev, apdev): + """SAE anti clogging""" + params = hostapd.wpa2_params(ssid="test-sae", passphrase="12345678") + params['wpa_key_mgmt'] = 'SAE' + params['sae_anti_clogging_threshold'] = '1' + hostapd.add_ap(apdev[0]['ifname'], params) + + dev[0].request("SET sae_groups ") + dev[1].request("SET sae_groups ") + id = {} + for i in range(0, 2): + dev[i].scan(freq="2412") + id[i] = dev[i].connect("test-sae", psk="12345678", key_mgmt="SAE", + scan_freq="2412", only_add_network=True) + for i in range(0, 2): + dev[i].select_network(id[i]) + for i in range(0, 2): + ev = dev[i].wait_event(["CTRL-EVENT-CONNECTED"], timeout=10) + if ev is None: + raise Exception("Association with the AP timed out") diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index ad6972573..2ce964ba5 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/tests/hwsim/wpasupplicant.py @@ -533,7 +533,7 @@ class WpaSupplicant: password=None, phase1=None, phase2=None, ca_cert=None, domain_suffix_match=None, password_hex=None, client_cert=None, private_key=None, peerkey=False, - wait_connect=True): + wait_connect=True, only_add_network=False): logger.info("Connect STA " + self.ifname + " to AP") id = self.add_network() self.set_network_quoted(id, "ssid", ssid) @@ -579,6 +579,8 @@ class WpaSupplicant: domain_suffix_match) if peerkey: self.set_network(id, "peerkey", "1") + if only_add_network: + return id if wait_connect: self.connect_network(id) else: