]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: SAE and sae_password_file in hostapd configuration
authorJouni Malinen <quic_jouni@quicinc.com>
Thu, 21 Dec 2023 18:07:35 +0000 (20:07 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 21 Dec 2023 18:09:41 +0000 (20:09 +0200)
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
tests/hwsim/test_sae.py

index 7deb60257b3e4f152eb61b45413b09c8c39ed975..b3837d6ac3de1f8fbe648359e913136fe32c2eaa 100644 (file)
@@ -13,6 +13,7 @@ logger = logging.getLogger()
 import socket
 import struct
 import subprocess
+import tempfile
 
 import hwsim_utils
 import hostapd
@@ -3053,3 +3054,34 @@ def test_sae_pref_ap_wrong_password2(dev, apdev):
     hapd = hostapd.add_ap(apdev[0], params)
 
     dev[0].wait_connected(timeout=40)
+
+def test_sae_password_file(dev, apdev):
+    """SAE and sae_password_file in hostapd configuration"""
+    check_sae_capab(dev[0])
+    check_sae_capab(dev[1])
+    check_sae_capab(dev[2])
+    fd, fn = tempfile.mkstemp()
+    try:
+        f = os.fdopen(fd, 'w')
+        f.write("pw1|id=id1\n")
+        f.write("pw2|id=id2\n")
+        f.write("pw3|id=id3\n")
+        f.close()
+
+        params = hostapd.wpa2_params(ssid="test-sae", wpa_key_mgmt="SAE")
+        params['sae_password_file'] = fn
+        hapd = hostapd.add_ap(apdev[0], params)
+
+        dev[0].set("sae_groups", "")
+        dev[0].connect("test-sae", sae_password="pw1", sae_password_id="id1",
+                       key_mgmt="SAE", scan_freq="2412")
+
+        dev[1].set("sae_groups", "")
+        dev[1].connect("test-sae", sae_password="pw2", sae_password_id="id2",
+                       key_mgmt="SAE", scan_freq="2412")
+
+        dev[2].set("sae_groups", "")
+        dev[2].connect("test-sae", sae_password="pw3", sae_password_id="id3",
+                       key_mgmt="SAE", scan_freq="2412")
+    finally:
+        os.unlink(fn)