diff options
Diffstat (limited to 'Source/charon/testcases')
-rw-r--r-- | Source/charon/testcases/Makefile.testcases | 5 | ||||
-rw-r--r-- | Source/charon/testcases/kernel_interface_test.c | 6 | ||||
-rw-r--r-- | Source/charon/testcases/prime_pool_test.c | 67 | ||||
-rw-r--r-- | Source/charon/testcases/prime_pool_test.h | 39 | ||||
-rw-r--r-- | Source/charon/testcases/rsa_test.c | 2 | ||||
-rw-r--r-- | Source/charon/testcases/testcases.c | 7 |
6 files changed, 5 insertions, 121 deletions
diff --git a/Source/charon/testcases/Makefile.testcases b/Source/charon/testcases/Makefile.testcases index e9f07f518..d6a113fda 100644 --- a/Source/charon/testcases/Makefile.testcases +++ b/Source/charon/testcases/Makefile.testcases @@ -120,11 +120,6 @@ TEST_OBJS+= $(BUILD_DIR)rsa_test.o $(BUILD_DIR)rsa_test.o : $(TESTCASES_DIR)rsa_test.c $(TESTCASES_DIR)rsa_test.h $(CC) $(CFLAGS) -c -o $@ $< -TEST_OBJS+= $(BUILD_DIR)prime_pool_test.o -$(BUILD_DIR)prime_pool_test.o : $(TESTCASES_DIR)prime_pool_test.c $(TESTCASES_DIR)prime_pool_test.h - $(CC) $(CFLAGS) -c -o $@ $< - - TEST_OBJS+= $(BUILD_DIR)kernel_interface_test.o $(BUILD_DIR)kernel_interface_test.o : $(TESTCASES_DIR)kernel_interface_test.c $(TESTCASES_DIR)kernel_interface_test.h $(CC) $(CFLAGS) -c -o $@ $< diff --git a/Source/charon/testcases/kernel_interface_test.c b/Source/charon/testcases/kernel_interface_test.c index 5d072586d..1b0462679 100644 --- a/Source/charon/testcases/kernel_interface_test.c +++ b/Source/charon/testcases/kernel_interface_test.c @@ -65,11 +65,11 @@ void test_kernel_interface(protected_tester_t *tester) - //status = kernel_interface->get_spi(kernel_interface, me, other, 51, TRUE, &spi); + status = kernel_interface->get_spi(kernel_interface, me, other, 50, TRUE, &spi); //status |= kernel_interface->get_spi(kernel_interface, me, other, 50, TRUE, &spi); - //tester->assert_true(tester, status == SUCCESS, "spi get"); + tester->assert_true(tester, status == SUCCESS, "spi get"); - status = kernel_interface->add_sa(kernel_interface, me, other, spi, 50, TRUE, ENCR_AES_CBC, 16, enc_key,AUTH_HMAC_MD5_96,16,inc_key,FALSE); + status = kernel_interface->add_sa(kernel_interface, me, other, spi, 50, TRUE, ENCR_AES_CBC, 16, enc_key,AUTH_HMAC_MD5_96,16,inc_key,TRUE); tester->assert_true(tester, status == SUCCESS, "build sa"); diff --git a/Source/charon/testcases/prime_pool_test.c b/Source/charon/testcases/prime_pool_test.c deleted file mode 100644 index 397a8b58b..000000000 --- a/Source/charon/testcases/prime_pool_test.c +++ /dev/null @@ -1,67 +0,0 @@ -/** - * @file prime_pool_test.h - * - * @brief Tests for the hasher_t classes. - * - */ - -/* - * Copyright (C) 2005 Jan Hutter, Martin Willi - * Hochschule fuer Technik Rapperswil - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - */ - -#include <string.h> -#include <unistd.h> - -#include "prime_pool_test.h" - -#include <daemon.h> -#include <utils/allocator.h> -#include <utils/logger.h> -#include <threads/prime_pool.h> - - -/* - * described in Header-File - */ -void test_prime_pool(protected_tester_t *tester) -{ - mpz_t p1, p2, p3, p4; - prime_pool_t *prime_pool; - - prime_pool = prime_pool_create(20); - - prime_pool->get_prime(prime_pool, 4, &p1); - sleep(1); - tester->assert_true(tester, prime_pool->get_count(prime_pool, 4) == 20, "number of 4 bytes primes"); - tester->assert_true(tester, prime_pool->get_count(prime_pool, 8) == 0, "number of 8 bytes primes"); - tester->assert_true(tester, prime_pool->get_count(prime_pool, 16) == 0, "number of 16 bytes primes"); - prime_pool->get_prime(prime_pool, 8, &p2); - sleep(1); - tester->assert_true(tester, prime_pool->get_count(prime_pool, 4) == 20, "number of 4 bytes primes"); - tester->assert_true(tester, prime_pool->get_count(prime_pool, 8) == 20, "number of 8 bytes primes"); - tester->assert_true(tester, prime_pool->get_count(prime_pool, 16) == 0, "number of 16 bytes primes"); - prime_pool->get_prime(prime_pool, 16, &p3); - sleep(1); - tester->assert_true(tester, prime_pool->get_count(prime_pool, 4) == 20, "number of 4 bytes primes"); - tester->assert_true(tester, prime_pool->get_count(prime_pool, 8) == 20, "number of 8 bytes primes"); - tester->assert_true(tester, prime_pool->get_count(prime_pool, 16) == 20, "number of 16 bytes primes"); - prime_pool->get_prime(prime_pool, 16, &p4); - - mpz_clear(p1); - mpz_clear(p2); - mpz_clear(p3); - mpz_clear(p4); - prime_pool->destroy(prime_pool); - -} diff --git a/Source/charon/testcases/prime_pool_test.h b/Source/charon/testcases/prime_pool_test.h deleted file mode 100644 index 899a08f9e..000000000 --- a/Source/charon/testcases/prime_pool_test.h +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @file prime_pool_test.h - * - * @brief Tests for the prime_pool_t class. - * - */ - -/* - * Copyright (C) 2005 Jan Hutter, Martin Willi - * Hochschule fuer Technik Rapperswil - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - */ - -#ifndef PRIME_POOL_TEST_H -#define PRIME_POOL_TEST_H - -#include <threads/prime_pool.h> -#include <utils/tester.h> - -/** - * @brief Test function used to test the prime_pool functionality. - * - * @param tester associated tester object - * - * @ingroup testcases - */ -void test_prime_pool(protected_tester_t *tester); - - -#endif /*PRIME_POOL_TEST_H*/ diff --git a/Source/charon/testcases/rsa_test.c b/Source/charon/testcases/rsa_test.c index c7929c929..a585806ba 100644 --- a/Source/charon/testcases/rsa_test.c +++ b/Source/charon/testcases/rsa_test.c @@ -58,7 +58,7 @@ void test_rsa(protected_tester_t *tester) private_key = rsa_private_key_create(); - private_key->generate_key(private_key, 1024); + private_key->generate_key(private_key, 512); status = private_key->build_emsa_pkcs1_signature(private_key, HASH_MD5, data, &signature); tester->assert_true(tester, status == SUCCESS, "build emsa_pkcs1_signature"); diff --git a/Source/charon/testcases/testcases.c b/Source/charon/testcases/testcases.c index 7106830bf..2db6b2312 100644 --- a/Source/charon/testcases/testcases.c +++ b/Source/charon/testcases/testcases.c @@ -59,7 +59,6 @@ #include <testcases/init_config_test.h> #include <testcases/sa_config_test.h> #include <testcases/rsa_test.h> -#include <testcases/prime_pool_test.h> #include <testcases/kernel_interface_test.h> /* output for test messages */ @@ -124,7 +123,6 @@ test_t encryption_payload_test = {test_encryption_payload, "encryption payload t test_t init_config_test = {test_init_config, "init_config_t test"}; test_t sa_config_test = {test_sa_config, "sa_config_t test"}; test_t rsa_test = {test_rsa, "RSA private/public key test"}; -test_t prime_pool_test = {test_prime_pool, "Prime pool"}; test_t kernel_interface_test = {test_kernel_interface, "Kernel Interface"}; @@ -136,7 +134,6 @@ static void daemon_kill(daemon_t *this, char* none) this->socket->destroy(this->socket); this->ike_sa_manager->destroy(this->ike_sa_manager); this->job_queue->destroy(this->job_queue); - this->prime_pool->destroy(this->prime_pool); this->event_queue->destroy(this->event_queue); this->send_queue->destroy(this->send_queue); this->configuration_manager->destroy(this->configuration_manager); @@ -161,7 +158,6 @@ daemon_t *daemon_create() charon->job_queue = job_queue_create(); charon->event_queue = event_queue_create(); charon->send_queue = send_queue_create(); - charon->prime_pool = prime_pool_create(0); charon->configuration_manager = configuration_manager_create(RETRANSMIT_TIMEOUT,MAX_RETRANSMIT_COUNT,HALF_OPEN_IKE_SA_TIMEOUT); charon->sender = NULL; charon->receiver = NULL; @@ -236,7 +232,6 @@ int main() &init_config_test, &sa_config_test, &rsa_test, - &prime_pool_test, NULL }; @@ -252,7 +247,7 @@ int main() tester->perform_tests(tester,all_tests); -// tester->perform_test(tester,&packet_test); +// tester->perform_test(tester,&rsa_test); tester->destroy(tester); |