Annotation of embedaddon/strongswan/src/libstrongswan/tests/suites/test_vectors.c, revision 1.1
1.1 ! misho 1: /*
! 2: * Copyright (C) 2014 Tobias Brunner
! 3: * HSR Hochschule fuer Technik Rapperswil
! 4: *
! 5: * Copyright (C) 2013 Martin Willi
! 6: * Copyright (C) 2013 revosec AG
! 7: *
! 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>.
! 12: *
! 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
! 16: * for more details.
! 17: */
! 18:
! 19: #include "test_suite.h"
! 20:
! 21: #include <utils/test.h>
! 22: #include <threading/thread.h>
! 23: #include <crypto/transform.h>
! 24:
! 25: static transform_type_t tfs[] = {
! 26: ENCRYPTION_ALGORITHM,
! 27: AEAD_ALGORITHM,
! 28: INTEGRITY_ALGORITHM,
! 29: HASH_ALGORITHM,
! 30: PSEUDO_RANDOM_FUNCTION,
! 31: EXTENDED_OUTPUT_FUNCTION,
! 32: DETERMINISTIC_RANDOM_BIT_GENERATOR,
! 33: RANDOM_NUMBER_GENERATOR,
! 34: DIFFIE_HELLMAN_GROUP,
! 35: };
! 36:
! 37: START_TEST(test_vectors)
! 38: {
! 39: enumerator_t *enumerator;
! 40: char *plugin;
! 41: bool success;
! 42: u_int alg;
! 43:
! 44: enumerator = lib->crypto->create_verify_enumerator(lib->crypto, tfs[_i]);
! 45: thread_cleanup_push((void*)enumerator->destroy, enumerator);
! 46: while (enumerator->enumerate(enumerator, &alg, &plugin, &success))
! 47: {
! 48: ck_assert_msg(success, "test vector for %N from '%s' plugin failed",
! 49: transform_get_enum_names(tfs[_i]), alg, plugin);
! 50: }
! 51: thread_cleanup_pop(TRUE);
! 52: }
! 53: END_TEST
! 54:
! 55:
! 56: Suite *vectors_suite_create()
! 57: {
! 58: Suite *s;
! 59: TCase *tc;
! 60:
! 61: s = suite_create("vectors");
! 62:
! 63: tc = tcase_create("transforms");
! 64: tcase_add_loop_test(tc, test_vectors, 0, countof(tfs));
! 65: tcase_set_timeout(tc, 30);
! 66: suite_add_tcase(s, tc);
! 67:
! 68: return s;
! 69: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>