From 46746fc170783c674de2bd2afbfc4eee7ebbf5dc Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 27 Oct 2019 15:16:03 +0200 Subject: [PATCH] tests: Additional SAE protocol testing Check behavior with delayed/replayed SAE commit message. Signed-off-by: Jouni Malinen --- tests/hwsim/test_sae.py | 166 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 162 insertions(+), 4 deletions(-) diff --git a/tests/hwsim/test_sae.py b/tests/hwsim/test_sae.py index 8f53d06e3..e45287d44 100644 --- a/tests/hwsim/test_sae.py +++ b/tests/hwsim/test_sae.py @@ -749,6 +749,168 @@ def test_sae_proto_ffc(dev, apdev): hapd.set("ext_mgmt_frame_handling", "0") hapd.dump_monitor() + +def test_sae_proto_commit_delayed(dev, apdev): + """SAE protocol testing - Commit delayed""" + 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' + hapd = hostapd.add_ap(apdev[0], params) + bssid = apdev[0]['bssid'] + + dev[0].request("SET sae_groups 19") + + dev[0].scan_for_bss(bssid, freq=2412) + hapd.set("ext_mgmt_frame_handling", "1") + dev[0].connect("test-sae", psk="12345678", key_mgmt="SAE", + scan_freq="2412", wait_connect=False) + + logger.info("Commit") + for i in range(0, 10): + req = hapd.mgmt_rx() + if req is None: + raise Exception("MGMT RX wait timed out (commit)") + if req['subtype'] == 11: + break + req = None + if not req: + raise Exception("Authentication frame (commit) not received") + + hapd.dump_monitor() + time.sleep(2.5) + hapd.request("MGMT_RX_PROCESS freq=2412 datarate=0 ssi_signal=-30 frame=" + binascii.hexlify(req['frame']).decode()) + + logger.info("Commit/Confirm") + for i in range(0, 10): + req = hapd.mgmt_rx() + if req is None: + raise Exception("MGMT RX wait timed out (confirm)") + if req['subtype'] == 11: + trans, = struct.unpack('