This commit is contained in:
@@ -68,7 +68,7 @@ void test_kernel_interface(protected_tester_t *tester)
|
|||||||
//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,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");
|
tester->assert_true(tester, status == SUCCESS, "build sa");
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -201,11 +201,9 @@ static status_t add_sa( private_kernel_interface_t *this,
|
|||||||
int protocol,
|
int protocol,
|
||||||
bool tunnel_mode,
|
bool tunnel_mode,
|
||||||
encryption_algorithm_t enc_alg,
|
encryption_algorithm_t enc_alg,
|
||||||
size_t enc_size,
|
chunk_t encryption_key,
|
||||||
chunk_t enc_key,
|
|
||||||
integrity_algorithm_t int_alg,
|
integrity_algorithm_t int_alg,
|
||||||
size_t int_size,
|
chunk_t integrity_key,
|
||||||
chunk_t int_key,
|
|
||||||
bool replace)
|
bool replace)
|
||||||
{
|
{
|
||||||
netlink_message_t request, *response;
|
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);
|
netlink_algo_t *nla = (netlink_algo_t*)(((u_int8_t*)&request) + request.hdr.nlmsg_len);
|
||||||
|
|
||||||
nla->type = XFRMA_ALG_CRYPT;
|
nla->type = XFRMA_ALG_CRYPT;
|
||||||
nla->length = sizeof(netlink_algo_t) + enc_size;
|
nla->length = sizeof(netlink_algo_t) + encryption_key.len;
|
||||||
nla->algo.alg_key_len = enc_size * 8;
|
nla->algo.alg_key_len = encryption_key.len * 8;
|
||||||
|
|
||||||
strcpy(nla->algo.alg_name, mapping_find(kernel_encryption_algs_m, enc_alg));
|
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;
|
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);
|
netlink_algo_t *nla = (netlink_algo_t*)(((u_int8_t*)&request) + request.hdr.nlmsg_len);
|
||||||
|
|
||||||
nla->type = XFRMA_ALG_AUTH;
|
nla->type = XFRMA_ALG_AUTH;
|
||||||
nla->length = sizeof(netlink_algo_t) + int_size;
|
nla->length = sizeof(netlink_algo_t) + integrity_key.len;
|
||||||
nla->algo.alg_key_len = int_size * 8;
|
nla->algo.alg_key_len = integrity_key.len * 8;
|
||||||
strcpy(nla->algo.alg_name, mapping_find(kernel_integrity_algs_m, int_alg));
|
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;
|
request.hdr.nlmsg_len += nla->length;
|
||||||
}
|
}
|
||||||
@@ -416,7 +414,7 @@ kernel_interface_t *kernel_interface_create()
|
|||||||
/* public functions */
|
/* 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.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;
|
this->public.destroy = (void(*)(kernel_interface_t*)) destroy;
|
||||||
|
|||||||
@@ -60,11 +60,9 @@ struct kernel_interface_t {
|
|||||||
int protocol,
|
int protocol,
|
||||||
bool tunnel_mode,
|
bool tunnel_mode,
|
||||||
encryption_algorithm_t enc_alg,
|
encryption_algorithm_t enc_alg,
|
||||||
size_t enc_size,
|
chunk_t encryption_key,
|
||||||
chunk_t enc_key,
|
|
||||||
integrity_algorithm_t int_alg,
|
integrity_algorithm_t int_alg,
|
||||||
size_t int_size,
|
chunk_t integrity_key,
|
||||||
chunk_t int_key,
|
|
||||||
bool replace);
|
bool replace);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user