summaryrefslogtreecommitdiff
path: root/src/libipsec/esp_context.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libipsec/esp_context.c')
-rw-r--r--src/libipsec/esp_context.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/libipsec/esp_context.c b/src/libipsec/esp_context.c
index b742d1576..2b003e390 100644
--- a/src/libipsec/esp_context.c
+++ b/src/libipsec/esp_context.c
@@ -247,7 +247,19 @@ static bool create_traditional(private_esp_context_t *this, int enc_alg,
signer_t *signer = NULL;
iv_gen_t *ivg;
- crypter = lib->crypto->create_crypter(lib->crypto, enc_alg, enc_key.len);
+ switch (enc_alg)
+ {
+ case ENCR_AES_CTR:
+ case ENCR_CAMELLIA_CTR:
+ /* the key includes a 4 byte salt */
+ crypter = lib->crypto->create_crypter(lib->crypto, enc_alg,
+ enc_key.len - 4);
+ break;
+ default:
+ crypter = lib->crypto->create_crypter(lib->crypto, enc_alg,
+ enc_key.len);
+ break;
+ }
if (!crypter)
{
DBG1(DBG_ESP, "failed to create ESP context: unsupported encryption "