tests: Update DPP PKEX version indication style

Update test cases to match implementation.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
This commit is contained in:
Jouni Malinen 2022-01-25 20:16:18 +02:00 committed by Jouni Malinen
parent bdcccbc275
commit 008e177597
3 changed files with 14 additions and 16 deletions

View 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:

View 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)

View 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: