tests: DPP ssid_charset/ssid64

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2019-11-28 15:23:09 +02:00 committed by Jouni Malinen
parent 181bf93363
commit ca6a2ac705
2 changed files with 20 additions and 1 deletions

View file

@ -1776,6 +1776,13 @@ def test_dpp_auto_connect_legacy(dev, apdev):
finally: finally:
dev[0].set("dpp_config_processing", "0") dev[0].set("dpp_config_processing", "0")
def test_dpp_auto_connect_legacy_ssid_charset(dev, apdev):
"""DPP and auto connect (legacy, ssid_charset)"""
try:
run_dpp_auto_connect_legacy(dev, apdev, ssid_charset=12345)
finally:
dev[0].set("dpp_config_processing", "0")
def test_dpp_auto_connect_legacy_sae_1(dev, apdev): def test_dpp_auto_connect_legacy_sae_1(dev, apdev):
"""DPP and auto connect (legacy SAE)""" """DPP and auto connect (legacy SAE)"""
try: try:
@ -1814,6 +1821,7 @@ def test_dpp_auto_connect_legacy_psk_sae_3(dev, apdev):
dev[0].set("dpp_config_processing", "0") dev[0].set("dpp_config_processing", "0")
def run_dpp_auto_connect_legacy(dev, apdev, conf='sta-psk', def run_dpp_auto_connect_legacy(dev, apdev, conf='sta-psk',
ssid_charset=None,
psk_sae=False, sae_only=False): psk_sae=False, sae_only=False):
check_dpp_capab(dev[0]) check_dpp_capab(dev[0])
check_dpp_capab(dev[1]) check_dpp_capab(dev[1])
@ -1837,8 +1845,16 @@ def run_dpp_auto_connect_legacy(dev, apdev, conf='sta-psk',
dev[0].dpp_listen(2412) dev[0].dpp_listen(2412)
dev[1].dpp_auth_init(uri=uri0, conf=conf, ssid="dpp-legacy", dev[1].dpp_auth_init(uri=uri0, conf=conf, ssid="dpp-legacy",
ssid_charset=ssid_charset,
passphrase="secret passphrase") passphrase="secret passphrase")
wait_auth_success(dev[0], dev[1], configurator=dev[1], enrollee=dev[0]) wait_auth_success(dev[0], dev[1], configurator=dev[1], enrollee=dev[0])
if ssid_charset:
ev = dev[0].wait_event(["DPP-CONFOBJ-SSID-CHARSET"], timeout=1)
if ev is None:
raise Exception("ssid_charset not reported")
charset = ev.split(' ')[1]
if charset != str(ssid_charset):
raise Exception("Incorrect ssid_charset reported: " + ev)
ev = dev[0].wait_event(["DPP-NETWORK-ID"], timeout=1) ev = dev[0].wait_event(["DPP-NETWORK-ID"], timeout=1)
if ev is None: if ev is None:
raise Exception("DPP network profile not generated") raise Exception("DPP network profile not generated")

View file

@ -1458,7 +1458,8 @@ class WpaSupplicant:
def dpp_auth_init(self, peer=None, uri=None, conf=None, configurator=None, def dpp_auth_init(self, peer=None, uri=None, conf=None, configurator=None,
extra=None, own=None, role=None, neg_freq=None, extra=None, own=None, role=None, neg_freq=None,
ssid=None, passphrase=None, expect_fail=False, ssid=None, passphrase=None, expect_fail=False,
tcp_addr=None, tcp_port=None, conn_status=False): tcp_addr=None, tcp_port=None, conn_status=False,
ssid_charset=None):
cmd = "DPP_AUTH_INIT" cmd = "DPP_AUTH_INIT"
if peer is None: if peer is None:
peer = self.dpp_qr_code(uri) peer = self.dpp_qr_code(uri)
@ -1477,6 +1478,8 @@ class WpaSupplicant:
cmd += " neg_freq=%d" % neg_freq cmd += " neg_freq=%d" % neg_freq
if ssid: if ssid:
cmd += " ssid=" + binascii.hexlify(ssid.encode()).decode() cmd += " ssid=" + binascii.hexlify(ssid.encode()).decode()
if ssid_charset:
cmd += " ssid_charset=%d" % ssid_charset
if passphrase: if passphrase:
cmd += " pass=" + binascii.hexlify(passphrase.encode()).decode() cmd += " pass=" + binascii.hexlify(passphrase.encode()).decode()
if tcp_addr: if tcp_addr: