From a7758916c67b942d7f2e91d48c4b03e5c2fada86 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 2 Dec 2018 12:44:13 +0200 Subject: [PATCH] tests: DPP and PKEX with local failure in processing Exchange Resp Signed-off-by: Jouni Malinen --- tests/hwsim/test_dpp.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/hwsim/test_dpp.py b/tests/hwsim/test_dpp.py index 96c834925..203e83ead 100644 --- a/tests/hwsim/test_dpp.py +++ b/tests/hwsim/test_dpp.py @@ -3120,6 +3120,38 @@ def run_dpp_pkex_curve_mismatch_failure(dev, apdev, func): if "Mismatching PKEX curve: peer=20 own=19" not in ev: raise Exception("Unexpected result: " + ev) +def test_dpp_pkex_exchange_resp_processing_failure(dev, apdev): + """DPP and PKEX with local failure in processing Exchange Resp""" + 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") + + with fail_test(dev[1], 1, "dpp_pkex_derive_Qr;dpp_pkex_rx_exchange_resp"): + cmd = "DPP_PKEX_ADD own=%d identifier=test init=1 code=secret" % id1 + res = dev[1].request(cmd) + if "FAIL" in res: + raise Exception("Failed to set PKEX data (initiator)") + wait_fail_trigger(dev[1], "GET_FAIL") + def test_dpp_pkex_config2(dev, apdev): """DPP and PKEX with responder as the configurator""" check_dpp_capab(dev[0])