aboutsummaryrefslogtreecommitdiffstats
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.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/libipsec/esp_context.c b/src/libipsec/esp_context.c
index b742d1576..a9e0e5b4d 100644
--- a/src/libipsec/esp_context.c
+++ b/src/libipsec/esp_context.c
@@ -247,7 +247,18 @@ 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:
+ /* 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 "