tests: SAE and preferred AP using wrong password

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
This commit is contained in:
Jouni Malinen 2022-11-24 12:06:59 +02:00 committed by Jouni Malinen
parent 65c8633d90
commit 7c62bccc6e
2 changed files with 52 additions and 0 deletions

View file

@ -703,6 +703,18 @@ def terminate(apdev):
hapd_global = HostapdGlobal(apdev)
hapd_global.terminate()
def wpa3_params(ssid=None, password=None, wpa_key_mgmt="SAE",
ieee80211w="2"):
params = {"wpa": "2",
"wpa_key_mgmt": wpa_key_mgmt,
"ieee80211w": ieee80211w,
"rsn_pairwise": "CCMP"}
if ssid:
params["ssid"] = ssid
if password:
params["sae_password"] = password
return params
def wpa2_params(ssid=None, passphrase=None, wpa_key_mgmt="WPA-PSK",
ieee80211w=None):
params = {"wpa": "2",

View file

@ -2982,3 +2982,43 @@ def run_sae_ext_key_h2e_rejected_group(dev, apdev, ap_groups, sta_groups,
finally:
dev[0].set("sae_groups", "")
dev[0].set("sae_pwe", "0")
def test_sae_pref_ap_wrong_password(dev, apdev):
"""SAE and preferred AP using wrong password"""
check_sae_capab(dev[0])
params = hostapd.wpa3_params(ssid="test-sae", password="correct")
params['ieee80211n'] = '0'
hapd = hostapd.add_ap(apdev[0], params)
params = hostapd.wpa3_params(ssid="test-sae", password="wrong")
hapd2 = hostapd.add_ap(apdev[1], params)
dev[0].scan_for_bss(hapd.own_addr(), freq=2412)
dev[0].scan_for_bss(hapd2.own_addr(), freq=2412)
dev[0].set("sae_groups", "")
dev[0].connect("test-sae", sae_password="correct", key_mgmt="SAE",
ieee80211w="2", scan_freq="2412")
def test_sae_pref_ap_wrong_password2(dev, apdev):
"""SAE and preferred AP using wrong password (2)"""
check_sae_capab(dev[0])
params = hostapd.wpa3_params(ssid="test-sae", password="wrong")
hapd2 = hostapd.add_ap(apdev[1], params)
dev[0].scan_for_bss(hapd2.own_addr(), freq=2412)
dev[0].set("sae_groups", "")
dev[0].connect("test-sae", sae_password="correct", key_mgmt="SAE",
ieee80211w="2", scan_freq="2412", wait_connect=False)
ev = dev[0].wait_event(["CTRL-EVENT-SSID-TEMP-DISABLED"], timeout=30)
if ev is None:
raise Exception("Temporary disabled of SSID not seen")
params = hostapd.wpa3_params(ssid="test-sae", password="correct")
params['ieee80211n'] = '0'
hapd = hostapd.add_ap(apdev[0], params)
dev[0].wait_connected(timeout=40)