aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Steffen <andreas.steffen@strongswan.org>2009-12-15 19:13:06 +0100
committerAndreas Steffen <andreas.steffen@strongswan.org>2009-12-15 19:13:06 +0100
commitde962d6e7ddf290da41e0c2a9580a058aff89354 (patch)
tree733e11e832bcc4c5327337e10e6942bb3a95f5b4
parent0be12e3546e3620b8c6d74d102e0f933c9a30bde (diff)
downloadstrongswan-de962d6e7ddf290da41e0c2a9580a058aff89354.tar.bz2
strongswan-de962d6e7ddf290da41e0c2a9580a058aff89354.tar.xz
add IKEv1 support for the Camellia cipher
-rw-r--r--src/libstrongswan/crypto/crypters/crypter.h1
-rw-r--r--src/pluto/crypto.c21
2 files changed, 22 insertions, 0 deletions
diff --git a/src/libstrongswan/crypto/crypters/crypter.h b/src/libstrongswan/crypto/crypters/crypter.h
index db7b267ea..f052a181d 100644
--- a/src/libstrongswan/crypto/crypters/crypter.h
+++ b/src/libstrongswan/crypto/crypters/crypter.h
@@ -64,6 +64,7 @@ enum encryption_algorithm_t {
#define DES_BLOCK_SIZE 8
#define BLOWFISH_BLOCK_SIZE 8
#define AES_BLOCK_SIZE 16
+#define CAMELLIA_BLOCK_SIZE 16
#define SERPENT_BLOCK_SIZE 16
#define TWOFISH_BLOCK_SIZE 16
diff --git a/src/pluto/crypto.c b/src/pluto/crypto.c
index 327e1ceea..2113cecbc 100644
--- a/src/pluto/crypto.c
+++ b/src/pluto/crypto.c
@@ -48,6 +48,22 @@ static struct encrypt_desc encrypt_desc_aes =
keymaxlen: AES_KEY_MAX_LEN,
};
+#define CAMELLIA_KEY_MIN_LEN 128
+#define CAMELLIA_KEY_DEF_LEN 128
+#define CAMELLIA_KEY_MAX_LEN 256
+
+static struct encrypt_desc encrypt_desc_camellia =
+{
+ algo_type: IKE_ALG_ENCRYPT,
+ algo_id: OAKLEY_CAMELLIA_CBC,
+ algo_next: NULL,
+
+ enc_blocksize: CAMELLIA_BLOCK_SIZE,
+ keyminlen: CAMELLIA_KEY_MIN_LEN,
+ keydeflen: CAMELLIA_KEY_DEF_LEN,
+ keymaxlen: CAMELLIA_KEY_MAX_LEN,
+};
+
#define BLOWFISH_KEY_MIN_LEN 128
#define BLOWFISH_KEY_MAX_LEN 448
@@ -300,6 +316,9 @@ bool init_crypto(void)
case ENCR_AES_CBC:
desc = &encrypt_desc_aes;
break;
+ case ENCR_CAMELLIA_CBC:
+ desc = &encrypt_desc_camellia;
+ break;
case ENCR_TWOFISH_CBC:
desc = &encrypt_desc_twofish;
ike_alg_add((struct ike_alg *)&encrypt_desc_twofish_ssh);
@@ -392,6 +411,8 @@ encryption_algorithm_t oakley_to_encryption_algorithm(int alg)
return ENCR_CAST;
case OAKLEY_AES_CBC:
return ENCR_AES_CBC;
+ case OAKLEY_CAMELLIA_CBC:
+ return ENCR_CAMELLIA_CBC;
case OAKLEY_SERPENT_CBC:
return ENCR_SERPENT_CBC;
case OAKLEY_TWOFISH_CBC: