tests: hostapd as DPP Responder requiring mutual authentication
This verifies the qr=mutual case with STATUS_RESPONSE_PENDING. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
1fafdf1124
commit
efa77d0abf
1 changed files with 55 additions and 0 deletions
|
@ -385,6 +385,61 @@ def test_dpp_qr_code_auth_mutual_curve_mismatch(dev, apdev):
|
|||
if "FAIL" not in res:
|
||||
raise Exception("DPP_AUTH_INIT accepted unexpectedly")
|
||||
|
||||
def test_dpp_qr_code_auth_hostapd_mutual2(dev, apdev):
|
||||
"""DPP QR Code and authentication exchange (hostapd mutual2)"""
|
||||
check_dpp_capab(dev[0])
|
||||
hapd = hostapd.add_ap(apdev[0], { "ssid": "unconfigured" })
|
||||
check_dpp_capab(hapd)
|
||||
|
||||
logger.info("AP displays QR Code")
|
||||
addr = hapd.own_addr().replace(':', '')
|
||||
cmd = "DPP_BOOTSTRAP_GEN type=qrcode chan=81/1 mac=" + addr
|
||||
res = hapd.request(cmd)
|
||||
if "FAIL" in res:
|
||||
raise Exception("Failed to generate bootstrapping info")
|
||||
id_h = int(res)
|
||||
uri_h = hapd.request("DPP_BOOTSTRAP_GET_URI %d" % id_h)
|
||||
|
||||
logger.info("dev0 scans QR Code")
|
||||
res = dev[0].request("DPP_QR_CODE " + uri_h)
|
||||
if "FAIL" in res:
|
||||
raise Exception("Failed to parse QR Code URI")
|
||||
id0 = int(res)
|
||||
|
||||
logger.info("dev0 displays QR Code")
|
||||
addr = dev[0].own_addr().replace(':', '')
|
||||
res = dev[0].request("DPP_BOOTSTRAP_GEN type=qrcode chan=81/1 mac=" + addr)
|
||||
if "FAIL" in res:
|
||||
raise Exception("Failed to generate bootstrapping info")
|
||||
id0b = int(res)
|
||||
uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0b)
|
||||
|
||||
logger.info("dev0 initiates DPP Authentication")
|
||||
if "OK" not in hapd.request("DPP_LISTEN 2412 qr=mutual"):
|
||||
raise Exception("Failed to start listen operation")
|
||||
if "OK" not in dev[0].request("DPP_AUTH_INIT peer=%d own=%d" % (id0, id0b)):
|
||||
raise Exception("Failed to initiate DPP Authentication")
|
||||
|
||||
ev = dev[0].wait_event(["DPP-RESPONSE-PENDING"], timeout=5)
|
||||
if ev is None:
|
||||
raise Exception("Pending response not reported")
|
||||
ev = hapd.wait_event(["DPP-SCAN-PEER-QR-CODE"], timeout=5)
|
||||
if ev is None:
|
||||
raise Exception("QR Code scan for mutual authentication not requested")
|
||||
|
||||
logger.info("AP scans QR Code")
|
||||
res = hapd.request("DPP_QR_CODE " + uri0)
|
||||
if "FAIL" in res:
|
||||
raise Exception("Failed to parse QR Code URI")
|
||||
|
||||
ev = hapd.wait_event(["DPP-AUTH-SUCCESS"], timeout=5)
|
||||
if ev is None:
|
||||
raise Exception("DPP authentication did not succeed (Responder)")
|
||||
ev = dev[0].wait_event(["DPP-AUTH-SUCCESS"], timeout=5)
|
||||
if ev is None:
|
||||
raise Exception("DPP authentication did not succeed (Initiator)")
|
||||
hapd.request("DPP_STOP_LISTEN")
|
||||
|
||||
def test_dpp_qr_code_listen_continue(dev, apdev):
|
||||
"""DPP QR Code and listen operation needing continuation"""
|
||||
check_dpp_capab(dev[0])
|
||||
|
|
Loading…
Reference in a new issue