activated CAMELLIA_CBC cipher in openssl plugin
authorAndreas Steffen <andreas.steffen@strongswan.org>
Wed, 5 Aug 2009 20:46:53 +0000 (22:46 +0200)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Wed, 5 Aug 2009 20:46:53 +0000 (22:46 +0200)
src/libstrongswan/plugins/openssl/openssl_crypter.c
src/libstrongswan/plugins/openssl/openssl_plugin.c

index 7f48f10..424fec6 100644 (file)
@@ -83,6 +83,7 @@ static openssl_algorithm_t encryption_algs[] = {
 /*     {ENCR_DES_IV32,         "***",                  0,      0}, */
 /*     {ENCR_NULL,             "***",                  0,      0}, */ /* handled separately */
 /*     {ENCR_AES_CBC,          "***",                  0,      0}, */ /* handled separately */
+/*     {ENCR_CAMELLIA_CBC,     "***",                  0,      0}, */ /* handled separately */
 /*     {ENCR_AES_CTR,          "***",                  0,      0}, */ /* disabled in evp.h */
        {END_OF_LIST,           NULL,                   0,      0},
 };
@@ -224,6 +225,23 @@ openssl_crypter_t *openssl_crypter_create(encryption_algorithm_t algo,
                                        return NULL;
                        }
                        break;
+               case ENCR_CAMELLIA_CBC:
+                       switch (key_size)
+                       {
+                               case 16:        /* CAMELLIA 128 */
+                                       this->cipher = EVP_get_cipherbyname("camellia128");
+                                       break;
+                               case 24:        /* CAMELLIA 192 */
+                                       this->cipher = EVP_get_cipherbyname("camellia192");
+                                       break;
+                               case 32:        /* CAMELLIA 256 */
+                                       this->cipher = EVP_get_cipherbyname("camellia256"); 
+                                       break;
+                               default:
+                                       free(this);
+                                       return NULL;
+                       }
+                       break;
                case ENCR_DES_ECB:
                        this->cipher = EVP_des_ecb();
                        break;
index c35dbcc..6407f42 100644 (file)
@@ -212,6 +212,8 @@ plugin_t *plugin_create()
        /* crypter */
        lib->crypto->add_crypter(lib->crypto, ENCR_AES_CBC,
                                        (crypter_constructor_t)openssl_crypter_create);
+       lib->crypto->add_crypter(lib->crypto, ENCR_CAMELLIA_CBC,
+                                       (crypter_constructor_t)openssl_crypter_create);
        lib->crypto->add_crypter(lib->crypto, ENCR_3DES,
                                        (crypter_constructor_t)openssl_crypter_create);
        lib->crypto->add_crypter(lib->crypto, ENCR_RC5,