From 18116e38a2c9894496ef22b010264da166646f8b Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 22 Aug 2024 11:27:00 +0300 Subject: [PATCH] tests: DPP and SAE with short password Signed-off-by: Jouni Malinen --- tests/hwsim/test_dpp.py | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/tests/hwsim/test_dpp.py b/tests/hwsim/test_dpp.py index 518983bd0..a3b5eb024 100644 --- a/tests/hwsim/test_dpp.py +++ b/tests/hwsim/test_dpp.py @@ -2314,6 +2314,14 @@ def test_dpp_auto_connect_legacy_sae_2(dev, apdev): finally: dev[0].set("dpp_config_processing", "0", allow_fail=True) +def test_dpp_auto_connect_legacy_sae_3(dev, apdev): + """DPP and auto connect (legacy SAE with short password)""" + try: + run_dpp_auto_connect_legacy(dev, apdev, conf='sta-sae', sae_only=True, + password="1234567") + 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: @@ -2339,16 +2347,18 @@ 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): + psk_sae=False, sae_only=False, + password="secret passphrase"): check_dpp_capab(dev[0]) check_dpp_capab(dev[1]) - params = hostapd.wpa2_params(ssid="dpp-legacy", - passphrase="secret passphrase") if sae_only: - params['wpa_key_mgmt'] = 'SAE' - params['ieee80211w'] = '2' - elif psk_sae: + params = hostapd.wpa3_params(ssid="dpp-legacy", + password=password) + else: + params = hostapd.wpa2_params(ssid="dpp-legacy", + passphrase=password) + if psk_sae: params['wpa_key_mgmt'] = 'WPA-PSK SAE' params['ieee80211w'] = '1' params['sae_require_mfp'] = '1' @@ -2363,7 +2373,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="secret passphrase") + passphrase=password) 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)