From b652daca84601cd82ea4014a3e0693187811effc Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 16 Nov 2014 15:42:29 +0200 Subject: [PATCH] tests: Suite B Signed-off-by: Jouni Malinen --- tests/hwsim/example-hostapd.config | 2 ++ tests/hwsim/example-wpa_supplicant.config | 2 ++ tests/hwsim/test_suite_b.py | 38 +++++++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 tests/hwsim/test_suite_b.py diff --git a/tests/hwsim/example-hostapd.config b/tests/hwsim/example-hostapd.config index 40e594cb3..5acb0ce48 100644 --- a/tests/hwsim/example-hostapd.config +++ b/tests/hwsim/example-hostapd.config @@ -72,3 +72,5 @@ CFLAGS += -DALL_DH_GROUPS CONFIG_TESTING_OPTIONS=y CONFIG_MODULE_TESTS=y + +CONFIG_SUITEB=y diff --git a/tests/hwsim/example-wpa_supplicant.config b/tests/hwsim/example-wpa_supplicant.config index a39b74dd2..ed6872451 100644 --- a/tests/hwsim/example-wpa_supplicant.config +++ b/tests/hwsim/example-wpa_supplicant.config @@ -114,3 +114,5 @@ CONFIG_WNM=y CONFIG_TESTING_OPTIONS=y CONFIG_MODULE_TESTS=y + +CONFIG_SUITEB=y diff --git a/tests/hwsim/test_suite_b.py b/tests/hwsim/test_suite_b.py new file mode 100644 index 000000000..dec9eb7b1 --- /dev/null +++ b/tests/hwsim/test_suite_b.py @@ -0,0 +1,38 @@ +# Suite B tests +# Copyright (c) 2014, Jouni Malinen +# +# This software may be distributed under the terms of the BSD license. +# See README for more details. + +import time +import logging +logger = logging.getLogger() + +import hostapd + +def test_suite_b(dev, apdev): + """WPA2-PSK/GCMP connection""" + if "GCMP" not in dev[0].get_capability("pairwise"): + return "skip" + params = hostapd.wpa2_eap_params(ssid="test-suite-b") + params["wpa_key_mgmt"] = "WPA-EAP-SUITE-B" + params['rsn_pairwise'] = "GCMP" + hapd = hostapd.add_ap(apdev[0]['ifname'], params) + # TODO: Force Suite B configuration for TLS + dev[0].connect("test-suite-b", key_mgmt="WPA-EAP-SUITE-B", + eap="TLS", identity="tls user", ca_cert="auth_serv/ca.pem", + client_cert="auth_serv/user.pem", + private_key="auth_serv/user.key", + pairwise="GCMP", group="GCMP", scan_freq="2412") + dev[0].request("DISCONNECT") + ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=20) + if ev is None: + raise Exception("Disconnection event timed out") + dev[0].dump_monitor() + dev[0].request("RECONNECT") + ev = dev[0].wait_event(["CTRL-EVENT-EAP-STARTED", + "CTRL-EVENT-CONNECTED"], timeout=20) + if ev is None: + raise Exception("Roaming with the AP timed out") + if "CTRL-EVENT-EAP-STARTED" in ev: + raise Exception("Unexpected EAP exchange")