]>
git.ipfire.org Git - people/ms/strongswan.git/blob - Source/charon/testcases/init_config_test.c
2 * @file init_config_test.c
4 * @brief Tests for the init_config_t class.
9 * Copyright (C) 2005 Jan Hutter, Martin Willi
10 * Hochschule fuer Technik Rapperswil
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23 #include "init_config_test.h"
25 #include <config/init_config.h>
26 #include <utils/allocator.h>
30 * Described in header.
32 void test_init_config(protected_tester_t
*tester
)
34 init_config_t
*init_config
= init_config_create("192.168.0.1","192.168.0.2",500,500);
35 proposal_t
*prop1
, *prop2
, *prop3
, *prop4
, *selected_one
;
39 prop1
= proposal_create(1);
40 prop1
->add_algorithm(prop1
, IKE
, ENCRYPTION_ALGORITHM
, ENCR_AES_CBC
, 20);
41 prop1
->add_algorithm(prop1
, IKE
, INTEGRITY_ALGORITHM
, AUTH_HMAC_SHA1_96
, 20);
42 prop1
->add_algorithm(prop1
, IKE
, PSEUDO_RANDOM_FUNCTION
, PRF_HMAC_SHA1
, 20);
43 prop1
->add_algorithm(prop1
, IKE
, DIFFIE_HELLMAN_GROUP
, MODP_2048_BIT
, 0);
45 prop2
= proposal_create(2);
46 prop2
->add_algorithm(prop2
, IKE
, ENCRYPTION_ALGORITHM
, ENCR_AES_CBC
, 20);
47 prop2
->add_algorithm(prop2
, IKE
, INTEGRITY_ALGORITHM
, AUTH_HMAC_SHA1_96
, 20);
48 prop2
->add_algorithm(prop2
, IKE
, PSEUDO_RANDOM_FUNCTION
, PRF_HMAC_MD5
, 20);
49 prop2
->add_algorithm(prop2
, IKE
, DIFFIE_HELLMAN_GROUP
, MODP_1024_BIT
, 0);
51 prop3
= proposal_create(3);
52 prop3
->add_algorithm(prop3
, IKE
, ENCRYPTION_ALGORITHM
, ENCR_DES
, 20);
53 prop3
->add_algorithm(prop3
, IKE
, INTEGRITY_ALGORITHM
, AUTH_HMAC_SHA1_96
, 20);
54 prop3
->add_algorithm(prop3
, IKE
, PSEUDO_RANDOM_FUNCTION
, PRF_HMAC_MD5
, 20);
55 prop3
->add_algorithm(prop3
, IKE
, DIFFIE_HELLMAN_GROUP
, MODP_768_BIT
, 0);
57 prop4
= proposal_create(4);
58 prop4
->add_algorithm(prop4
, IKE
, ENCRYPTION_ALGORITHM
, ENCR_3DES
, 20);
59 prop4
->add_algorithm(prop4
, IKE
, INTEGRITY_ALGORITHM
, AUTH_HMAC_SHA1_96
, 20);
60 prop4
->add_algorithm(prop4
, IKE
, PSEUDO_RANDOM_FUNCTION
, PRF_HMAC_TIGER
, 20);
61 prop4
->add_algorithm(prop4
, IKE
, DIFFIE_HELLMAN_GROUP
, MODP_768_BIT
, 0);
63 init_config
->add_proposal(init_config
, prop1
);
64 init_config
->add_proposal(init_config
, prop2
);
65 init_config
->add_proposal(init_config
, prop3
);
66 init_config
->add_proposal(init_config
, prop4
);
68 list
= init_config
->get_proposals(init_config
);
70 tester
->assert_true(tester
,(list
->get_count(list
) == 4), "proposal count check ");
73 /* going to check proposals */
78 init_config
->destroy(init_config
);