]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Update DPP PKEX version indication style
authorJouni Malinen <quic_jouni@quicinc.com>
Tue, 25 Jan 2022 18:16:18 +0000 (20:16 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 25 Jan 2022 18:42:18 +0000 (20:42 +0200)
Update test cases to match implementation.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
tests/hwsim/hostapd.py
tests/hwsim/test_dpp.py
tests/hwsim/wpasupplicant.py

index f9becfcef4a632339d3818a962f6013fc57c6014..4252c43bad8672454108c65dde161aef05325acc 100644 (file)
@@ -508,7 +508,7 @@ class Hostapd:
             raise Exception("Failed to initiate DPP Authentication")
 
     def dpp_pkex_init(self, identifier, code, role=None, key=None, curve=None,
-                      extra=None, use_id=None, v2=False):
+                      extra=None, use_id=None, ver=None):
         if use_id is None:
             id1 = self.dpp_bootstrap_gen(type="pkex", key=key, curve=curve)
         else:
@@ -516,10 +516,9 @@ class Hostapd:
         cmd = "own=%d " % id1
         if identifier:
             cmd += "identifier=%s " % identifier
-        if v2:
-            cmd += "init=2 "
-        else:
-            cmd += "init=1 "
+        cmd += "init=1 "
+        if ver is not None:
+            cmd += "ver=" + str(ver) + " "
         if role:
             cmd += "role=%s " % role
         if extra:
index 94f8c59a36bca06809bb255971fd6c5b86ad1562..12b4becf051a7213c36ef4b71478f4d609a7d7f6 100644 (file)
@@ -2270,7 +2270,7 @@ def test_dpp_pkex(dev, apdev):
 
 def test_dpp_pkex_v2(dev, apdev):
     """DPP and PKEXv2"""
-    run_dpp_pkex(dev, apdev, v2=True)
+    run_dpp_pkex(dev, apdev, ver=2)
 
 def test_dpp_pkex_p256(dev, apdev):
     """DPP and PKEX (P-256)"""
@@ -2325,14 +2325,14 @@ def test_dpp_pkex_identifier_mismatch3(dev, apdev):
 
 def run_dpp_pkex(dev, apdev, curve=None, init_extra=None, check_config=False,
                  identifier_i="test", identifier_r="test",
-                 expect_no_resp=False, v2=False):
-    min_ver = 3 if v2 else 1
+                 expect_no_resp=False, ver=None):
+    min_ver = 3 if ver else 1
     check_dpp_capab(dev[0], curve and "brainpool" in curve, min_ver=min_ver)
     check_dpp_capab(dev[1], curve and "brainpool" in curve, min_ver=min_ver)
     dev[0].dpp_pkex_resp(2437, identifier=identifier_r, code="secret",
                          curve=curve)
     dev[1].dpp_pkex_init(identifier=identifier_i, code="secret", curve=curve,
-                         extra=init_extra, v2=v2)
+                         extra=init_extra, ver=ver)
 
     if expect_no_resp:
         ev = dev[0].wait_event(["DPP-RX"], timeout=10)
@@ -2565,7 +2565,7 @@ def test_dpp_pkex_v2_hostapd_responder(dev, apdev):
     hapd.dpp_pkex_resp(2437, identifier="test", code="secret")
     conf_id = dev[0].dpp_configurator_add()
     dev[0].dpp_pkex_init(identifier="test", code="secret",
-                         extra="conf=ap-dpp configurator=%d" % conf_id, v2=True)
+                         extra="conf=ap-dpp configurator=%d" % conf_id, ver=2)
     wait_auth_success(hapd, dev[0], configurator=dev[0], enrollee=hapd,
                       stop_initiator=True)
 
@@ -2596,7 +2596,7 @@ def test_dpp_pkex_v2_hostapd_initiator(dev, apdev):
     dev[0].dpp_pkex_resp(2437, identifier="test", code="secret",
                          listen_role="configurator")
     hapd.dpp_pkex_init(identifier="test", code="secret", role="enrollee",
-                       v2=True)
+                       ver=2)
     wait_auth_success(hapd, dev[0], configurator=dev[0], enrollee=hapd,
                       stop_initiator=True)
 
index 160aa3e2df88edacb5d393bab06b5955cc3008ae..1f4a6e0485c1621d54202f49f5195bf35f7468cf 100644 (file)
@@ -1577,7 +1577,7 @@ class WpaSupplicant:
         return int(peer)
 
     def dpp_pkex_init(self, identifier, code, role=None, key=None, curve=None,
-                      extra=None, use_id=None, allow_fail=False, v2=False):
+                      extra=None, use_id=None, allow_fail=False, ver=None):
         if use_id is None:
             id1 = self.dpp_bootstrap_gen(type="pkex", key=key, curve=curve)
         else:
@@ -1585,10 +1585,9 @@ class WpaSupplicant:
         cmd = "own=%d " % id1
         if identifier:
             cmd += "identifier=%s " % identifier
-        if v2:
-            cmd += "init=2 "
-        else:
-            cmd += "init=1 "
+        cmd += "init=1 "
+        if ver is not None:
+            cmd += "ver=" + str(ver) + " "
         if role:
             cmd += "role=%s " % role
         if extra: