tests: Validate EAP-GPSK cipher suite negotiation
authorJouni Malinen <j@w1.fi>
Sun, 5 Jan 2014 12:20:36 +0000 (14:20 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 7 Jan 2014 08:45:11 +0000 (10:45 +0200)
This covers all currently supported algorithms and the case of no match.

Signed-hostap: Jouni Malinen <j@w1.fi>

tests/hwsim/test_ap_eap.py

index f7e4a11..7a7f1ed 100644 (file)
@@ -334,10 +334,26 @@ def test_ap_wpa2_eap_gpsk(dev, apdev):
     """WPA2-Enterprise connection using EAP-GPSK"""
     params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
     hostapd.add_ap(apdev[0]['ifname'], params)
-    eap_connect(dev[0], "GPSK", "gpsk user",
-                password="abcdefghijklmnop0123456789abcdef")
+    id = eap_connect(dev[0], "GPSK", "gpsk user",
+                     password="abcdefghijklmnop0123456789abcdef")
     eap_reauth(dev[0], "GPSK")
 
+    logger.info("Test forced algorithm selection")
+    for phase1 in [ "cipher=1", "cipher=2" ]:
+        dev[0].set_network_quoted(id, "phase1", phase1)
+        ev = dev[0].wait_event(["CTRL-EVENT-EAP-SUCCESS"], timeout=10)
+        if ev is None:
+            raise Exception("EAP success timed out")
+        ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED"], timeout=10)
+        if ev is None:
+            raise Exception("Association with the AP timed out")
+
+    logger.info("Test failed algorithm negotiation")
+    dev[0].set_network_quoted(id, "phase1", "cipher=9")
+    ev = dev[0].wait_event(["CTRL-EVENT-EAP-FAILURE"], timeout=10)
+    if ev is None:
+        raise Exception("EAP failure timed out")
+
 def test_ap_wpa2_eap_sake(dev, apdev):
     """WPA2-Enterprise connection using EAP-SAKE"""
     params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")