added support for AES counter mode in ESP

proposal keywords: aes128ctr aes192ctr aes256ctr
This commit is contained in:
Martin Willi 2009-04-27 12:16:52 +00:00
parent 3bf7c2491f
commit 18eef5d6b6
3 changed files with 7 additions and 3 deletions

View File

@ -35,6 +35,9 @@ null, ENCRYPTION_ALGORITHM, ENCR_NULL, 0
aes128, ENCRYPTION_ALGORITHM, ENCR_AES_CBC, 128
aes192, ENCRYPTION_ALGORITHM, ENCR_AES_CBC, 192
aes256, ENCRYPTION_ALGORITHM, ENCR_AES_CBC, 256
aes128ctr, ENCRYPTION_ALGORITHM, ENCR_AES_CTR, 128
aes192ctr, ENCRYPTION_ALGORITHM, ENCR_AES_CTR, 192
aes256ctr, ENCRYPTION_ALGORITHM, ENCR_AES_CTR, 256
aes128ccm8, ENCRYPTION_ALGORITHM, ENCR_AES_CCM_ICV8, 128
aes128ccm64, ENCRYPTION_ALGORITHM, ENCR_AES_CCM_ICV8, 128
aes128ccm12, ENCRYPTION_ALGORITHM, ENCR_AES_CCM_ICV12, 128

View File

@ -170,7 +170,7 @@ static kernel_algorithm_t encryption_algs[] = {
/* {ENCR_DES_IV32, "***" }, */
{ENCR_NULL, "cipher_null" },
{ENCR_AES_CBC, "aes" },
/* {ENCR_AES_CTR, "***" }, */
{ENCR_AES_CTR, "rfc3686(ctr(aes))" },
{ENCR_AES_CCM_ICV8, "rfc4309(ccm(aes))" },
{ENCR_AES_CCM_ICV12, "rfc4309(ccm(aes))" },
{ENCR_AES_CCM_ICV16, "rfc4309(ccm(aes))" },

View File

@ -415,17 +415,18 @@ static bool derive_child_keys(private_keymat_t *this,
/* to bytes */
enc_size /= 8;
/* CCM/GCM needs additional bytes */
/* CCM/GCM/CTR needs additional bytes */
switch (enc_alg)
{
case ENCR_AES_CCM_ICV8:
case ENCR_AES_CCM_ICV12:
case ENCR_AES_CCM_ICV16:
enc_size += 3;
break;
break;
case ENCR_AES_GCM_ICV8:
case ENCR_AES_GCM_ICV12:
case ENCR_AES_GCM_ICV16:
case ENCR_AES_CTR:
enc_size += 4;
break;
default: