gcrypt: Added AES_ECB support
authorAndreas Steffen <andreas.steffen@strongswan.org>
Sun, 24 Nov 2019 13:05:25 +0000 (14:05 +0100)
committerTobias Brunner <tobias@strongswan.org>
Thu, 28 Nov 2019 16:03:09 +0000 (17:03 +0100)
src/libstrongswan/plugins/gcrypt/gcrypt_crypter.c
src/libstrongswan/plugins/gcrypt/gcrypt_plugin.c

index 4bee5b7..da6bb91 100644 (file)
@@ -198,7 +198,9 @@ gcrypt_crypter_t *gcrypt_crypter_create(encryption_algorithm_t algo,
                        gcrypt_alg = GCRY_CIPHER_BLOWFISH;
                        break;
                case ENCR_AES_CTR:
-                       mode = GCRY_CIPHER_MODE_CTR;
+               case ENCR_AES_ECB:
+                       mode = (algo == ENCR_AES_CTR) ? GCRY_CIPHER_MODE_CTR :
+                                                                                       GCRY_CIPHER_MODE_ECB;
                        /* fall */
                case ENCR_AES_CBC:
                        switch (key_size)
index 6946e45..848568f 100644 (file)
@@ -70,6 +70,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),
                        /* gcrypt only supports 128 bit blowfish */
                        PLUGIN_PROVIDE(CRYPTER, ENCR_BLOWFISH, 16),
 #ifdef HAVE_GCRY_CIPHER_CAMELLIA