aboutsummaryrefslogtreecommitdiffstats
path: root/src/charon/testing/kernel_interface_test.c
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2006-06-09 07:31:30 +0000
committerMartin Willi <martin@strongswan.org>2006-06-09 07:31:30 +0000
commit5c131a016b61f9f7b6d4249a0d6a84d0cc9f1c66 (patch)
tree99cf6b8aa6eb5cb4d158a57670d8defbe650abb5 /src/charon/testing/kernel_interface_test.c
parentb7f9ca5837bae541ed789d7a3e194a6347512232 (diff)
downloadstrongswan-5c131a016b61f9f7b6d4249a0d6a84d0cc9f1c66.tar.bz2
strongswan-5c131a016b61f9f7b6d4249a0d6a84d0cc9f1c66.tar.xz
specifying keysize in bits, as it is required in IKEv2
added generic kernel SA algorithm handling, which brings us: aes-128, aes-256, blowfish, des, 3des and null encryption for CHILD_SAs
Diffstat (limited to 'src/charon/testing/kernel_interface_test.c')
-rw-r--r--src/charon/testing/kernel_interface_test.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/src/charon/testing/kernel_interface_test.c b/src/charon/testing/kernel_interface_test.c
index 29b3dc34e..a5638dce0 100644
--- a/src/charon/testing/kernel_interface_test.c
+++ b/src/charon/testing/kernel_interface_test.c
@@ -39,24 +39,18 @@ void test_kernel_interface(protected_tester_t *tester)
u_int32_t spi;
host_t *me, *other, *left, *right;
status_t status;
-
- u_int8_t enc_key_bytes[] = {
- 0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,
- 0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08
- };
-
- u_int8_t inc_key_bytes[] = {
- 0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,
+ prf_plus_t *prf_plus;
+ prf_t *prf;
+ u_int8_t key_bytes[] = {
0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08
};
+ chunk_t key = chunk_from_buf(key_bytes);
+ algorithm_t int_alg = {AUTH_HMAC_MD5_96, 0};
+ algorithm_t enc_alg = {ENCR_AES_CBC, 128};
- chunk_t enc_key,inc_key;
- enc_key.ptr = enc_key_bytes;
- enc_key.len = sizeof(enc_key_bytes);
- inc_key.ptr = inc_key_bytes;
- inc_key.len = sizeof(inc_key_bytes);
-
-
+ prf = prf_create(PRF_HMAC_MD5);
+ prf->set_key(prf, key);
+ prf_plus = prf_plus_create(prf, key);
kernel_interface = kernel_interface_create();
@@ -66,7 +60,7 @@ void test_kernel_interface(protected_tester_t *tester)
status = kernel_interface->get_spi(kernel_interface, me, other, 50, 1234, &spi);
tester->assert_true(tester, status == SUCCESS, "spi get");
- status = kernel_interface->add_sa(kernel_interface, me, other, spi, 50, 1234, 5, 10, ENCR_AES_CBC, enc_key,AUTH_UNDEFINED,inc_key,TRUE);
+ status = kernel_interface->add_sa(kernel_interface, me, other, spi, 50, 1234, 5, 10, &enc_alg, &int_alg, prf_plus, TRUE);
tester->assert_true(tester, status == SUCCESS, "add sa");
left = host_create(AF_INET, "10.1.0.0", 0);