]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Supplicant protocol testing for EAPOL-Key msg 1/4 and 3/4
authorJouni Malinen <quic_jouni@quicinc.com>
Tue, 16 Jan 2024 11:06:49 +0000 (13:06 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 16 Jan 2024 11:06:49 +0000 (13:06 +0200)
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
tests/hwsim/test_ap_psk.py

index d175259b53ab4e2e7b5d073b39b2a47c345cf485..d5c2167e90b318f2034eab3fdc1eaa6b02bef0dd 100644 (file)
@@ -3722,3 +3722,41 @@ def test_ap_wpa2_psk_4addr(dev, apdev):
             found = True
     if not found:
         raise Exception("Station interface was not seen in the bridge")
+
+def test_rsn_eapol_m1_extra(dev, apdev):
+    """Extra element and KDE in EAPOL-Key msg 1/4"""
+    ssid = "test-rsn"
+    passphrase = 'qwertyuiop'
+    params = hostapd.wpa2_params(ssid=ssid, passphrase=passphrase)
+    # Add a reserved element and KDE into EAPOL-Key msg 1/4
+    params['eapol_m1_elements'] = '02051122334455' + 'dd05000facff11'
+    hapd = hostapd.add_ap(apdev[0], params)
+
+    dev[0].connect(ssid, psk=passphrase, scan_freq="2412")
+
+def test_rsn_eapol_m3_extra(dev, apdev):
+    """Extra element and KDE in EAPOL-Key msg 3/4"""
+    ssid = "test-rsn"
+    passphrase = 'qwertyuiop'
+    params = hostapd.wpa2_params(ssid=ssid, passphrase=passphrase)
+    # Add a reserved element and KDE into EAPOL-Key msg 3/4
+    params['eapol_m3_elements'] = '02051122334455' + 'dd05000facff11'
+    hapd = hostapd.add_ap(apdev[0], params)
+
+    dev[0].connect(ssid, psk=passphrase, scan_freq="2412")
+
+def test_rsn_eapol_m3_no_encrypt(dev, apdev):
+    """EAPOL-Key msg 3/4 Key Data field not encrypted"""
+    ssid = "test-rsn"
+    passphrase = 'qwertyuiop'
+    params = hostapd.wpa2_params(ssid=ssid, passphrase=passphrase)
+    # Add a reserved element and KDE into EAPOL-Key msg 3/4
+    params['eapol_m3_no_encrypt'] = '1'
+    hapd = hostapd.add_ap(apdev[0], params)
+
+    dev[0].connect(ssid, psk=passphrase, scan_freq="2412", wait_connect=False)
+    ev = dev[0].wait_event(["WPA: GTK IE in unencrypted key data"], timeout=10)
+    if ev is None:
+        raise Exception("Unencrypted GTK KDE not rejected")
+    dev[0].request("DISCONNECT")
+    dev[0].wait_disconnected()