tests: SAE protocol testing and a valid commit after a failed one

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
This commit is contained in:
Jouni Malinen 2024-06-20 18:24:10 +03:00 committed by Jouni Malinen
parent 761041b18a
commit 7cf0021267

View file

@ -1254,6 +1254,42 @@ def test_sae_proto_hostapd_status_127(dev, apdev):
check_commit_status(hapd, 127, 1) check_commit_status(hapd, 127, 1)
check_commit_status(hapd, 0, 0) check_commit_status(hapd, 0, 0)
def test_sae_proto_hostapd_valid_commit_after_fail(dev, apdev):
"""SAE protocol testing with hostapd and valid commit after failed one"""
params = hostapd.wpa2_params(ssid="test-sae", passphrase="foofoofoo")
params['wpa_key_mgmt'] = 'SAE'
params['sae_groups'] = "19"
hapd = hostapd.add_ap(apdev[0], params)
hapd.set("ext_mgmt_frame_handling", "1")
bssid = hapd.own_addr().replace(':', '')
addr = "020000000000"
addr2 = "020000000001"
hdr = "b0003a01" + bssid + addr + bssid + "1000"
hdr2 = "b0003a01" + bssid + addr2 + bssid + "1000"
group = "1300"
scalar = "f7df19f4a7fef1d3b895ea1de150b7c5a7a705c8ebb31a52b623e0057908bd93"
element_x = "21931572027f2e953e2a49fab3d992944102cc95aa19515fc068b394fb25ae3c"
element_y = "cb4eeb94d7b0b789abfdb73a67ab9d6d5efa94dd553e0e724a6289821cbce530"
pw_id = "ff022130"
hapd.request("MGMT_RX_PROCESS freq=2412 datarate=0 ssi_signal=-30 frame=" + hdr + "030001000000" + group + scalar + element_x + element_y + pw_id)
ev = hapd.wait_event(['MGMT-TX-STATUS'], timeout=1)
buf = ev.split(' ')[3].split('=')[1]
# Check for status = Unknown Password ID
if buf[48:] != '0300' + '0100' + '7b00':
raise Exception("Unexpected response to SAE commit with unknown password id: " + buf)
hapd.request("MGMT_RX_PROCESS freq=2412 datarate=0 ssi_signal=-30 frame=" + hdr + "030001000000" + group + scalar + element_x + element_y)
ev = hapd.wait_event(['MGMT-TX-STATUS'], timeout=1)
if ev is None:
raise Exception("No response to valid SAE commit")
buf = ev.split(' ')[3].split('=')[1]
# Check for status = Success
payload = buf[48:]
if payload[8:12] != '0000':
raise Exception("Unexpected Status Code for valid SAE commit: " + buf)
@remote_compatible @remote_compatible
def test_sae_no_ffc_by_default(dev, apdev): def test_sae_no_ffc_by_default(dev, apdev):
"""SAE and default groups rejecting FFC""" """SAE and default groups rejecting FFC"""