From 3ab781fb290a8d91391420c9313a9d03c3387cb4 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 1 Sep 2024 16:33:26 +0300 Subject: [PATCH] tests: DPP and SAE password identifier Signed-off-by: Jouni Malinen --- tests/hwsim/test_dpp.py | 19 ++++++++++++++++--- tests/hwsim/wpasupplicant.py | 4 +++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/tests/hwsim/test_dpp.py b/tests/hwsim/test_dpp.py index a3b5eb024..0a74b7e93 100644 --- a/tests/hwsim/test_dpp.py +++ b/tests/hwsim/test_dpp.py @@ -2322,6 +2322,15 @@ def test_dpp_auto_connect_legacy_sae_3(dev, apdev): finally: dev[0].set("dpp_config_processing", "0", allow_fail=True) +def test_dpp_auto_connect_legacy_sae_pw_id(dev, apdev): + """DPP and auto connect (legacy SAE with password identifier)""" + check_dpp_capab(dev[0], min_ver=3) + try: + run_dpp_auto_connect_legacy(dev, apdev, conf='sta-sae', sae_only=True, + password_id="id") + finally: + dev[0].set("dpp_config_processing", "0", allow_fail=True) + def test_dpp_auto_connect_legacy_psk_sae_1(dev, apdev): """DPP and auto connect (legacy PSK+SAE)""" try: @@ -2348,11 +2357,15 @@ def test_dpp_auto_connect_legacy_psk_sae_3(dev, apdev): def run_dpp_auto_connect_legacy(dev, apdev, conf='sta-psk', ssid_charset=None, psk_sae=False, sae_only=False, - password="secret passphrase"): + password="secret passphrase", + password_id=None): check_dpp_capab(dev[0]) check_dpp_capab(dev[1]) - if sae_only: + if sae_only and password_id: + params = hostapd.wpa3_params(ssid="dpp-legacy", + password=password + '|id=' + password_id) + elif sae_only: params = hostapd.wpa3_params(ssid="dpp-legacy", password=password) else: @@ -2373,7 +2386,7 @@ def run_dpp_auto_connect_legacy(dev, apdev, conf='sta-psk', dev[0].dpp_listen(2412) dev[1].dpp_auth_init(uri=uri0, conf=conf, ssid="dpp-legacy", ssid_charset=ssid_charset, - passphrase=password) + passphrase=password, password_id=password_id) 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) diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index c2c9e70ef..8d4da761d 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/tests/hwsim/wpasupplicant.py @@ -1592,7 +1592,7 @@ class WpaSupplicant: ssid=None, passphrase=None, expect_fail=False, tcp_addr=None, tcp_port=None, conn_status=False, ssid_charset=None, nfc_uri=None, netrole=None, - csrattrs=None): + csrattrs=None, password_id=None): cmd = "DPP_AUTH_INIT" if peer is None: if nfc_uri: @@ -1618,6 +1618,8 @@ class WpaSupplicant: cmd += " ssid_charset=%d" % ssid_charset if passphrase: cmd += " pass=" + binascii.hexlify(passphrase.encode()).decode() + if password_id: + cmd += " idpass=" + binascii.hexlify(password_id.encode()).decode() if tcp_addr: cmd += " tcp_addr=" + tcp_addr if tcp_port: