|
@@ -1578,6 +1578,49 @@ def test_dpp_pkex_code_mismatch(dev, apdev):
|
|
|
if ev is None:
|
|
|
raise Exception("DPP authentication did not succeed (Responder, retry)")
|
|
|
|
|
|
+def test_dpp_pkex_code_mismatch_limit(dev, apdev):
|
|
|
+ """DPP and PKEX with mismatching code limit"""
|
|
|
+ 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")
|
|
|
+
|
|
|
+ for i in range(5):
|
|
|
+ dev[0].dump_monitor()
|
|
|
+ dev[1].dump_monitor()
|
|
|
+ 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)
|
|
|
+
|
|
|
+ ev = dev[0].wait_event(["DPP-PKEX-T-LIMIT"], timeout=1)
|
|
|
+ if ev is None:
|
|
|
+ raise Exception("PKEX t limit not reported")
|
|
|
+
|
|
|
def test_dpp_pkex_curve_mismatch(dev, apdev):
|
|
|
"""DPP and PKEX with mismatching curve"""
|
|
|
check_dpp_capab(dev[0])
|