]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: DPP and Enrollee rejecting Config Object
authorJouni Malinen <jouni@codeaurora.org>
Thu, 14 Mar 2019 15:26:09 +0000 (17:26 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 14 Mar 2019 22:31:09 +0000 (00:31 +0200)
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
tests/hwsim/example-hostapd.config
tests/hwsim/example-wpa_supplicant.config
tests/hwsim/test_dpp.py

index f52a3bd9aaddbb58ef7a80115cab625d6be3c92f..1b98ad4fb80ef598a25db02e0bddc2a3824d9d2e 100644 (file)
@@ -110,3 +110,4 @@ CONFIG_FILS=y
 CONFIG_FILS_SK_PFS=y
 CONFIG_OWE=y
 CONFIG_DPP=y
+CONFIG_DPP2=y
index b82a0932b8c2f734050dff7dca4d6b3106b69a56..4c051c2a19dbc39912669f7545a7cd1f18df77a3 100644 (file)
@@ -152,3 +152,4 @@ CONFIG_FILS_SK_PFS=y
 CONFIG_PMKSA_CACHE_EXTERNAL=y
 CONFIG_OWE=y
 CONFIG_DPP=y
+CONFIG_DPP2=y
index c7ba2926fe1b50ebe9f76b5ec1b38f8bd73cf664..ec2ab365c904b8811693f9280e1582ff862707ed 100644 (file)
@@ -5391,3 +5391,57 @@ def test_dpp_duplicated_auth_resp(dev, apdev):
     rx_process_frame(dev[0])
 
     wait_conf_completion(dev[1], dev[0])
+
+def test_dpp_enrollee_reject_config(dev, apdev):
+    """DPP and Enrollee rejecting Config Object"""
+    check_dpp_capab(dev[0])
+    check_dpp_capab(dev[1])
+    dev[0].set("dpp_test", "91")
+
+    id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
+    uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
+    id1 = dev[1].dpp_qr_code(uri0)
+
+    cmd = "DPP_LISTEN 2412"
+    if "OK" not in dev[0].request(cmd):
+        raise Exception("Failed to start listen operation")
+
+    cmd = "DPP_AUTH_INIT peer=%d conf=sta-sae ssid=%s pass=%s" % (id1,
+        binascii.hexlify(b"dpp-legacy").decode(),
+        binascii.hexlify(b"secret passphrase").decode())
+    if "OK" not in dev[1].request(cmd):
+        raise Exception("Failed to initiate DPP Authentication")
+    ev = dev[1].wait_event(["DPP-CONF-FAILED"], timeout=10)
+    if ev is None:
+        raise Exception("DPP configuration failure not reported by Configurator")
+    ev = dev[0].wait_event(["DPP-CONF-FAILED"], timeout=2)
+    if ev is None:
+        raise Exception("Forced DPP configuration failure not reported by Enrollee")
+
+def test_dpp_enrollee_ap_reject_config(dev, apdev):
+    """DPP and Enrollee AP rejecting Config Object"""
+    check_dpp_capab(dev[0])
+    check_dpp_capab(dev[1])
+    hapd = hostapd.add_ap(apdev[0], { "ssid": "unconfigured" })
+    check_dpp_capab(hapd)
+    hapd.set("dpp_test", "91")
+
+    cmd = "DPP_CONFIGURATOR_ADD"
+    res = dev[0].request(cmd)
+    if "FAIL" in res:
+        raise Exception("Failed to add configurator")
+    conf_id = int(res)
+
+    id_h = hapd.dpp_bootstrap_gen(chan="81/1", mac=True)
+    uri = hapd.request("DPP_BOOTSTRAP_GET_URI %d" % id_h)
+    id = dev[0].dpp_qr_code(uri)
+
+    cmd = "DPP_AUTH_INIT peer=%d conf=ap-dpp configurator=%d" % (id, conf_id)
+    if "OK" not in dev[0].request(cmd):
+        raise Exception("Failed to initiate DPP Authentication")
+    ev = dev[0].wait_event(["DPP-CONF-FAILED"], timeout=10)
+    if ev is None:
+        raise Exception("DPP configuration failure not reported by Configurator")
+    ev = hapd.wait_event(["DPP-CONF-FAILED"], timeout=2)
+    if ev is None:
+        raise Exception("Forced DPP configuration failure not reported by Enrollee")