aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <jouni@codeaurora.org>2019-12-03 16:27:52 (GMT)
committerJouni Malinen <j@w1.fi>2019-12-05 10:37:51 (GMT)
commit4a667b01e6f537cc8976996ac774040d28d7b908 (patch)
treeedbb8862a6ce7155f4ff6c641924cecd82d52c05
parente780b4bf2032d1cdea76e515a7ebaffda484e53e (diff)
downloadhostap-4a667b01e6f537cc8976996ac774040d28d7b908.zip
hostap-4a667b01e6f537cc8976996ac774040d28d7b908.tar.gz
hostap-4a667b01e6f537cc8976996ac774040d28d7b908.tar.bz2
tests: DPP bootstrapping via NFC URI record
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
-rw-r--r--tests/hwsim/test_dpp.py18
-rw-r--r--tests/hwsim/wpasupplicant.py13
2 files changed, 29 insertions, 2 deletions
diff --git a/tests/hwsim/test_dpp.py b/tests/hwsim/test_dpp.py
index c96aeee..3ff9ef4 100644
--- a/tests/hwsim/test_dpp.py
+++ b/tests/hwsim/test_dpp.py
@@ -4853,3 +4853,21 @@ def run_dpp_config_save(dev, apdev, config, conf_ssid, exp_ssid):
raise Exception("SSID not saved")
if 'psk="secret passphrase"' not in data:
raise Exception("Passphtase not saved")
+
+def test_dpp_nfc_uri(dev, apdev):
+ """DPP bootstrapping via NFC URI record"""
+ check_dpp_capab(dev[0])
+ check_dpp_capab(dev[1])
+
+ id = dev[0].dpp_bootstrap_gen(type="nfc-uri", chan="81/1", mac=True)
+ uri = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id)
+ logger.info("Generated URI: " + uri)
+ info = dev[0].request("DPP_BOOTSTRAP_INFO %d" % id)
+ logger.info("Bootstrapping info:\n" + info)
+ if "type=NFC-URI" not in info:
+ raise Exception("Unexpected bootstrapping info contents")
+
+ dev[0].dpp_listen(2412)
+ conf_id = dev[1].dpp_configurator_add()
+ dev[1].dpp_auth_init(nfc_uri=uri, configurator=conf_id, conf="sta-dpp")
+ wait_auth_success(dev[0], dev[1], configurator=dev[1], enrollee=dev[0])
diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py
index 26315fc..c9ebb25 100644
--- a/tests/hwsim/wpasupplicant.py
+++ b/tests/hwsim/wpasupplicant.py
@@ -1424,6 +1424,12 @@ class WpaSupplicant:
raise Exception("Failed to parse QR Code URI")
return int(res)
+ def dpp_nfc_uri(self, uri):
+ res = self.request("DPP_NFC_URI " + uri)
+ if "FAIL" in res:
+ raise Exception("Failed to parse NFC URI")
+ return int(res)
+
def dpp_bootstrap_gen(self, type="qrcode", chan=None, mac=None, info=None,
curve=None, key=None):
cmd = "DPP_BOOTSTRAP_GEN type=" + type
@@ -1459,10 +1465,13 @@ class WpaSupplicant:
extra=None, own=None, role=None, neg_freq=None,
ssid=None, passphrase=None, expect_fail=False,
tcp_addr=None, tcp_port=None, conn_status=False,
- ssid_charset=None):
+ ssid_charset=None, nfc_uri=None):
cmd = "DPP_AUTH_INIT"
if peer is None:
- peer = self.dpp_qr_code(uri)
+ if nfc_uri:
+ peer = self.dpp_nfc_uri(nfc_uri)
+ else:
+ peer = self.dpp_qr_code(uri)
cmd += " peer=%d" % peer
if own is not None:
cmd += " own=%d" % own