From 6c87b4b84e5cc4fd9415332fc055df929b6bcdf4 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 1 Jun 2014 11:47:37 +0300 Subject: [PATCH] tests: PTK rekey enforced by AP These are similar to the existing test cases where PTK rekey was triggered by the station, but here a timer on the AP is used as the trigger. Signed-off-by: Jouni Malinen --- tests/hwsim/test_ap_psk.py | 43 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/tests/hwsim/test_ap_psk.py b/tests/hwsim/test_ap_psk.py index 6ab85320e..7ffd5583c 100644 --- a/tests/hwsim/test_ap_psk.py +++ b/tests/hwsim/test_ap_psk.py @@ -70,6 +70,19 @@ def test_ap_wpa2_ptk_rekey(dev, apdev): raise Exception("PTK rekey timed out") hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname']) +def test_ap_wpa2_ptk_rekey_ap(dev, apdev): + """WPA2-PSK AP and PTK rekey enforced by AP""" + ssid = "test-wpa2-psk" + passphrase = 'qwertyuiop' + params = hostapd.wpa2_params(ssid=ssid, passphrase=passphrase) + params['wpa_ptk_rekey'] = '2' + hostapd.add_ap(apdev[0]['ifname'], params) + dev[0].connect(ssid, psk=passphrase, scan_freq="2412") + ev = dev[0].wait_event(["WPA: Key negotiation completed"]) + if ev is None: + raise Exception("PTK rekey timed out") + hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname']) + def test_ap_wpa2_sha256_ptk_rekey(dev, apdev): """WPA2-PSK/SHA256 AKM AP and PTK rekey enforced by station""" ssid = "test-wpa2-psk" @@ -86,6 +99,23 @@ def test_ap_wpa2_sha256_ptk_rekey(dev, apdev): check_mib(dev[0], [ ("dot11RSNAAuthenticationSuiteRequested", "00-0f-ac-6"), ("dot11RSNAAuthenticationSuiteSelected", "00-0f-ac-6") ]) +def test_ap_wpa2_sha256_ptk_rekey_ap(dev, apdev): + """WPA2-PSK/SHA256 AKM AP and PTK rekey enforced by AP""" + ssid = "test-wpa2-psk" + passphrase = 'qwertyuiop' + params = hostapd.wpa2_params(ssid=ssid, passphrase=passphrase) + params["wpa_key_mgmt"] = "WPA-PSK-SHA256" + params['wpa_ptk_rekey'] = '2' + hostapd.add_ap(apdev[0]['ifname'], params) + dev[0].connect(ssid, psk=passphrase, key_mgmt="WPA-PSK-SHA256", + scan_freq="2412") + ev = dev[0].wait_event(["WPA: Key negotiation completed"]) + if ev is None: + raise Exception("PTK rekey timed out") + hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname']) + check_mib(dev[0], [ ("dot11RSNAAuthenticationSuiteRequested", "00-0f-ac-6"), + ("dot11RSNAAuthenticationSuiteSelected", "00-0f-ac-6") ]) + def test_ap_wpa_ptk_rekey(dev, apdev): """WPA-PSK/TKIP AP and PTK rekey enforced by station""" ssid = "test-wpa-psk" @@ -100,6 +130,19 @@ def test_ap_wpa_ptk_rekey(dev, apdev): raise Exception("PTK rekey timed out") hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname']) +def test_ap_wpa_ptk_rekey_ap(dev, apdev): + """WPA-PSK/TKIP AP and PTK rekey enforced by AP""" + ssid = "test-wpa-psk" + passphrase = 'qwertyuiop' + params = hostapd.wpa_params(ssid=ssid, passphrase=passphrase) + params['wpa_ptk_rekey'] = '2' + hostapd.add_ap(apdev[0]['ifname'], params) + dev[0].connect(ssid, psk=passphrase, scan_freq="2412") + ev = dev[0].wait_event(["WPA: Key negotiation completed"], timeout=10) + if ev is None: + raise Exception("PTK rekey timed out") + hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname']) + def test_ap_wpa_ccmp(dev, apdev): """WPA-PSK/CCMP""" ssid = "test-wpa-psk"