aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/aesxx/utils
diff options
context:
space:
mode:
authorEgor Tensin <egor@tensin.name>2026-07-22 23:48:16 +0200
committerEgor Tensin <egor@tensin.name>2026-07-23 10:54:24 +0200
commitd6ba2397803c5f2d6a39a8684239c53f84e73b80 (patch)
treec33b3fe76890e05ddea32071f461f892f9d17e6a /aesxx/utils
parentaesxx/utils: add tests for invalid inputs (diff)
downloadaes-tools-d6ba2397803c5f2d6a39a8684239c53f84e73b80.tar.gz
aes-tools-d6ba2397803c5f2d6a39a8684239c53f84e73b80.zip
aes: always require full inputs
I.e. no 31 digit for 128-bit blocks, reuse code, etc. Also, generalize hex string parsing.
Diffstat (limited to 'aesxx/utils')
-rw-r--r--aesxx/utils/test/basic.cmake18
1 files changed, 13 insertions, 5 deletions
diff --git a/aesxx/utils/test/basic.cmake b/aesxx/utils/test/basic.cmake
index df4150b..2383f61 100644
--- a/aesxx/utils/test/basic.cmake
+++ b/aesxx/utils/test/basic.cmake
@@ -67,7 +67,7 @@ foreach(action encrypt decrypt)
"${CMAKE_SOURCE_DIR}/cmake/tools/ctest-driver.py"
run
--exit-code 1
- --pass-regex [=[AES error: Couldn't parse '0001020304050607' \(possibly not complete input\) as a 256-bit block]=]
+ --pass-regex [=[AES error: Couldn't parse '0001020304050607' \(possibly not complete input\) as a 32-byte hex string]=]
--
"$<TARGET_FILE:${tgt}>" -a aes256 -m ecb 0001020304050607
)
@@ -75,7 +75,7 @@ foreach(action encrypt decrypt)
"${CMAKE_SOURCE_DIR}/cmake/tools/ctest-driver.py"
run
--exit-code 1
- --pass-regex [=[AES error: Couldn't parse 'foobar' \(possibly not complete input\) as a 256-bit block]=]
+ --pass-regex [=[AES error: Couldn't parse 'foobar' \(possibly not complete input\) as a 32-byte hex string]=]
--
"$<TARGET_FILE:${tgt}>" -a aes256 -m ecb foobar
)
@@ -83,16 +83,24 @@ foreach(action encrypt decrypt)
"${CMAKE_SOURCE_DIR}/cmake/tools/ctest-driver.py"
run
--exit-code 1
- --pass-regex [=[AES error: Couldn't parse '2222222222222222222222222222222' \(possibly not complete input\) as a 128-bit block]=]
+ --pass-regex [=[AES error: Couldn't parse '2222222222222222222222222222222' \(possibly not complete input\) as a 16-byte hex string]=]
--
"$<TARGET_FILE:${tgt}>" -a aes128 -m cbc 11111111111111111111111111111111 2222222222222222222222222222222
)
+ add_test(NAME "${tgt}_invalid_iv2" COMMAND Python3::Interpreter
+ "${CMAKE_SOURCE_DIR}/cmake/tools/ctest-driver.py"
+ run
+ --exit-code 1
+ --pass-regex [=[AES error: Couldn't parse '222222222222222222222222222222222' \(possibly not complete input\) as a 16-byte hex string]=]
+ --
+ "$<TARGET_FILE:${tgt}>" -a aes128 -m cbc 11111111111111111111111111111111 222222222222222222222222222222222
+ )
add_test(NAME "${tgt}_invalid_block" COMMAND Python3::Interpreter
"${CMAKE_SOURCE_DIR}/cmake/tools/ctest-driver.py"
run
--exit-code 1
- --pass-regex [=[AES error: Couldn't parse '0' \(possibly not complete input\) as a 128-bit block]=]
+ --pass-regex [=[AES error: Couldn't parse '0' \(possibly not complete input\) as a 16-byte hex string]=]
--
- "$<TARGET_FILE:${tgt}>" -a aes128 -m cbc 11111111111111111111111111111111 2222222222222222222222222222222 0
+ "$<TARGET_FILE:${tgt}>" -a aes128 -m cbc 11111111111111111111111111111111 22222222222222222222222222222222 0
)
endforeach()