]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
var-expand-crypt: Add aes-128-ecb tests
authorAki Tuomi <aki.tuomi@open-xchange.com>
Sun, 17 Nov 2024 10:21:34 +0000 (12:21 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Fri, 17 Jan 2025 08:40:01 +0000 (10:40 +0200)
This ensures ecb mode works too

src/plugins/var-expand-crypt/test-var-expand-crypt.c

index 1c02ec975a0d4d6e07ce2607df66ec46755ce5e6..d9ed4954cef67fb59543187014f0f46bbb152ce3 100644 (file)
@@ -26,6 +26,7 @@ static struct var_expand_table table[] = {
        { .key = "encrypted2", .value = NULL },
        { .key = "user", .value = "foo" },
        { .key = "salt-encrypted", .value ="s=foo,r=1000$da793a4ae62eb1d415228b40c43b93a8$" },
+       { .key = "ecb-encrypted", .value = "$3bca3caa565f2d940acef1244a07c836$" },
        { NULL, NULL, NULL }
 };
 
@@ -95,6 +96,22 @@ static void test_var_expand_crypt(void)
                        "foo",
                        0
                },
+               {
+                       "%{decrypted|encrypt(algorithm='aes-128-ecb',key=key,iv='')}",
+                       "$3bca3caa565f2d940acef1244a07c836$",
+                       0
+               },
+               {
+                       "%{ecb-encrypted|decrypt(algorithm='aes-128-ecb',key=key)}",
+                       "hello, world",
+                       0
+               },
+               {
+                       "%{decrypted|encrypt(algorithm='aes-128-ecb',key=key,iv='')|"
+                       "decrypt(key=key,algorithm='aes-128-ecb')}",
+                       "hello, world",
+                       0
+               },
        };
 
        unsigned int i;