From: Aki Tuomi Date: Sun, 17 Nov 2024 10:21:34 +0000 (+0200) Subject: var-expand-crypt: Add aes-128-ecb tests X-Git-Tag: 2.4.0~247 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f9e26895d06469e29f188dca943e8d47f1c5ecef;p=thirdparty%2Fdovecot%2Fcore.git var-expand-crypt: Add aes-128-ecb tests This ensures ecb mode works too --- diff --git a/src/plugins/var-expand-crypt/test-var-expand-crypt.c b/src/plugins/var-expand-crypt/test-var-expand-crypt.c index 1c02ec975a..d9ed4954ce 100644 --- a/src/plugins/var-expand-crypt/test-var-expand-crypt.c +++ b/src/plugins/var-expand-crypt/test-var-expand-crypt.c @@ -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;