From 41dafe0c0a8ccd204300210813ebd3a286022a8b Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 2 Dec 2017 01:17:37 +0200 Subject: [PATCH] tests: DPP testing to check for mutual authentication on Initiator Signed-off-by: Jouni Malinen --- tests/hwsim/test_dpp.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/hwsim/test_dpp.py b/tests/hwsim/test_dpp.py index 277d6806f..9fa336114 100644 --- a/tests/hwsim/test_dpp.py +++ b/tests/hwsim/test_dpp.py @@ -251,6 +251,13 @@ def test_dpp_qr_code_auth_mutual(dev, apdev): raise Exception("Failed to start listen operation") if "OK" not in dev[1].request("DPP_AUTH_INIT peer=%d own=%d" % (id1, id1b)): raise Exception("Failed to initiate DPP Authentication") + + ev = dev[1].wait_event(["DPP-AUTH-DIRECTION"], timeout=5) + if ev is None: + raise Exception("DPP authentication direction not indicated (Initiator)") + if "mutual=1" not in ev: + raise Exception("Mutual authentication not used") + ev = dev[0].wait_event(["DPP-AUTH-SUCCESS"], timeout=5) if ev is None: raise Exception("DPP authentication did not succeed (Responder)") @@ -304,6 +311,12 @@ def test_dpp_qr_code_auth_mutual2(dev, apdev): raise Exception("Failed to parse QR Code URI") id0b = int(res) + ev = dev[1].wait_event(["DPP-AUTH-DIRECTION"], timeout=5) + if ev is None: + raise Exception("DPP authentication direction not indicated (Initiator)") + if "mutual=1" not in ev: + raise Exception("Mutual authentication not used") + ev = dev[0].wait_event(["DPP-AUTH-SUCCESS"], timeout=5) if ev is None: raise Exception("DPP authentication did not succeed (Responder)") @@ -375,6 +388,12 @@ def run_dpp_qr_code_auth_mutual(dev, apdev, curve): if "FAIL" in res: raise Exception("Failed to parse QR Code URI") + ev = dev[1].wait_event(["DPP-AUTH-DIRECTION"], timeout=5) + if ev is None: + raise Exception("DPP authentication direction not indicated (Initiator)") + if "mutual=1" not in ev: + raise Exception("Mutual authentication not used") + ev = dev[0].wait_event(["DPP-AUTH-SUCCESS"], timeout=5) if ev is None: raise Exception("DPP authentication did not succeed (Responder)") @@ -484,6 +503,13 @@ def test_dpp_qr_code_auth_mutual_not_used(dev, apdev): raise Exception("Failed to start listen operation") if "OK" not in dev[1].request("DPP_AUTH_INIT peer=%d own=%d" % (id1, id1b)): raise Exception("Failed to initiate DPP Authentication") + + ev = dev[1].wait_event(["DPP-AUTH-DIRECTION"], timeout=5) + if ev is None: + raise Exception("DPP authentication direction not indicated (Initiator)") + if "mutual=0" not in ev: + raise Exception("Mutual authentication not used") + ev = dev[0].wait_event(["DPP-AUTH-SUCCESS"], timeout=5) if ev is None: raise Exception("DPP authentication did not succeed (Responder)")