diff mbox series

[36/40] tests: Add PASN test with comeback flow

Message ID 20191215093438.10120-37-ilan.peer@intel.com
State Changes Requested
Headers show
Series Support for Pre association Security Negotiation (PASN) | expand

Commit Message

Peer, Ilan Dec. 15, 2019, 9:34 a.m. UTC
Signed-off-by: Ilan Peer <ilan.peer@intel.com>
---
 tests/hwsim/test_pasn.py | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
diff mbox series

Patch

diff --git a/tests/hwsim/test_pasn.py b/tests/hwsim/test_pasn.py
index 7e20dbcbd4..5ca11e7bec 100644
--- a/tests/hwsim/test_pasn.py
+++ b/tests/hwsim/test_pasn.py
@@ -21,6 +21,7 @@  from utils import HwsimSkip
 from hwsim import HWSimRadio
 from test_erp import check_erp_capa, start_erp_as
 from test_fils import check_fils_capa
+import re
 
 def pasn_ap_params(akmp="PASN", cipher="CCMP", group="19"):
     params = {"ssid": "test-wpa2-pasn",
@@ -493,3 +494,42 @@  def test_pasn_fils_sha256_connected_diff_channel(dev, apdev, params):
 def test_pasn_fils_sha384_connected_diff_channel(dev, apdev, params):
     """PASN FILS authentication using SHA-384 while connected diff channel"""
     check_pasn_fils_connected_diff_channel(dev, apdev, params, "FILS-SHA384")
+
+@remote_compatible
+def test_pasn_comeback(dev, apdev, params):
+    """ PASN authentication with comeback flow """
+    params = pasn_ap_params("PASN", "CCMP", "19")
+    params['anti_clogging_threshold'] = '0'
+    hapd = hostapd.add_ap(apdev[0], params)
+
+    dev[0].scan(type="ONLY", freq=2412)
+    cmd = "PASN_START bssid=%s akmp=PASN cipher=CCMP group=19" % (hapd.own_addr())
+
+    resp = dev[0].request(cmd)
+    if "OK" not in resp:
+        raise Exception("Failed to start PASN authentication")
+
+    ev = dev[0].wait_event(["PASN-AUTH-STATUS"], 3)
+    if not ev:
+        raise Exception("PASN: PASN-AUTH-STATUS not seen")
+
+    if hapd.own_addr() + " akmp=PASN, status=30 comeback_after=" not in ev:
+        raise Exception("PASN: unexpected status")
+
+    comeback = re.split("comeback=", ev)[1]
+
+    cmd = "PASN_START bssid=%s akmp=PASN cipher=CCMP group=19 comeback=%s" % \
+            (hapd.own_addr(), comeback)
+
+    resp = dev[0].request(cmd)
+    if "OK" not in resp:
+        raise Exception("Failed to start PASN authentication")
+
+    ev = dev[0].wait_event(["PASN-AUTH-STATUS"], 3)
+    if not ev:
+        raise Exception("PASN: PASN-AUTH-STATUS not seen")
+
+    if hapd.own_addr() + " akmp=PASN, status=0" not in ev:
+        raise Exception("PASN: unexpected status with comeback token")
+
+    check_pasn_ptk(dev[0], hapd, "CCMP")