]>
git.ipfire.org Git - people/ms/strongswan.git/blob - src/libstrongswan/tests/suites/test_vectors.c
2 * Copyright (C) 2014 Tobias Brunner
3 * Hochschule fuer Technik Rapperswil
5 * Copyright (C) 2013 Martin Willi
6 * Copyright (C) 2013 revosec AG
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 #include "test_suite.h"
21 #include <utils/test.h>
22 #include <threading/thread.h>
23 #include <crypto/transform.h>
25 static transform_type_t tfs
[] = {
30 PSEUDO_RANDOM_FUNCTION
,
31 RANDOM_NUMBER_GENERATOR
,
35 START_TEST(test_vectors
)
37 enumerator_t
*enumerator
;
42 enumerator
= lib
->crypto
->create_verify_enumerator(lib
->crypto
, tfs
[_i
]);
43 thread_cleanup_push((void*)enumerator
->destroy
, enumerator
);
44 while (enumerator
->enumerate(enumerator
, &alg
, &plugin
, &success
))
46 ck_assert_msg(success
, "test vector for %N from '%s' plugin failed",
47 transform_get_enum_names(tfs
[_i
]), alg
, plugin
);
49 thread_cleanup_pop(TRUE
);
54 Suite
*vectors_suite_create()
59 s
= suite_create("vectors");
61 tc
= tcase_create("transforms");
62 tcase_add_loop_test(tc
, test_vectors
, 0, countof(tfs
));
63 tcase_set_timeout(tc
, 20);
64 suite_add_tcase(s
, tc
);