aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2016-01-14 17:46:14 (GMT)
committerJouni Malinen <j@w1.fi>2016-01-14 18:10:16 (GMT)
commit7cbc8e671928fe80758fd4a7a45ed00722a115c6 (patch)
tree5f9cdcfa126b4af3b2e33a0301f37743ca622962 /tests
parent465196ebd281eb8466a0a93efc48c508aba296a4 (diff)
downloadhostap-7cbc8e671928fe80758fd4a7a45ed00722a115c6.zip
hostap-7cbc8e671928fe80758fd4a7a45ed00722a115c6.tar.gz
hostap-7cbc8e671928fe80758fd4a7a45ed00722a115c6.tar.bz2
tests: fail_test instead of alloc_fail for aes_{encrypt,decrypt}_init
This is needed to fix ap_wpa2_eap_psk_oom, ap_wpa2_eap_sim_oom, eap_proto_psk_errors, and ap_ft_oom with the new OpenSSL dynamic memory allocation design. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/hwsim/test_ap_eap.py34
-rw-r--r--tests/hwsim/test_ap_ft.py2
-rw-r--r--tests/hwsim/test_eap_proto.py63
3 files changed, 56 insertions, 43 deletions
diff --git a/tests/hwsim/test_ap_eap.py b/tests/hwsim/test_ap_eap.py
index f5d7bf1..1c11a82 100644
--- a/tests/hwsim/test_ap_eap.py
+++ b/tests/hwsim/test_ap_eap.py
@@ -731,7 +731,7 @@ def test_ap_wpa2_eap_sim_oom(dev, apdev):
(11, "milenage_f2345"),
(12, "milenage_f2345") ]
for count, func in tests:
- with alloc_fail(dev[0], count, func):
+ with fail_test(dev[0], count, func):
dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP", eap="SIM",
identity="1232010000000000",
password="90dca4eda45b53cf0f12d7c9c3bc6a89:cb9cccc4b9258e6dca4760379fb82581",
@@ -2708,19 +2708,33 @@ def test_ap_wpa2_eap_psk_oom(dev, apdev):
skip_with_fips(dev[0])
params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
hostapd.add_ap(apdev[0]['ifname'], params)
+ tests = [ (1, "=aes_128_eax_encrypt"),
+ (1, "=aes_128_eax_decrypt") ]
+ for count, func in tests:
+ with alloc_fail(dev[0], count, func):
+ dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP", eap="PSK",
+ identity="psk.user@example.com",
+ password_hex="0123456789abcdef0123456789abcdef",
+ wait_connect=False, scan_freq="2412")
+ ev = dev[0].wait_event(["CTRL-EVENT-EAP-METHOD"], timeout=5)
+ if ev is None:
+ raise Exception("EAP method not selected")
+ wait_fail_trigger(dev[0], "GET_ALLOC_FAIL",
+ note="Failure not triggered: %d:%s" % (count, func))
+ dev[0].request("REMOVE_NETWORK all")
+ dev[0].wait_disconnected()
+
tests = [ (1, "aes_128_ctr_encrypt;aes_128_eax_encrypt"),
(1, "omac1_aes_128;aes_128_eax_encrypt"),
(2, "omac1_aes_128;aes_128_eax_encrypt"),
(3, "omac1_aes_128;aes_128_eax_encrypt"),
- (1, "=aes_128_eax_encrypt"),
(1, "omac1_aes_vector"),
- (1, "aes_128_ctr_encrypt;aes_128_eax_decrypt"),
(1, "omac1_aes_128;aes_128_eax_decrypt"),
(2, "omac1_aes_128;aes_128_eax_decrypt"),
(3, "omac1_aes_128;aes_128_eax_decrypt"),
- (1, "=aes_128_eax_decrypt") ]
+ (1, "aes_128_ctr_encrypt;aes_128_eax_decrypt") ]
for count, func in tests:
- with alloc_fail(dev[0], count, func):
+ with fail_test(dev[0], count, func):
dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP", eap="PSK",
identity="psk.user@example.com",
password_hex="0123456789abcdef0123456789abcdef",
@@ -2728,13 +2742,12 @@ def test_ap_wpa2_eap_psk_oom(dev, apdev):
ev = dev[0].wait_event(["CTRL-EVENT-EAP-METHOD"], timeout=5)
if ev is None:
raise Exception("EAP method not selected")
- for i in range(10):
- if "0:" in dev[0].request("GET_ALLOC_FAIL"):
- break
- time.sleep(0.02)
+ wait_fail_trigger(dev[0], "GET_FAIL",
+ note="Failure not triggered: %d:%s" % (count, func))
dev[0].request("REMOVE_NETWORK all")
+ dev[0].wait_disconnected()
- with alloc_fail(dev[0], 1, "aes_128_encrypt_block"):
+ with fail_test(dev[0], 1, "aes_128_encrypt_block"):
dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP", eap="PSK",
identity="psk.user@example.com",
password_hex="0123456789abcdef0123456789abcdef",
@@ -2743,6 +2756,7 @@ def test_ap_wpa2_eap_psk_oom(dev, apdev):
if ev is None:
raise Exception("EAP method failure not reported")
dev[0].request("REMOVE_NETWORK all")
+ dev[0].wait_disconnected()
def test_ap_wpa_eap_peap_eap_mschapv2(dev, apdev):
"""WPA-Enterprise connection using EAP-PEAP/EAP-MSCHAPv2"""
diff --git a/tests/hwsim/test_ap_ft.py b/tests/hwsim/test_ap_ft.py
index 7faa5fe..28b35ab 100644
--- a/tests/hwsim/test_ap_ft.py
+++ b/tests/hwsim/test_ap_ft.py
@@ -789,7 +789,7 @@ def test_ap_ft_oom(dev, apdev):
dev[0].scan_for_bss(dst, freq="2412")
with alloc_fail(dev[0], 1, "wpa_ft_gen_req_ies"):
dev[0].roam(dst)
- with alloc_fail(dev[0], 1, "wpa_ft_mic"):
+ with fail_test(dev[0], 1, "wpa_ft_mic"):
dev[0].roam(dst, fail_test=True)
with fail_test(dev[0], 1, "os_get_random;wpa_ft_prepare_auth_request"):
dev[0].roam(dst, fail_test=True)
diff --git a/tests/hwsim/test_eap_proto.py b/tests/hwsim/test_eap_proto.py
index 668a463..8b795e6 100644
--- a/tests/hwsim/test_eap_proto.py
+++ b/tests/hwsim/test_eap_proto.py
@@ -2787,7 +2787,7 @@ def test_eap_proto_psk_errors(dev, apdev):
params = hostapd.wpa2_eap_params(ssid="eap-test")
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
- for i in range(1, 6):
+ for i in range(1, 3):
with alloc_fail(dev[0], i, "eap_psk_init"):
dev[0].connect("eap-test", key_mgmt="WPA-EAP", scan_freq="2412",
eap="PSK", identity="psk.user@example.com",
@@ -2800,24 +2800,25 @@ def test_eap_proto_psk_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
+ for i in range(1, 4):
+ with fail_test(dev[0], i, "eap_psk_key_setup;eap_psk_init"):
+ dev[0].connect("eap-test", key_mgmt="WPA-EAP", scan_freq="2412",
+ eap="PSK", identity="psk.user@example.com",
+ password_hex="0123456789abcdef0123456789abcdef",
+ wait_connect=False)
+ ev = dev[0].wait_event(["EAP: Failed to initialize EAP method"],
+ timeout=15)
+ if ev is None:
+ raise Exception("Timeout on EAP start")
+ dev[0].request("REMOVE_NETWORK all")
+ dev[0].wait_disconnected()
+
tests = [ (1, "=eap_psk_process_1"),
(2, "=eap_psk_process_1"),
(1, "eap_msg_alloc;eap_psk_process_1"),
(1, "=eap_psk_process_3"),
(2, "=eap_psk_process_3"),
(1, "eap_msg_alloc;eap_psk_process_3"),
- (1, "aes_128_encrypt_block;eap_psk_derive_keys;eap_psk_process_3"),
- (2, "aes_128_encrypt_block;eap_psk_derive_keys;eap_psk_process_3"),
- (3, "aes_128_encrypt_block;eap_psk_derive_keys;eap_psk_process_3"),
- (4, "aes_128_encrypt_block;eap_psk_derive_keys;eap_psk_process_3"),
- (5, "aes_128_encrypt_block;eap_psk_derive_keys;eap_psk_process_3"),
- (6, "aes_128_encrypt_block;eap_psk_derive_keys;eap_psk_process_3"),
- (7, "aes_128_encrypt_block;eap_psk_derive_keys;eap_psk_process_3"),
- (8, "aes_128_encrypt_block;eap_psk_derive_keys;eap_psk_process_3"),
- (9, "aes_128_encrypt_block;eap_psk_derive_keys;eap_psk_process_3"),
- (10, "aes_128_encrypt_block;eap_psk_derive_keys;eap_psk_process_3"),
- (1, "aes_128_ctr_encrypt;aes_128_eax_decrypt;eap_psk_process_3"),
- (1, "aes_128_ctr_encrypt;aes_128_eax_encrypt;eap_psk_process_3"),
(1, "eap_psk_getKey"),
(1, "eap_psk_get_session_id"),
(1, "eap_psk_get_emsk") ]
@@ -2831,15 +2832,8 @@ def test_eap_proto_psk_errors(dev, apdev):
timeout=15)
if ev is None:
raise Exception("Timeout on EAP start")
- ok = False
- for j in range(10):
- state = dev[0].request('GET_ALLOC_FAIL')
- if state.startswith('0:'):
- ok = True
- break
- time.sleep(0.1)
- if not ok:
- raise Exception("No allocation failure seen for %d:%s" % (count, func))
+ wait_fail_trigger(dev[0], "GET_ALLOC_FAIL",
+ note="No allocation failure seen for %d:%s" % (count, func))
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
@@ -2850,7 +2844,19 @@ def test_eap_proto_psk_errors(dev, apdev):
(3, "aes_128_eax_decrypt;eap_psk_process_3"),
(1, "aes_128_eax_encrypt;eap_psk_process_3"),
(2, "aes_128_eax_encrypt;eap_psk_process_3"),
- (3, "aes_128_eax_encrypt;eap_psk_process_3") ]
+ (3, "aes_128_eax_encrypt;eap_psk_process_3"),
+ (1, "aes_128_encrypt_block;eap_psk_derive_keys;eap_psk_process_3"),
+ (2, "aes_128_encrypt_block;eap_psk_derive_keys;eap_psk_process_3"),
+ (3, "aes_128_encrypt_block;eap_psk_derive_keys;eap_psk_process_3"),
+ (4, "aes_128_encrypt_block;eap_psk_derive_keys;eap_psk_process_3"),
+ (5, "aes_128_encrypt_block;eap_psk_derive_keys;eap_psk_process_3"),
+ (6, "aes_128_encrypt_block;eap_psk_derive_keys;eap_psk_process_3"),
+ (7, "aes_128_encrypt_block;eap_psk_derive_keys;eap_psk_process_3"),
+ (8, "aes_128_encrypt_block;eap_psk_derive_keys;eap_psk_process_3"),
+ (9, "aes_128_encrypt_block;eap_psk_derive_keys;eap_psk_process_3"),
+ (10, "aes_128_encrypt_block;eap_psk_derive_keys;eap_psk_process_3"),
+ (1, "aes_128_ctr_encrypt;aes_128_eax_decrypt;eap_psk_process_3"),
+ (1, "aes_128_ctr_encrypt;aes_128_eax_encrypt;eap_psk_process_3") ]
for count, func in tests:
with fail_test(dev[0], count, func):
dev[0].connect("eap-test", key_mgmt="WPA-EAP", scan_freq="2412",
@@ -2861,15 +2867,8 @@ def test_eap_proto_psk_errors(dev, apdev):
timeout=15)
if ev is None:
raise Exception("Timeout on EAP start")
- ok = False
- for j in range(10):
- state = dev[0].request('GET_FAIL')
- if state.startswith('0:'):
- ok = True
- break
- time.sleep(0.1)
- if not ok:
- raise Exception("No failure seen for %d:%s" % (count, func))
+ wait_fail_trigger(dev[0], "GET_FAIL",
+ note="No failure seen for %d:%s" % (count, func))
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()