aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2015-03-23 09:53:34 +0100
committerMartin Willi <martin@revosec.ch>2015-03-23 09:53:34 +0100
commite284a861b85c20fa84e59cc76a9095c8ff18959a (patch)
treefa137a62195cfeb7b6532018b23d028425039e0d /src
parenta83d1245d85cdff3fb8ee7843151722821304e11 (diff)
downloadstrongswan-e284a861b85c20fa84e59cc76a9095c8ff18959a.tar.bz2
strongswan-e284a861b85c20fa84e59cc76a9095c8ff18959a.tar.xz
unit-tests: Depend on SHA1/SHA256 features for mgf1 test cases
Diffstat (limited to 'src')
-rw-r--r--src/libstrongswan/tests/suites/test_mgf1.c18
-rw-r--r--src/libstrongswan/tests/tests.h3
2 files changed, 16 insertions, 5 deletions
diff --git a/src/libstrongswan/tests/suites/test_mgf1.c b/src/libstrongswan/tests/suites/test_mgf1.c
index 0fb548af7..9388b95d4 100644
--- a/src/libstrongswan/tests/suites/test_mgf1.c
+++ b/src/libstrongswan/tests/suites/test_mgf1.c
@@ -239,20 +239,30 @@ START_TEST(mgf1_test_bitspender)
END_TEST
-Suite *mgf1_suite_create()
+Suite *mgf1_suite_create(char *name, int n)
{
Suite *s;
TCase *tc;
- s = suite_create("mgf1");
+ s = suite_create(name);
tc = tcase_create("mgf1");
- tcase_add_loop_test(tc, mgf1_test_mgf1, 0, countof(mgf1_tests));
+ tcase_add_loop_test(tc, mgf1_test_mgf1, n, n + 1);
suite_add_tcase(s, tc);
tc = tcase_create("bitspender");
- tcase_add_loop_test(tc, mgf1_test_bitspender, 0, countof(mgf1_tests));
+ tcase_add_loop_test(tc, mgf1_test_bitspender, n, n + 1);
suite_add_tcase(s, tc);
return s;
}
+
+Suite *mgf1_sha1_suite_create()
+{
+ return mgf1_suite_create("mgf1-sha1", 0);
+}
+
+Suite *mgf1_sha256_suite_create()
+{
+ return mgf1_suite_create("mgf1-sha256", 1);
+}
diff --git a/src/libstrongswan/tests/tests.h b/src/libstrongswan/tests/tests.h
index d01158649..e1d8ca4ba 100644
--- a/src/libstrongswan/tests/tests.h
+++ b/src/libstrongswan/tests/tests.h
@@ -44,6 +44,7 @@ TEST_SUITE(pen_suite_create)
TEST_SUITE(asn1_suite_create)
TEST_SUITE(asn1_parser_suite_create)
TEST_SUITE(test_rng_suite_create)
-TEST_SUITE(mgf1_suite_create)
+TEST_SUITE_DEPEND(mgf1_sha1_suite_create, HASHER, HASH_SHA1)
+TEST_SUITE_DEPEND(mgf1_sha256_suite_create, HASHER, HASH_SHA256)
TEST_SUITE_DEPEND(ntru_suite_create, DH, NTRU_112_BIT)
TEST_SUITE_DEPEND(fetch_http_suite_create, FETCHER, "http://")