diff mbox series

[26/26] auto-t: Add tests for GMAC/GMAC-256/CMAC-256

Message ID 20221021191307.31492-26-denkenz@gmail.com (mailing list archive)
State New
Headers show
Series [01/26] eapol: More strictly validate key_descriptor_version | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-ci-gitlint success GitLint

Commit Message

Denis Kenzior Oct. 21, 2022, 7:13 p.m. UTC
---
 autotests/testWPA2withMFP/connection_test.py  | 42 ++++++++++++++++---
 autotests/testWPA2withMFP/hw.conf             |  4 +-
 .../{ssidCCMP.conf => ssidWPA2.conf}          |  2 +-
 3 files changed, 40 insertions(+), 8 deletions(-)
 rename autotests/testWPA2withMFP/{ssidCCMP.conf => ssidWPA2.conf} (88%)
diff mbox series

Patch

diff --git a/autotests/testWPA2withMFP/connection_test.py b/autotests/testWPA2withMFP/connection_test.py
index 982b69e265d7..bdc9e96ac536 100644
--- a/autotests/testWPA2withMFP/connection_test.py
+++ b/autotests/testWPA2withMFP/connection_test.py
@@ -8,19 +8,18 @@  import iwd
 from iwd import IWD
 from iwd import PSKAgent
 from iwd import NetworkType
+from hostapd import HostapdCLI
 
 class Test(unittest.TestCase):
 
-    def test_connection_success(self):
-        wd = IWD()
-
+    def validate_connection_success(self, wd):
         psk_agent = PSKAgent("secret123")
         wd.register_psk_agent(psk_agent)
 
         devices = wd.list_devices(1)
         device = devices[0]
 
-        ordered_network = device.get_ordered_network('ssidCCMP')
+        ordered_network = device.get_ordered_network('ssidWPA2')
 
         self.assertEqual(ordered_network.type, NetworkType.psk)
 
@@ -39,13 +38,44 @@  class Test(unittest.TestCase):
 
         wd.unregister_psk_agent(psk_agent)
 
+    def test_cmac(self):
+        self.hostapd.set_value('group_mgmt_cipher', 'AES-128-CMAC')
+        self.hostapd.reload()
+        self.hostapd.wait_for_event("AP-ENABLED")
+        self.validate_connection_success(self.wd)
+
+    def test_gmac(self):
+        self.hostapd.set_value('group_mgmt_cipher', 'BIP-128-GMAC')
+        self.hostapd.reload()
+        self.hostapd.wait_for_event("AP-ENABLED")
+        self.validate_connection_success(self.wd)
+
+    def test_gmac_256(self):
+        self.hostapd.set_value('group_mgmt_cipher', 'BIP-256-GMAC')
+        self.hostapd.reload()
+        self.hostapd.wait_for_event("AP-ENABLED")
+        self.validate_connection_success(self.wd)
+
+    def test_cmac_256(self):
+        self.hostapd.set_value('group_mgmt_cipher', 'BIP-256-CMAC')
+        self.hostapd.reload()
+        self.hostapd.wait_for_event("AP-ENABLED")
+        self.validate_connection_success(self.wd)
+
+    def setUp(self):
+        self.wd = IWD(True)
+
+    def tearDown(self):
+        self.wd.clear_storage()
+        self.wd = None
+
     @classmethod
     def setUpClass(cls):
-        pass
+        cls.hostapd = HostapdCLI(config='ssidWPA2.conf')
 
     @classmethod
     def tearDownClass(cls):
-        IWD.clear_storage()
+        pass
 
 if __name__ == '__main__':
     unittest.main(exit=True)
diff --git a/autotests/testWPA2withMFP/hw.conf b/autotests/testWPA2withMFP/hw.conf
index fad15b8823a3..edfe03f97e25 100644
--- a/autotests/testWPA2withMFP/hw.conf
+++ b/autotests/testWPA2withMFP/hw.conf
@@ -1,5 +1,7 @@ 
 [SETUP]
 num_radios=2
+start_iwd=0
 
 [HOSTAPD]
-rad0=ssidCCMP.conf
+rad0=ssidWPA2.conf
+
diff --git a/autotests/testWPA2withMFP/ssidCCMP.conf b/autotests/testWPA2withMFP/ssidWPA2.conf
similarity index 88%
rename from autotests/testWPA2withMFP/ssidCCMP.conf
rename to autotests/testWPA2withMFP/ssidWPA2.conf
index c79f5e558021..908915d7cb02 100644
--- a/autotests/testWPA2withMFP/ssidCCMP.conf
+++ b/autotests/testWPA2withMFP/ssidWPA2.conf
@@ -1,6 +1,6 @@ 
 hw_mode=g
 channel=1
-ssid=ssidCCMP
+ssid=ssidWPA2
 
 wpa=2
 wpa_pairwise=CCMP