From f91380c1952ed949c7ef6fda7ac1928b606aa1ef Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Tue, 23 Jan 2018 15:50:35 -0600 Subject: [PATCH] unit: Skip EAPoL tests when kernel features are missing --- unit/test-eapol.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/unit/test-eapol.c b/unit/test-eapol.c index 10e3824a..85526eec 100644 --- a/unit/test-eapol.c +++ b/unit/test-eapol.c @@ -30,6 +30,7 @@ #include #include #include +#include #include "src/eapol.h" #include "src/crypto.h" @@ -3423,6 +3424,10 @@ int main(int argc, char *argv[]) l_test_add("/EAPoL Key/Calculate MIC Test 1", eapol_calculate_mic_test, &eapol_calculate_mic_test_1); + if (!l_cipher_is_supported(L_CIPHER_AES) || + !l_cipher_is_supported(L_CIPHER_ARC4)) + goto done; + l_test_add("EAPoL/WPA2 4-Way Handshake", &eapol_4way_test, NULL); @@ -3449,14 +3454,18 @@ int main(int argc, char *argv[]) l_test_add("EAPoL/WPA2 Retransmit Test", &eapol_sm_wpa2_retransmit_test, NULL); - l_test_add("EAPoL/8021x EAP-TLS & 4-Way Handshake", - &eapol_sm_test_eap_tls, NULL); + if (l_cipher_is_supported(L_CIPHER_DES3_EDE_CBC) && + l_cipher_is_supported(L_CIPHER_AES_CBC) && + l_key_is_supported(L_KEY_FEATURE_RESTRICT | + L_KEY_FEATURE_CRYPTO)) { + l_test_add("EAPoL/8021x EAP-TLS & 4-Way Handshake", + &eapol_sm_test_eap_tls, NULL); - l_test_add("EAPoL/8021x EAP-TTLS+EAP-MD5 & 4-Way Handshake", - &eapol_sm_test_eap_ttls_md5, NULL); - - l_test_add("EAPoL/8021x EAP NAK", - &eapol_sm_test_eap_nak, NULL); + l_test_add("EAPoL/8021x EAP-TTLS+EAP-MD5 & 4-Way Handshake", + &eapol_sm_test_eap_ttls_md5, NULL); + l_test_add("EAPoL/8021x EAP NAK", + &eapol_sm_test_eap_nak, NULL); + } l_test_add("EAPoL/FT-Using-PSK 4-Way Handshake", &eapol_ft_handshake_test, NULL);