diff options
author | Martin Willi <martin@strongswan.org> | 2006-02-10 15:18:18 +0000 |
---|---|---|
committer | Martin Willi <martin@strongswan.org> | 2006-02-10 15:18:18 +0000 |
commit | fc18670524798f8c0b08a3fd2d165447bf352104 (patch) | |
tree | 730ca792a0160de700248602f845fa369f9d7d9f | |
parent | aeda79ff7824bcdc48c8d6bf5818d40cc476340e (diff) | |
download | strongswan-fc18670524798f8c0b08a3fd2d165447bf352104.tar.bz2 strongswan-fc18670524798f8c0b08a3fd2d165447bf352104.tar.xz |
-rw-r--r-- | Source/charon/testcases/kernel_interface_test.c | 2 | ||||
-rw-r--r-- | Source/charon/threads/kernel_interface.c | 28 | ||||
-rw-r--r-- | Source/charon/threads/kernel_interface.h | 8 |
3 files changed, 17 insertions, 21 deletions
diff --git a/Source/charon/testcases/kernel_interface_test.c b/Source/charon/testcases/kernel_interface_test.c index 396736607..2f26c807a 100644 --- a/Source/charon/testcases/kernel_interface_test.c +++ b/Source/charon/testcases/kernel_interface_test.c @@ -68,7 +68,7 @@ void test_kernel_interface(protected_tester_t *tester) //status = kernel_interface->get_spi(kernel_interface, me, other, 50, TRUE, &spi); //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,TRUE); + status = kernel_interface->add_sa(kernel_interface, me, other, spi, 50, TRUE, ENCR_AES_CBC, enc_key,AUTH_HMAC_MD5_96,inc_key,TRUE); tester->assert_true(tester, status == SUCCESS, "build sa"); diff --git a/Source/charon/threads/kernel_interface.c b/Source/charon/threads/kernel_interface.c index 4acf14cd4..4fba85cbd 100644 --- a/Source/charon/threads/kernel_interface.c +++ b/Source/charon/threads/kernel_interface.c @@ -195,17 +195,15 @@ static status_t get_spi(private_kernel_interface_t *this, host_t *src, host_t *d } static status_t add_sa( private_kernel_interface_t *this, - host_t *me, - host_t *other, - u_int32_t spi, - int protocol, + host_t *me, + host_t *other, + u_int32_t spi, + int protocol, bool tunnel_mode, encryption_algorithm_t enc_alg, - size_t enc_size, - chunk_t enc_key, + chunk_t encryption_key, integrity_algorithm_t int_alg, - size_t int_size, - chunk_t int_key, + chunk_t integrity_key, bool replace) { netlink_message_t request, *response; @@ -236,11 +234,11 @@ static status_t add_sa( private_kernel_interface_t *this, netlink_algo_t *nla = (netlink_algo_t*)(((u_int8_t*)&request) + request.hdr.nlmsg_len); nla->type = XFRMA_ALG_CRYPT; - nla->length = sizeof(netlink_algo_t) + enc_size; - nla->algo.alg_key_len = enc_size * 8; + nla->length = sizeof(netlink_algo_t) + encryption_key.len; + nla->algo.alg_key_len = encryption_key.len * 8; strcpy(nla->algo.alg_name, mapping_find(kernel_encryption_algs_m, enc_alg)); - memcpy(nla->algo.alg_key, enc_key.ptr, enc_key.len); + memcpy(nla->algo.alg_key, encryption_key.ptr, encryption_key.len); request.hdr.nlmsg_len += nla->length; } @@ -250,10 +248,10 @@ static status_t add_sa( private_kernel_interface_t *this, netlink_algo_t *nla = (netlink_algo_t*)(((u_int8_t*)&request) + request.hdr.nlmsg_len); nla->type = XFRMA_ALG_AUTH; - nla->length = sizeof(netlink_algo_t) + int_size; - nla->algo.alg_key_len = int_size * 8; + nla->length = sizeof(netlink_algo_t) + integrity_key.len; + nla->algo.alg_key_len = integrity_key.len * 8; strcpy(nla->algo.alg_name, mapping_find(kernel_integrity_algs_m, int_alg)); - memcpy(nla->algo.alg_key, int_key.ptr, int_key.len); + memcpy(nla->algo.alg_key, integrity_key.ptr, integrity_key.len); request.hdr.nlmsg_len += nla->length; } @@ -416,7 +414,7 @@ kernel_interface_t *kernel_interface_create() /* public functions */ this->public.get_spi = (status_t(*)(kernel_interface_t*,host_t*,host_t*,protocol_id_t,bool,u_int32_t*))get_spi; - this->public.add_sa = (status_t(*)(kernel_interface_t *,host_t*,host_t*,u_int32_t,int,bool,encryption_algorithm_t,size_t,chunk_t,integrity_algorithm_t,size_t,chunk_t,bool))add_sa; + this->public.add_sa = (status_t(*)(kernel_interface_t *,host_t*,host_t*,u_int32_t,int,bool,encryption_algorithm_t,chunk_t,integrity_algorithm_t,chunk_t,bool))add_sa; this->public.destroy = (void(*)(kernel_interface_t*)) destroy; diff --git a/Source/charon/threads/kernel_interface.h b/Source/charon/threads/kernel_interface.h index 951319067..eeebbcdf8 100644 --- a/Source/charon/threads/kernel_interface.h +++ b/Source/charon/threads/kernel_interface.h @@ -54,17 +54,15 @@ struct kernel_interface_t { * @todo Cleanup method params */ status_t (*add_sa)(kernel_interface_t *this, - host_t *me, + host_t *me, host_t *other, u_int32_t spi, int protocol, bool tunnel_mode, encryption_algorithm_t enc_alg, - size_t enc_size, - chunk_t enc_key, + chunk_t encryption_key, integrity_algorithm_t int_alg, - size_t int_size, - chunk_t int_key, + chunk_t integrity_key, bool replace); /** |