From f9e26895d06469e29f188dca943e8d47f1c5ecef Mon Sep 17 00:00:00 2001 From: Aki Tuomi Date: Sun, 17 Nov 2024 12:21:34 +0200 Subject: [PATCH] var-expand-crypt: Add aes-128-ecb tests This ensures ecb mode works too --- .../var-expand-crypt/test-var-expand-crypt.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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; -- 2.47.3