]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Encrypted Key Data field in EAPOL-Key msg 2/4 and 4/4
authorJouni Malinen <quic_jouni@quicinc.com>
Tue, 16 Jan 2024 19:12:43 +0000 (21:12 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 16 Jan 2024 20:05:02 +0000 (22:05 +0200)
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
tests/hwsim/test_ap_psk.py

index 7675c3b2757b8730ff7a011cc1686f53bfc73895..3e6de6172f5221c48452f04e6514577d046e9482 100644 (file)
@@ -3788,3 +3788,35 @@ def test_rsn_eapol_m4_extra(dev, apdev):
         raise Exception("Failed to add test elements")
     dev[0].connect(ssid, psk=passphrase, scan_freq="2412")
     hapd.wait_sta()
+
+def test_rsn_eapol_m2_encrypt(dev, apdev):
+    """Encrypted Key Data field in EAPOL-Key msg 2/4"""
+    ssid = "test-rsn"
+    passphrase = 'qwertyuiop'
+    params = hostapd.wpa2_params(ssid=ssid, passphrase=passphrase)
+    hapd = hostapd.add_ap(apdev[0], params)
+
+    # Add a reserved element and KDE into EAPOL-Key msg 2/4 and request the
+    # Key Data field to be encrypted.
+    elems = '02051122334455' + 'dd05000facff11'
+    if "OK" not in dev[0].request("TEST_EAPOL_M2_ELEMS " + elems):
+        raise Exception("Failed to add test elements")
+    dev[0].set("encrypt_eapol_m2", "1")
+    dev[0].connect(ssid, psk=passphrase, scan_freq="2412")
+    hapd.wait_sta()
+
+def test_rsn_eapol_m4_encrypt(dev, apdev):
+    """Encrypted Key Data field in EAPOL-Key msg 4/4"""
+    ssid = "test-rsn"
+    passphrase = 'qwertyuiop'
+    params = hostapd.wpa2_params(ssid=ssid, passphrase=passphrase)
+    hapd = hostapd.add_ap(apdev[0], params)
+
+    # Add a reserved element and KDE into EAPOL-Key msg 4/4 and request the
+    # Key Data field to be encrypted.
+    elems = '02051122334455' + 'dd05000facff11'
+    if "OK" not in dev[0].request("TEST_EAPOL_M4_ELEMS " + elems):
+        raise Exception("Failed to add test elements")
+    dev[0].set("encrypt_eapol_m4", "1")
+    dev[0].connect(ssid, psk=passphrase, scan_freq="2412")
+    hapd.wait_sta()