openssl: Added AES_ECB support
authorAndreas Steffen <andreas.steffen@strongswan.org>
Thu, 21 Nov 2019 14:27:59 +0000 (15:27 +0100)
committerTobias Brunner <tobias@strongswan.org>
Thu, 28 Nov 2019 16:03:08 +0000 (17:03 +0100)
src/libstrongswan/plugins/openssl/openssl_crypter.c
src/libstrongswan/plugins/openssl/openssl_plugin.c

index 74beb76..fafb0a7 100644 (file)
@@ -211,6 +211,26 @@ openssl_crypter_t *openssl_crypter_create(encryption_algorithm_t algo,
                                        return NULL;
                        }
                        break;
+               case ENCR_AES_ECB:
+                       switch (key_size)
+                       {
+                               case 0:
+                                       key_size = 16;
+                                       /* FALL */
+                               case 16:        /* AES 128 */
+                                       this->cipher = EVP_get_cipherbyname("aes-128-ecb");
+                                       break;
+                               case 24:        /* AES-192 */
+                                       this->cipher = EVP_get_cipherbyname("aes-192-ecb");
+                                       break;
+                               case 32:        /* AES-256 */
+                                       this->cipher = EVP_get_cipherbyname("aes-256-ecb");
+                                       break;
+                               default:
+                                       free(this);
+                                       return NULL;
+                       }
+                       break;
                case ENCR_CAMELLIA_CBC:
                        switch (key_size)
                        {
index 069136d..71369e9 100644 (file)
@@ -497,6 +497,9 @@ METHOD(plugin_t, get_features, int,
                        PLUGIN_PROVIDE(CRYPTER, ENCR_AES_CBC, 16),
                        PLUGIN_PROVIDE(CRYPTER, ENCR_AES_CBC, 24),
                        PLUGIN_PROVIDE(CRYPTER, ENCR_AES_CBC, 32),
+                       PLUGIN_PROVIDE(CRYPTER, ENCR_AES_ECB, 16),
+                       PLUGIN_PROVIDE(CRYPTER, ENCR_AES_ECB, 24),
+                       PLUGIN_PROVIDE(CRYPTER, ENCR_AES_ECB, 32),
 #endif
 #ifndef OPENSSL_NO_CAMELLIA
                        PLUGIN_PROVIDE(CRYPTER, ENCR_CAMELLIA_CBC, 16),