Added support for Camellia cipher to xcbc
authorMartin Willi <martin@revosec.ch>
Fri, 13 Aug 2010 14:08:25 +0000 (16:08 +0200)
committerMartin Willi <martin@revosec.ch>
Fri, 13 Aug 2010 15:11:54 +0000 (17:11 +0200)
src/libcharon/sa/keymat.c
src/libstrongswan/plugins/xcbc/xcbc_plugin.c
src/libstrongswan/plugins/xcbc/xcbc_prf.c
src/libstrongswan/plugins/xcbc/xcbc_signer.c

index 837cbe4..9b04a35 100644 (file)
@@ -195,6 +195,9 @@ static bool derive_ike_keys(private_keymat_t *this, proposal_t *proposal,
                        /* while rfc4434 defines variable keys for AES-XCBC, rfc3664 does
                         * not and therefore fixed key semantics apply to XCBC for key
                         * derivation. */
+               case PRF_CAMELLIA128_XCBC:
+                       /* draft-kanno-ipsecme-camellia-xcbc refers to rfc 4434, we
+                        * assume fixed key length. */
                        key_size = this->prf->get_key_size(this->prf)/2;
                        nonce_i.len = min(nonce_i.len, key_size);
                        nonce_r.len = min(nonce_r.len, key_size);
index 57be90a..8c25a5e 100644 (file)
@@ -36,9 +36,9 @@ METHOD(plugin_t, destroy, void,
        private_xcbc_plugin_t *this)
 {
        lib->crypto->remove_prf(lib->crypto,
-                                                       (prf_constructor_t)xcbc_prf_create);
+                                       (prf_constructor_t)xcbc_prf_create);
        lib->crypto->remove_signer(lib->crypto,
-                                                          (signer_constructor_t)xcbc_signer_create);
+                                       (signer_constructor_t)xcbc_signer_create);
        free(this);
 }
 
@@ -54,9 +54,13 @@ plugin_t *xcbc_plugin_create()
        );
 
        lib->crypto->add_prf(lib->crypto, PRF_AES128_XCBC,
-                                                (prf_constructor_t)xcbc_prf_create);
+                                       (prf_constructor_t)xcbc_prf_create);
+       lib->crypto->add_prf(lib->crypto, PRF_CAMELLIA128_XCBC,
+                                       (prf_constructor_t)xcbc_prf_create);
        lib->crypto->add_signer(lib->crypto, AUTH_AES_XCBC_96,
-                                                       (signer_constructor_t)xcbc_signer_create);
+                                       (signer_constructor_t)xcbc_signer_create);
+       lib->crypto->add_signer(lib->crypto, AUTH_CAMELLIA_XCBC_96,
+                                       (signer_constructor_t)xcbc_signer_create);
 
        return &this->public.plugin;
 }
index c661ce6..33a6c4b 100644 (file)
@@ -94,6 +94,9 @@ xcbc_prf_t *xcbc_prf_create(pseudo_random_function_t algo)
                case PRF_AES128_XCBC:
                        xcbc = xcbc_create(ENCR_AES_CBC, 16);
                        break;
+               case PRF_CAMELLIA128_XCBC:
+                       xcbc = xcbc_create(ENCR_CAMELLIA_CBC, 16);
+                       break;
                default:
                        return NULL;
        }
index 01f5a19..ad7e2f4 100644 (file)
@@ -131,6 +131,10 @@ xcbc_signer_t *xcbc_signer_create(integrity_algorithm_t algo)
                        xcbc = xcbc_create(ENCR_AES_CBC, 16);
                        trunc = 12;
                        break;
+               case AUTH_CAMELLIA_XCBC_96:
+                       xcbc = xcbc_create(ENCR_CAMELLIA_CBC, 16);
+                       trunc = 12;
+                       break;
                default:
                        return NULL;
        }