tests: DPP and PKEX with mismatching code

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2017-11-02 12:22:29 +02:00 committed by Jouni Malinen
parent 219d4c9fcb
commit d592d13433

View file

@ -1527,6 +1527,42 @@ def run_dpp_pkex(dev, apdev, curve=None, init_extra="", check_config=False):
if ev is None: if ev is None:
raise Exception("DPP configuration not completed (Enrollee)") raise Exception("DPP configuration not completed (Enrollee)")
def test_dpp_pkex_code_mismatch(dev, apdev):
"""DPP and PKEX with mismatching code"""
check_dpp_capab(dev[0])
check_dpp_capab(dev[1])
cmd = "DPP_BOOTSTRAP_GEN type=pkex"
res = dev[0].request(cmd)
if "FAIL" in res:
raise Exception("Failed to generate bootstrapping info")
id0 = int(res)
cmd = "DPP_BOOTSTRAP_GEN type=pkex"
res = dev[1].request(cmd)
if "FAIL" in res:
raise Exception("Failed to generate bootstrapping info")
id1 = int(res)
cmd = "DPP_PKEX_ADD own=%d identifier=test code=secret" % (id0)
res = dev[0].request(cmd)
if "FAIL" in res:
raise Exception("Failed to set PKEX data (responder)")
cmd = "DPP_LISTEN 2437"
if "OK" not in dev[0].request(cmd):
raise Exception("Failed to start listen operation")
cmd = "DPP_PKEX_ADD own=%d identifier=test init=1 code=unknown" % id1
res = dev[1].request(cmd)
if "FAIL" in res:
raise Exception("Failed to set PKEX data (initiator)")
ev = dev[0].wait_event(["DPP-FAIL"], timeout=5)
if ev is None:
raise Exception("Failure not reported")
if "possible PKEX code mismatch" not in ev:
raise Exception("Unexpected result: " + ev)
def test_dpp_pkex_config2(dev, apdev): def test_dpp_pkex_config2(dev, apdev):
"""DPP and PKEX with responder as the configurator""" """DPP and PKEX with responder as the configurator"""
check_dpp_capab(dev[0]) check_dpp_capab(dev[0])