From aa9de746fd6f30fb283018bb6afd32013a667ffd Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Wed, 10 Jun 2015 04:34:28 +0300 Subject: test: rename the utilities --- test/CMakeLists.txt | 12 ++++---- test/aes128cbc_decrypt.c | 62 ---------------------------------------- test/aes128cbc_decrypt_block.c | 62 ++++++++++++++++++++++++++++++++++++++++ test/aes128cbc_encrypt.c | 61 ---------------------------------------- test/aes128cbc_encrypt_block.c | 61 ++++++++++++++++++++++++++++++++++++++++ test/aes128cfb_decrypt.c | 61 ---------------------------------------- test/aes128cfb_decrypt_block.c | 61 ++++++++++++++++++++++++++++++++++++++++ test/aes128cfb_encrypt.c | 61 ---------------------------------------- test/aes128cfb_encrypt_block.c | 61 ++++++++++++++++++++++++++++++++++++++++ test/aes128ctr_decrypt.c | 63 ----------------------------------------- test/aes128ctr_decrypt_block.c | 63 +++++++++++++++++++++++++++++++++++++++++ test/aes128ctr_encrypt.c | 63 ----------------------------------------- test/aes128ctr_encrypt_block.c | 63 +++++++++++++++++++++++++++++++++++++++++ test/aes128ecb_decrypt.c | 56 ------------------------------------ test/aes128ecb_decrypt_block.c | 56 ++++++++++++++++++++++++++++++++++++ test/aes128ecb_encrypt.c | 55 ------------------------------------ test/aes128ecb_encrypt_block.c | 55 ++++++++++++++++++++++++++++++++++++ test/aes128ofb_decrypt.c | 61 ---------------------------------------- test/aes128ofb_decrypt_block.c | 61 ++++++++++++++++++++++++++++++++++++++++ test/aes128ofb_encrypt.c | 61 ---------------------------------------- test/aes128ofb_encrypt_block.c | 61 ++++++++++++++++++++++++++++++++++++++++ test/aes192cbc_decrypt.c | 63 ----------------------------------------- test/aes192cbc_decrypt_block.c | 63 +++++++++++++++++++++++++++++++++++++++++ test/aes192cbc_encrypt.c | 62 ---------------------------------------- test/aes192cbc_encrypt_block.c | 62 ++++++++++++++++++++++++++++++++++++++++ test/aes192cfb_decrypt.c | 62 ---------------------------------------- test/aes192cfb_decrypt_block.c | 62 ++++++++++++++++++++++++++++++++++++++++ test/aes192cfb_encrypt.c | 62 ---------------------------------------- test/aes192cfb_encrypt_block.c | 62 ++++++++++++++++++++++++++++++++++++++++ test/aes192ctr_decrypt.c | 64 ------------------------------------------ test/aes192ctr_decrypt_block.c | 64 ++++++++++++++++++++++++++++++++++++++++++ test/aes192ctr_encrypt.c | 64 ------------------------------------------ test/aes192ctr_encrypt_block.c | 64 ++++++++++++++++++++++++++++++++++++++++++ test/aes192ecb_decrypt.c | 57 ------------------------------------- test/aes192ecb_decrypt_block.c | 57 +++++++++++++++++++++++++++++++++++++ test/aes192ecb_encrypt.c | 56 ------------------------------------ test/aes192ecb_encrypt_block.c | 56 ++++++++++++++++++++++++++++++++++++ test/aes192ofb_decrypt.c | 62 ---------------------------------------- test/aes192ofb_decrypt_block.c | 62 ++++++++++++++++++++++++++++++++++++++++ test/aes192ofb_encrypt.c | 62 ---------------------------------------- test/aes192ofb_encrypt_block.c | 62 ++++++++++++++++++++++++++++++++++++++++ test/aes256cbc_decrypt.c | 63 ----------------------------------------- test/aes256cbc_decrypt_block.c | 63 +++++++++++++++++++++++++++++++++++++++++ test/aes256cbc_encrypt.c | 62 ---------------------------------------- test/aes256cbc_encrypt_block.c | 62 ++++++++++++++++++++++++++++++++++++++++ test/aes256cfb_decrypt.c | 62 ---------------------------------------- test/aes256cfb_decrypt_block.c | 62 ++++++++++++++++++++++++++++++++++++++++ test/aes256cfb_encrypt.c | 62 ---------------------------------------- test/aes256cfb_encrypt_block.c | 62 ++++++++++++++++++++++++++++++++++++++++ test/aes256ctr_decrypt.c | 64 ------------------------------------------ test/aes256ctr_decrypt_block.c | 64 ++++++++++++++++++++++++++++++++++++++++++ test/aes256ctr_encrypt.c | 64 ------------------------------------------ test/aes256ctr_encrypt_block.c | 64 ++++++++++++++++++++++++++++++++++++++++++ test/aes256ecb_decrypt.c | 57 ------------------------------------- test/aes256ecb_decrypt_block.c | 57 +++++++++++++++++++++++++++++++++++++ test/aes256ecb_encrypt.c | 56 ------------------------------------ test/aes256ecb_encrypt_block.c | 56 ++++++++++++++++++++++++++++++++++++ test/aes256ofb_decrypt.c | 62 ---------------------------------------- test/aes256ofb_decrypt_block.c | 62 ++++++++++++++++++++++++++++++++++++++++ test/aes256ofb_encrypt.c | 62 ---------------------------------------- test/aes256ofb_encrypt_block.c | 62 ++++++++++++++++++++++++++++++++++++++++ test/toolkit.py | 4 +-- 62 files changed, 1840 insertions(+), 1840 deletions(-) delete mode 100644 test/aes128cbc_decrypt.c create mode 100644 test/aes128cbc_decrypt_block.c delete mode 100644 test/aes128cbc_encrypt.c create mode 100644 test/aes128cbc_encrypt_block.c delete mode 100644 test/aes128cfb_decrypt.c create mode 100644 test/aes128cfb_decrypt_block.c delete mode 100644 test/aes128cfb_encrypt.c create mode 100644 test/aes128cfb_encrypt_block.c delete mode 100644 test/aes128ctr_decrypt.c create mode 100644 test/aes128ctr_decrypt_block.c delete mode 100644 test/aes128ctr_encrypt.c create mode 100644 test/aes128ctr_encrypt_block.c delete mode 100644 test/aes128ecb_decrypt.c create mode 100644 test/aes128ecb_decrypt_block.c delete mode 100644 test/aes128ecb_encrypt.c create mode 100644 test/aes128ecb_encrypt_block.c delete mode 100644 test/aes128ofb_decrypt.c create mode 100644 test/aes128ofb_decrypt_block.c delete mode 100644 test/aes128ofb_encrypt.c create mode 100644 test/aes128ofb_encrypt_block.c delete mode 100644 test/aes192cbc_decrypt.c create mode 100644 test/aes192cbc_decrypt_block.c delete mode 100644 test/aes192cbc_encrypt.c create mode 100644 test/aes192cbc_encrypt_block.c delete mode 100644 test/aes192cfb_decrypt.c create mode 100644 test/aes192cfb_decrypt_block.c delete mode 100644 test/aes192cfb_encrypt.c create mode 100644 test/aes192cfb_encrypt_block.c delete mode 100644 test/aes192ctr_decrypt.c create mode 100644 test/aes192ctr_decrypt_block.c delete mode 100644 test/aes192ctr_encrypt.c create mode 100644 test/aes192ctr_encrypt_block.c delete mode 100644 test/aes192ecb_decrypt.c create mode 100644 test/aes192ecb_decrypt_block.c delete mode 100644 test/aes192ecb_encrypt.c create mode 100644 test/aes192ecb_encrypt_block.c delete mode 100644 test/aes192ofb_decrypt.c create mode 100644 test/aes192ofb_decrypt_block.c delete mode 100644 test/aes192ofb_encrypt.c create mode 100644 test/aes192ofb_encrypt_block.c delete mode 100644 test/aes256cbc_decrypt.c create mode 100644 test/aes256cbc_decrypt_block.c delete mode 100644 test/aes256cbc_encrypt.c create mode 100644 test/aes256cbc_encrypt_block.c delete mode 100644 test/aes256cfb_decrypt.c create mode 100644 test/aes256cfb_decrypt_block.c delete mode 100644 test/aes256cfb_encrypt.c create mode 100644 test/aes256cfb_encrypt_block.c delete mode 100644 test/aes256ctr_decrypt.c create mode 100644 test/aes256ctr_decrypt_block.c delete mode 100644 test/aes256ctr_encrypt.c create mode 100644 test/aes256ctr_encrypt_block.c delete mode 100644 test/aes256ecb_decrypt.c create mode 100644 test/aes256ecb_decrypt_block.c delete mode 100644 test/aes256ecb_encrypt.c create mode 100644 test/aes256ecb_encrypt_block.c delete mode 100644 test/aes256ofb_decrypt.c create mode 100644 test/aes256ofb_decrypt_block.c delete mode 100644 test/aes256ofb_encrypt.c create mode 100644 test/aes256ofb_encrypt_block.c (limited to 'test') diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a024d40..bfbb09c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,13 +1,13 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO") macro(test prefix) - add_executable(test_${prefix}_encrypt ${prefix}_encrypt.c) - target_link_libraries(test_${prefix}_encrypt libaesni) - set_target_properties(test_${prefix}_encrypt PROPERTIES OUTPUT_NAME ${prefix}_encrypt) + add_executable(test_${prefix}_encrypt_block ${prefix}_encrypt_block.c) + target_link_libraries(test_${prefix}_encrypt_block libaesni) + set_target_properties(test_${prefix}_encrypt_block PROPERTIES OUTPUT_NAME ${prefix}_encrypt_block) - add_executable(test_${prefix}_decrypt ${prefix}_decrypt.c) - target_link_libraries(test_${prefix}_decrypt libaesni) - set_target_properties(test_${prefix}_decrypt PROPERTIES OUTPUT_NAME ${prefix}_decrypt) + add_executable(test_${prefix}_decrypt_block ${prefix}_decrypt_block.c) + target_link_libraries(test_${prefix}_decrypt_block libaesni) + set_target_properties(test_${prefix}_decrypt_block PROPERTIES OUTPUT_NAME ${prefix}_decrypt_block) endmacro() test(aes128ecb) diff --git a/test/aes128cbc_decrypt.c b/test/aes128cbc_decrypt.c deleted file mode 100644 index f7ede57..0000000 --- a/test/aes128cbc_decrypt.c +++ /dev/null @@ -1,62 +0,0 @@ -/** - * \file - * \author Egor Tensin - * \date 2015 - * \copyright This file is licensed under the terms of the MIT License. - * See LICENSE.txt for details. - */ - -#include - -#include -#include -#include - -static void exit_with_usage() -{ - puts("Usage: aes128cbc_decrypt.exe KEY0 IV0 [CIPHER0...] [-- KEY1 IV1 [CIPHER1...]...]"); - exit(EXIT_FAILURE); -} - -int main(int argc, char** argv) -{ - for (--argc, ++argv; argc > -1; --argc, ++argv) - { - AesBlock128 plain, key, cipher, iv; - Aes128KeySchedule key_schedule, inverted_schedule; - - if (argc < 2) - exit_with_usage(); - - if (parse_aes_block128(&key, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - exit_with_usage(); - } - - if (parse_aes_block128(&iv, argv[1]) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); - exit_with_usage(); - } - - aes128_expand_key_schedule(key, &key_schedule); - aes128_invert_key_schedule(&key_schedule, &inverted_schedule); - - for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) - { - if (strcmp("--", *argv) == 0) - break; - - if (parse_aes_block128(&cipher, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - continue; - } - plain = aes128cbc_decrypt_block(cipher, &inverted_schedule, iv, &iv); - print_aes_block128(&plain); - } - } - - return 0; -} diff --git a/test/aes128cbc_decrypt_block.c b/test/aes128cbc_decrypt_block.c new file mode 100644 index 0000000..3aacb83 --- /dev/null +++ b/test/aes128cbc_decrypt_block.c @@ -0,0 +1,62 @@ +/** + * \file + * \author Egor Tensin + * \date 2015 + * \copyright This file is licensed under the terms of the MIT License. + * See LICENSE.txt for details. + */ + +#include + +#include +#include +#include + +static void exit_with_usage() +{ + puts("Usage: aes128cbc_decrypt_block.exe KEY0 IV0 [CIPHER0...] [-- KEY1 IV1 [CIPHER1...]...]"); + exit(EXIT_FAILURE); +} + +int main(int argc, char** argv) +{ + for (--argc, ++argv; argc > -1; --argc, ++argv) + { + AesBlock128 plain, key, cipher, iv; + Aes128KeySchedule key_schedule, inverted_schedule; + + if (argc < 2) + exit_with_usage(); + + if (parse_aes_block128(&key, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + exit_with_usage(); + } + + if (parse_aes_block128(&iv, argv[1]) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); + exit_with_usage(); + } + + aes128_expand_key_schedule(key, &key_schedule); + aes128_invert_key_schedule(&key_schedule, &inverted_schedule); + + for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) + { + if (strcmp("--", *argv) == 0) + break; + + if (parse_aes_block128(&cipher, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + continue; + } + plain = aes128cbc_decrypt_block(cipher, &inverted_schedule, iv, &iv); + print_aes_block128(&plain); + } + } + + return 0; +} diff --git a/test/aes128cbc_encrypt.c b/test/aes128cbc_encrypt.c deleted file mode 100644 index d7bb57c..0000000 --- a/test/aes128cbc_encrypt.c +++ /dev/null @@ -1,61 +0,0 @@ -/** - * \file - * \author Egor Tensin - * \date 2015 - * \copyright This file is licensed under the terms of the MIT License. - * See LICENSE.txt for details. - */ - -#include - -#include -#include -#include - -static void exit_with_usage() -{ - puts("Usage: aes128cbc_encrypt.exe KEY0 IV0 [PLAIN0...] [-- KEY1 IV1 [PLAIN1...]...]"); - exit(EXIT_FAILURE); -} - -int main(int argc, char** argv) -{ - for (--argc, ++argv; argc > -1; --argc, ++argv) - { - AesBlock128 plain, key, cipher, iv; - Aes128KeySchedule key_schedule; - - if (argc < 2) - exit_with_usage(); - - if (parse_aes_block128(&key, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - exit_with_usage(); - } - - if (parse_aes_block128(&iv, argv[1]) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); - exit_with_usage(); - } - - aes128_expand_key_schedule(key, &key_schedule); - - for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) - { - if (strcmp("--", *argv) == 0) - break; - - if (parse_aes_block128(&plain, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - continue; - } - cipher = aes128cbc_encrypt_block(plain, &key_schedule, iv, &iv); - print_aes_block128(&cipher); - } - } - - return 0; -} diff --git a/test/aes128cbc_encrypt_block.c b/test/aes128cbc_encrypt_block.c new file mode 100644 index 0000000..2d831ad --- /dev/null +++ b/test/aes128cbc_encrypt_block.c @@ -0,0 +1,61 @@ +/** + * \file + * \author Egor Tensin + * \date 2015 + * \copyright This file is licensed under the terms of the MIT License. + * See LICENSE.txt for details. + */ + +#include + +#include +#include +#include + +static void exit_with_usage() +{ + puts("Usage: aes128cbc_encrypt_block.exe KEY0 IV0 [PLAIN0...] [-- KEY1 IV1 [PLAIN1...]...]"); + exit(EXIT_FAILURE); +} + +int main(int argc, char** argv) +{ + for (--argc, ++argv; argc > -1; --argc, ++argv) + { + AesBlock128 plain, key, cipher, iv; + Aes128KeySchedule key_schedule; + + if (argc < 2) + exit_with_usage(); + + if (parse_aes_block128(&key, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + exit_with_usage(); + } + + if (parse_aes_block128(&iv, argv[1]) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); + exit_with_usage(); + } + + aes128_expand_key_schedule(key, &key_schedule); + + for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) + { + if (strcmp("--", *argv) == 0) + break; + + if (parse_aes_block128(&plain, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + continue; + } + cipher = aes128cbc_encrypt_block(plain, &key_schedule, iv, &iv); + print_aes_block128(&cipher); + } + } + + return 0; +} diff --git a/test/aes128cfb_decrypt.c b/test/aes128cfb_decrypt.c deleted file mode 100644 index 8d53888..0000000 --- a/test/aes128cfb_decrypt.c +++ /dev/null @@ -1,61 +0,0 @@ -/** - * \file - * \author Egor Tensin - * \date 2015 - * \copyright This file is licensed under the terms of the MIT License. - * See LICENSE.txt for details. - */ - -#include - -#include -#include -#include - -static void exit_with_usage() -{ - puts("Usage: aes128cfb_decrypt.exe KEY0 IV0 [CIPHER0...] [-- KEY1 IV1 [CIPHER1...]...]"); - exit(EXIT_FAILURE); -} - -int main(int argc, char** argv) -{ - for (--argc, ++argv; argc > -1; --argc, ++argv) - { - AesBlock128 plain, key, cipher, iv; - Aes128KeySchedule key_schedule; - - if (argc < 2) - exit_with_usage(); - - if (parse_aes_block128(&key, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - exit_with_usage(); - } - - if (parse_aes_block128(&iv, argv[1]) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); - exit_with_usage(); - } - - aes128_expand_key_schedule(key, &key_schedule); - - for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) - { - if (strcmp("--", *argv) == 0) - break; - - if (parse_aes_block128(&cipher, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - continue; - } - plain = aes128cfb_decrypt_block(cipher, &key_schedule, iv, &iv); - print_aes_block128(&plain); - } - } - - return 0; -} diff --git a/test/aes128cfb_decrypt_block.c b/test/aes128cfb_decrypt_block.c new file mode 100644 index 0000000..7bffd4f --- /dev/null +++ b/test/aes128cfb_decrypt_block.c @@ -0,0 +1,61 @@ +/** + * \file + * \author Egor Tensin + * \date 2015 + * \copyright This file is licensed under the terms of the MIT License. + * See LICENSE.txt for details. + */ + +#include + +#include +#include +#include + +static void exit_with_usage() +{ + puts("Usage: aes128cfb_decrypt_block.exe KEY0 IV0 [CIPHER0...] [-- KEY1 IV1 [CIPHER1...]...]"); + exit(EXIT_FAILURE); +} + +int main(int argc, char** argv) +{ + for (--argc, ++argv; argc > -1; --argc, ++argv) + { + AesBlock128 plain, key, cipher, iv; + Aes128KeySchedule key_schedule; + + if (argc < 2) + exit_with_usage(); + + if (parse_aes_block128(&key, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + exit_with_usage(); + } + + if (parse_aes_block128(&iv, argv[1]) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); + exit_with_usage(); + } + + aes128_expand_key_schedule(key, &key_schedule); + + for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) + { + if (strcmp("--", *argv) == 0) + break; + + if (parse_aes_block128(&cipher, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + continue; + } + plain = aes128cfb_decrypt_block(cipher, &key_schedule, iv, &iv); + print_aes_block128(&plain); + } + } + + return 0; +} diff --git a/test/aes128cfb_encrypt.c b/test/aes128cfb_encrypt.c deleted file mode 100644 index 922788b..0000000 --- a/test/aes128cfb_encrypt.c +++ /dev/null @@ -1,61 +0,0 @@ -/** - * \file - * \author Egor Tensin - * \date 2015 - * \copyright This file is licensed under the terms of the MIT License. - * See LICENSE.txt for details. - */ - -#include - -#include -#include -#include - -static void exit_with_usage() -{ - puts("Usage: aes128cfb_encrypt.exe KEY0 IV0 [PLAIN0...] [-- KEY1 IV1 [PLAIN1...]...]"); - exit(EXIT_FAILURE); -} - -int main(int argc, char** argv) -{ - for (--argc, ++argv; argc > -1; --argc, ++argv) - { - AesBlock128 plain, key, cipher, iv; - Aes128KeySchedule key_schedule; - - if (argc < 2) - exit_with_usage(); - - if (parse_aes_block128(&key, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - exit_with_usage(); - } - - if (parse_aes_block128(&iv, argv[1]) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); - exit_with_usage(); - } - - aes128_expand_key_schedule(key, &key_schedule); - - for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) - { - if (strcmp("--", *argv) == 0) - break; - - if (parse_aes_block128(&plain, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - continue; - } - cipher = aes128cfb_encrypt_block(plain, &key_schedule, iv, &iv); - print_aes_block128(&cipher); - } - } - - return 0; -} diff --git a/test/aes128cfb_encrypt_block.c b/test/aes128cfb_encrypt_block.c new file mode 100644 index 0000000..a991864 --- /dev/null +++ b/test/aes128cfb_encrypt_block.c @@ -0,0 +1,61 @@ +/** + * \file + * \author Egor Tensin + * \date 2015 + * \copyright This file is licensed under the terms of the MIT License. + * See LICENSE.txt for details. + */ + +#include + +#include +#include +#include + +static void exit_with_usage() +{ + puts("Usage: aes128cfb_encrypt_block.exe KEY0 IV0 [PLAIN0...] [-- KEY1 IV1 [PLAIN1...]...]"); + exit(EXIT_FAILURE); +} + +int main(int argc, char** argv) +{ + for (--argc, ++argv; argc > -1; --argc, ++argv) + { + AesBlock128 plain, key, cipher, iv; + Aes128KeySchedule key_schedule; + + if (argc < 2) + exit_with_usage(); + + if (parse_aes_block128(&key, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + exit_with_usage(); + } + + if (parse_aes_block128(&iv, argv[1]) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); + exit_with_usage(); + } + + aes128_expand_key_schedule(key, &key_schedule); + + for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) + { + if (strcmp("--", *argv) == 0) + break; + + if (parse_aes_block128(&plain, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + continue; + } + cipher = aes128cfb_encrypt_block(plain, &key_schedule, iv, &iv); + print_aes_block128(&cipher); + } + } + + return 0; +} diff --git a/test/aes128ctr_decrypt.c b/test/aes128ctr_decrypt.c deleted file mode 100644 index 2d4146c..0000000 --- a/test/aes128ctr_decrypt.c +++ /dev/null @@ -1,63 +0,0 @@ -/** - * \file - * \author Egor Tensin - * \date 2015 - * \copyright This file is licensed under the terms of the MIT License. - * See LICENSE.txt for details. - */ - -#include - -#include -#include -#include - -static void exit_with_usage() -{ - puts("Usage: aes128ctr_decrypt.exe KEY0 IV0 [CIPHER0...] [-- KEY1 IV1 [CIPHER1...]...]"); - exit(EXIT_FAILURE); -} - -int main(int argc, char** argv) -{ - for (--argc, ++argv; argc > -1; --argc, ++argv) - { - AesBlock128 plain, key, cipher, iv; - Aes128KeySchedule key_schedule; - - if (argc < 2) - exit_with_usage(); - - if (parse_aes_block128(&key, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - exit_with_usage(); - } - - if (parse_aes_block128(&iv, argv[1]) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); - exit_with_usage(); - } - - aes128_expand_key_schedule(key, &key_schedule); - - int ctr = 0; - - for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) - { - if (strcmp("--", *argv) == 0) - break; - - if (parse_aes_block128(&cipher, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - continue; - } - plain = aes128ctr_decrypt_block(cipher, &key_schedule, iv, ctr++); - print_aes_block128(&plain); - } - } - - return 0; -} diff --git a/test/aes128ctr_decrypt_block.c b/test/aes128ctr_decrypt_block.c new file mode 100644 index 0000000..e6f9cee --- /dev/null +++ b/test/aes128ctr_decrypt_block.c @@ -0,0 +1,63 @@ +/** + * \file + * \author Egor Tensin + * \date 2015 + * \copyright This file is licensed under the terms of the MIT License. + * See LICENSE.txt for details. + */ + +#include + +#include +#include +#include + +static void exit_with_usage() +{ + puts("Usage: aes128ctr_decrypt_block.exe KEY0 IV0 [CIPHER0...] [-- KEY1 IV1 [CIPHER1...]...]"); + exit(EXIT_FAILURE); +} + +int main(int argc, char** argv) +{ + for (--argc, ++argv; argc > -1; --argc, ++argv) + { + AesBlock128 plain, key, cipher, iv; + Aes128KeySchedule key_schedule; + + if (argc < 2) + exit_with_usage(); + + if (parse_aes_block128(&key, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + exit_with_usage(); + } + + if (parse_aes_block128(&iv, argv[1]) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); + exit_with_usage(); + } + + aes128_expand_key_schedule(key, &key_schedule); + + int ctr = 0; + + for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) + { + if (strcmp("--", *argv) == 0) + break; + + if (parse_aes_block128(&cipher, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + continue; + } + plain = aes128ctr_decrypt_block(cipher, &key_schedule, iv, ctr++); + print_aes_block128(&plain); + } + } + + return 0; +} diff --git a/test/aes128ctr_encrypt.c b/test/aes128ctr_encrypt.c deleted file mode 100644 index ef82029..0000000 --- a/test/aes128ctr_encrypt.c +++ /dev/null @@ -1,63 +0,0 @@ -/** - * \file - * \author Egor Tensin - * \date 2015 - * \copyright This file is licensed under the terms of the MIT License. - * See LICENSE.txt for details. - */ - -#include - -#include -#include -#include - -static void exit_with_usage() -{ - puts("Usage: aes128ctr_encrypt.exe KEY0 IV0 [PLAIN0...] [-- KEY1 IV1 [PLAIN1...]...]"); - exit(EXIT_FAILURE); -} - -int main(int argc, char** argv) -{ - for (--argc, ++argv; argc > -1; --argc, ++argv) - { - AesBlock128 plain, key, cipher, iv; - Aes128KeySchedule key_schedule; - - if (argc < 2) - exit_with_usage(); - - if (parse_aes_block128(&key, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - exit_with_usage(); - } - - if (parse_aes_block128(&iv, argv[1]) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); - exit_with_usage(); - } - - aes128_expand_key_schedule(key, &key_schedule); - - int ctr = 0; - - for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) - { - if (strcmp("--", *argv) == 0) - break; - - if (parse_aes_block128(&plain, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - continue; - } - cipher = aes128ctr_encrypt_block(plain, &key_schedule, iv, ctr++); - print_aes_block128(&cipher); - } - } - - return 0; -} diff --git a/test/aes128ctr_encrypt_block.c b/test/aes128ctr_encrypt_block.c new file mode 100644 index 0000000..6baa266 --- /dev/null +++ b/test/aes128ctr_encrypt_block.c @@ -0,0 +1,63 @@ +/** + * \file + * \author Egor Tensin + * \date 2015 + * \copyright This file is licensed under the terms of the MIT License. + * See LICENSE.txt for details. + */ + +#include + +#include +#include +#include + +static void exit_with_usage() +{ + puts("Usage: aes128ctr_encrypt_block.exe KEY0 IV0 [PLAIN0...] [-- KEY1 IV1 [PLAIN1...]...]"); + exit(EXIT_FAILURE); +} + +int main(int argc, char** argv) +{ + for (--argc, ++argv; argc > -1; --argc, ++argv) + { + AesBlock128 plain, key, cipher, iv; + Aes128KeySchedule key_schedule; + + if (argc < 2) + exit_with_usage(); + + if (parse_aes_block128(&key, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + exit_with_usage(); + } + + if (parse_aes_block128(&iv, argv[1]) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); + exit_with_usage(); + } + + aes128_expand_key_schedule(key, &key_schedule); + + int ctr = 0; + + for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) + { + if (strcmp("--", *argv) == 0) + break; + + if (parse_aes_block128(&plain, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + continue; + } + cipher = aes128ctr_encrypt_block(plain, &key_schedule, iv, ctr++); + print_aes_block128(&cipher); + } + } + + return 0; +} diff --git a/test/aes128ecb_decrypt.c b/test/aes128ecb_decrypt.c deleted file mode 100644 index dc85928..0000000 --- a/test/aes128ecb_decrypt.c +++ /dev/null @@ -1,56 +0,0 @@ -/** - * \file - * \author Egor Tensin - * \date 2015 - * \copyright This file is licensed under the terms of the MIT License. - * See LICENSE.txt for details. - */ - -#include - -#include -#include -#include - -static void exit_with_usage() -{ - puts("Usage: aes128ecb_decrypt.exe KEY0 [CIPHER0...] [-- KEY1 [CIPHER1...]...]"); - exit(EXIT_FAILURE); -} - -int main(int argc, char** argv) -{ - for (--argc, ++argv; argc > -1; --argc, ++argv) - { - AesBlock128 plain, key, cipher; - Aes128KeySchedule key_schedule, inverted_schedule; - - if (argc < 1) - exit_with_usage(); - - if (parse_aes_block128(&key, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - exit_with_usage(); - } - - aes128_expand_key_schedule(key, &key_schedule); - aes128_invert_key_schedule(&key_schedule, &inverted_schedule); - - for (--argc, ++argv; argc > 0; --argc, ++argv) - { - if (strcmp("--", *argv) == 0) - break; - - if (parse_aes_block128(&cipher, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - continue; - } - plain = aes128ecb_decrypt_block(cipher, &inverted_schedule); - print_aes_block128(&plain); - } - } - - return 0; -} diff --git a/test/aes128ecb_decrypt_block.c b/test/aes128ecb_decrypt_block.c new file mode 100644 index 0000000..54b890d --- /dev/null +++ b/test/aes128ecb_decrypt_block.c @@ -0,0 +1,56 @@ +/** + * \file + * \author Egor Tensin + * \date 2015 + * \copyright This file is licensed under the terms of the MIT License. + * See LICENSE.txt for details. + */ + +#include + +#include +#include +#include + +static void exit_with_usage() +{ + puts("Usage: aes128ecb_decrypt_block.exe KEY0 [CIPHER0...] [-- KEY1 [CIPHER1...]...]"); + exit(EXIT_FAILURE); +} + +int main(int argc, char** argv) +{ + for (--argc, ++argv; argc > -1; --argc, ++argv) + { + AesBlock128 plain, key, cipher; + Aes128KeySchedule key_schedule, inverted_schedule; + + if (argc < 1) + exit_with_usage(); + + if (parse_aes_block128(&key, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + exit_with_usage(); + } + + aes128_expand_key_schedule(key, &key_schedule); + aes128_invert_key_schedule(&key_schedule, &inverted_schedule); + + for (--argc, ++argv; argc > 0; --argc, ++argv) + { + if (strcmp("--", *argv) == 0) + break; + + if (parse_aes_block128(&cipher, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + continue; + } + plain = aes128ecb_decrypt_block(cipher, &inverted_schedule); + print_aes_block128(&plain); + } + } + + return 0; +} diff --git a/test/aes128ecb_encrypt.c b/test/aes128ecb_encrypt.c deleted file mode 100644 index 3dc8fdb..0000000 --- a/test/aes128ecb_encrypt.c +++ /dev/null @@ -1,55 +0,0 @@ -/** - * \file - * \author Egor Tensin - * \date 2015 - * \copyright This file is licensed under the terms of the MIT License. - * See LICENSE.txt for details. - */ - -#include - -#include -#include -#include - -static void exit_with_usage() -{ - puts("Usage: aes128ecb_encrypt.exe KEY0 [PLAIN0...] [-- KEY1 [PLAIN1...]...]"); - exit(EXIT_FAILURE); -} - -int main(int argc, char** argv) -{ - for (--argc, ++argv; argc > -1; --argc, ++argv) - { - AesBlock128 plain, key, cipher; - Aes128KeySchedule key_schedule; - - if (argc < 1) - exit_with_usage(); - - if (parse_aes_block128(&key, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - exit_with_usage(); - } - - aes128_expand_key_schedule(key, &key_schedule); - - for (--argc, ++argv; argc > 0; --argc, ++argv) - { - if (strcmp("--", *argv) == 0) - break; - - if (parse_aes_block128(&plain, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - continue; - } - cipher = aes128ecb_encrypt_block(plain, &key_schedule); - print_aes_block128(&cipher); - } - } - - return 0; -} diff --git a/test/aes128ecb_encrypt_block.c b/test/aes128ecb_encrypt_block.c new file mode 100644 index 0000000..43b1c1a --- /dev/null +++ b/test/aes128ecb_encrypt_block.c @@ -0,0 +1,55 @@ +/** + * \file + * \author Egor Tensin + * \date 2015 + * \copyright This file is licensed under the terms of the MIT License. + * See LICENSE.txt for details. + */ + +#include + +#include +#include +#include + +static void exit_with_usage() +{ + puts("Usage: aes128ecb_encrypt_block.exe KEY0 [PLAIN0...] [-- KEY1 [PLAIN1...]...]"); + exit(EXIT_FAILURE); +} + +int main(int argc, char** argv) +{ + for (--argc, ++argv; argc > -1; --argc, ++argv) + { + AesBlock128 plain, key, cipher; + Aes128KeySchedule key_schedule; + + if (argc < 1) + exit_with_usage(); + + if (parse_aes_block128(&key, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + exit_with_usage(); + } + + aes128_expand_key_schedule(key, &key_schedule); + + for (--argc, ++argv; argc > 0; --argc, ++argv) + { + if (strcmp("--", *argv) == 0) + break; + + if (parse_aes_block128(&plain, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + continue; + } + cipher = aes128ecb_encrypt_block(plain, &key_schedule); + print_aes_block128(&cipher); + } + } + + return 0; +} diff --git a/test/aes128ofb_decrypt.c b/test/aes128ofb_decrypt.c deleted file mode 100644 index ff3ea93..0000000 --- a/test/aes128ofb_decrypt.c +++ /dev/null @@ -1,61 +0,0 @@ -/** - * \file - * \author Egor Tensin - * \date 2015 - * \copyright This file is licensed under the terms of the MIT License. - * See LICENSE.txt for details. - */ - -#include - -#include -#include -#include - -static void exit_with_usage() -{ - puts("Usage: aes128ofb_decrypt.exe KEY0 IV0 [CIPHER0...] [-- KEY1 IV1 [CIPHER1...]...]"); - exit(EXIT_FAILURE); -} - -int main(int argc, char** argv) -{ - for (--argc, ++argv; argc > -1; --argc, ++argv) - { - AesBlock128 plain, key, cipher, iv; - Aes128KeySchedule key_schedule; - - if (argc < 2) - exit_with_usage(); - - if (parse_aes_block128(&key, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - exit_with_usage(); - } - - if (parse_aes_block128(&iv, argv[1]) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); - exit_with_usage(); - } - - aes128_expand_key_schedule(key, &key_schedule); - - for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) - { - if (strcmp("--", *argv) == 0) - break; - - if (parse_aes_block128(&cipher, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - continue; - } - plain = aes128ofb_decrypt_block(cipher, &key_schedule, iv, &iv); - print_aes_block128(&plain); - } - } - - return 0; -} diff --git a/test/aes128ofb_decrypt_block.c b/test/aes128ofb_decrypt_block.c new file mode 100644 index 0000000..edcbe77 --- /dev/null +++ b/test/aes128ofb_decrypt_block.c @@ -0,0 +1,61 @@ +/** + * \file + * \author Egor Tensin + * \date 2015 + * \copyright This file is licensed under the terms of the MIT License. + * See LICENSE.txt for details. + */ + +#include + +#include +#include +#include + +static void exit_with_usage() +{ + puts("Usage: aes128ofb_decrypt_block.exe KEY0 IV0 [CIPHER0...] [-- KEY1 IV1 [CIPHER1...]...]"); + exit(EXIT_FAILURE); +} + +int main(int argc, char** argv) +{ + for (--argc, ++argv; argc > -1; --argc, ++argv) + { + AesBlock128 plain, key, cipher, iv; + Aes128KeySchedule key_schedule; + + if (argc < 2) + exit_with_usage(); + + if (parse_aes_block128(&key, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + exit_with_usage(); + } + + if (parse_aes_block128(&iv, argv[1]) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); + exit_with_usage(); + } + + aes128_expand_key_schedule(key, &key_schedule); + + for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) + { + if (strcmp("--", *argv) == 0) + break; + + if (parse_aes_block128(&cipher, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + continue; + } + plain = aes128ofb_decrypt_block(cipher, &key_schedule, iv, &iv); + print_aes_block128(&plain); + } + } + + return 0; +} diff --git a/test/aes128ofb_encrypt.c b/test/aes128ofb_encrypt.c deleted file mode 100644 index 9b640da..0000000 --- a/test/aes128ofb_encrypt.c +++ /dev/null @@ -1,61 +0,0 @@ -/** - * \file - * \author Egor Tensin - * \date 2015 - * \copyright This file is licensed under the terms of the MIT License. - * See LICENSE.txt for details. - */ - -#include - -#include -#include -#include - -static void exit_with_usage() -{ - puts("Usage: aes128ofb_encrypt.exe KEY0 IV0 [PLAIN0...] [-- KEY1 IV1 [PLAIN1...]...]"); - exit(EXIT_FAILURE); -} - -int main(int argc, char** argv) -{ - for (--argc, ++argv; argc > -1; --argc, ++argv) - { - AesBlock128 plain, key, cipher, iv; - Aes128KeySchedule key_schedule; - - if (argc < 2) - exit_with_usage(); - - if (parse_aes_block128(&key, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - exit_with_usage(); - } - - if (parse_aes_block128(&iv, argv[1]) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); - exit_with_usage(); - } - - aes128_expand_key_schedule(key, &key_schedule); - - for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) - { - if (strcmp("--", *argv) == 0) - break; - - if (parse_aes_block128(&plain, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - continue; - } - cipher = aes128ofb_encrypt_block(plain, &key_schedule, iv, &iv); - print_aes_block128(&cipher); - } - } - - return 0; -} diff --git a/test/aes128ofb_encrypt_block.c b/test/aes128ofb_encrypt_block.c new file mode 100644 index 0000000..d1ff412 --- /dev/null +++ b/test/aes128ofb_encrypt_block.c @@ -0,0 +1,61 @@ +/** + * \file + * \author Egor Tensin + * \date 2015 + * \copyright This file is licensed under the terms of the MIT License. + * See LICENSE.txt for details. + */ + +#include + +#include +#include +#include + +static void exit_with_usage() +{ + puts("Usage: aes128ofb_encrypt_block.exe KEY0 IV0 [PLAIN0...] [-- KEY1 IV1 [PLAIN1...]...]"); + exit(EXIT_FAILURE); +} + +int main(int argc, char** argv) +{ + for (--argc, ++argv; argc > -1; --argc, ++argv) + { + AesBlock128 plain, key, cipher, iv; + Aes128KeySchedule key_schedule; + + if (argc < 2) + exit_with_usage(); + + if (parse_aes_block128(&key, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + exit_with_usage(); + } + + if (parse_aes_block128(&iv, argv[1]) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); + exit_with_usage(); + } + + aes128_expand_key_schedule(key, &key_schedule); + + for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) + { + if (strcmp("--", *argv) == 0) + break; + + if (parse_aes_block128(&plain, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + continue; + } + cipher = aes128ofb_encrypt_block(plain, &key_schedule, iv, &iv); + print_aes_block128(&cipher); + } + } + + return 0; +} diff --git a/test/aes192cbc_decrypt.c b/test/aes192cbc_decrypt.c deleted file mode 100644 index d77a489..0000000 --- a/test/aes192cbc_decrypt.c +++ /dev/null @@ -1,63 +0,0 @@ -/** - * \file - * \author Egor Tensin - * \date 2015 - * \copyright This file is licensed under the terms of the MIT License. - * See LICENSE.txt for details. - */ - -#include - -#include -#include -#include - -static void exit_with_usage() -{ - puts("Usage: aes192cbc_decrypt.exe KEY0 IV0 [CIPHER0...] [-- KEY1 IV1 [CIPHER1...]...]"); - exit(EXIT_FAILURE); -} - -int main(int argc, char** argv) -{ - for (--argc, ++argv; argc > -1; --argc, ++argv) - { - AesBlock128 plain, cipher, iv; - AesBlock192 key; - Aes192KeySchedule key_schedule, inverted_schedule; - - if (argc < 2) - exit_with_usage(); - - if (parse_aes_block192(&key, *argv) != 0) - { - fprintf(stderr, "Invalid 192-bit AES block '%s'\n", *argv); - exit_with_usage(); - } - - if (parse_aes_block128(&iv, argv[1]) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); - exit_with_usage(); - } - - aes192_expand_key_schedule(&key, &key_schedule); - aes192_invert_key_schedule(&key_schedule, &inverted_schedule); - - for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) - { - if (strcmp("--", *argv) == 0) - break; - - if (parse_aes_block128(&cipher, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - continue; - } - plain = aes192cbc_decrypt_block(cipher, &inverted_schedule, iv, &iv); - print_aes_block128(&plain); - } - } - - return 0; -} diff --git a/test/aes192cbc_decrypt_block.c b/test/aes192cbc_decrypt_block.c new file mode 100644 index 0000000..a714c2b --- /dev/null +++ b/test/aes192cbc_decrypt_block.c @@ -0,0 +1,63 @@ +/** + * \file + * \author Egor Tensin + * \date 2015 + * \copyright This file is licensed under the terms of the MIT License. + * See LICENSE.txt for details. + */ + +#include + +#include +#include +#include + +static void exit_with_usage() +{ + puts("Usage: aes192cbc_decrypt_block.exe KEY0 IV0 [CIPHER0...] [-- KEY1 IV1 [CIPHER1...]...]"); + exit(EXIT_FAILURE); +} + +int main(int argc, char** argv) +{ + for (--argc, ++argv; argc > -1; --argc, ++argv) + { + AesBlock128 plain, cipher, iv; + AesBlock192 key; + Aes192KeySchedule key_schedule, inverted_schedule; + + if (argc < 2) + exit_with_usage(); + + if (parse_aes_block192(&key, *argv) != 0) + { + fprintf(stderr, "Invalid 192-bit AES block '%s'\n", *argv); + exit_with_usage(); + } + + if (parse_aes_block128(&iv, argv[1]) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); + exit_with_usage(); + } + + aes192_expand_key_schedule(&key, &key_schedule); + aes192_invert_key_schedule(&key_schedule, &inverted_schedule); + + for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) + { + if (strcmp("--", *argv) == 0) + break; + + if (parse_aes_block128(&cipher, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + continue; + } + plain = aes192cbc_decrypt_block(cipher, &inverted_schedule, iv, &iv); + print_aes_block128(&plain); + } + } + + return 0; +} diff --git a/test/aes192cbc_encrypt.c b/test/aes192cbc_encrypt.c deleted file mode 100644 index 33c242e..0000000 --- a/test/aes192cbc_encrypt.c +++ /dev/null @@ -1,62 +0,0 @@ -/** - * \file - * \author Egor Tensin - * \date 2015 - * \copyright This file is licensed under the terms of the MIT License. - * See LICENSE.txt for details. - */ - -#include - -#include -#include -#include - -static void exit_with_usage() -{ - puts("Usage: aes192cbc_encrypt.exe KEY0 IV0 [PLAIN0...] [-- KEY1 IV1 [PLAIN1...]...]"); - exit(EXIT_FAILURE); -} - -int main(int argc, char** argv) -{ - for (--argc, ++argv; argc > -1; --argc, ++argv) - { - AesBlock128 plain, cipher, iv; - AesBlock192 key; - Aes192KeySchedule key_schedule; - - if (argc < 2) - exit_with_usage(); - - if (parse_aes_block192(&key, *argv) != 0) - { - fprintf(stderr, "Invalid 192-bit AES block '%s'\n", *argv); - exit_with_usage(); - } - - if (parse_aes_block128(&iv, argv[1]) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); - exit_with_usage(); - } - - aes192_expand_key_schedule(&key, &key_schedule); - - for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) - { - if (strcmp("--", *argv) == 0) - break; - - if (parse_aes_block128(&plain, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - continue; - } - cipher = aes192cbc_encrypt_block(plain, &key_schedule, iv, &iv); - print_aes_block128(&cipher); - } - } - - return 0; -} diff --git a/test/aes192cbc_encrypt_block.c b/test/aes192cbc_encrypt_block.c new file mode 100644 index 0000000..f0a23bc --- /dev/null +++ b/test/aes192cbc_encrypt_block.c @@ -0,0 +1,62 @@ +/** + * \file + * \author Egor Tensin + * \date 2015 + * \copyright This file is licensed under the terms of the MIT License. + * See LICENSE.txt for details. + */ + +#include + +#include +#include +#include + +static void exit_with_usage() +{ + puts("Usage: aes192cbc_encrypt_block.exe KEY0 IV0 [PLAIN0...] [-- KEY1 IV1 [PLAIN1...]...]"); + exit(EXIT_FAILURE); +} + +int main(int argc, char** argv) +{ + for (--argc, ++argv; argc > -1; --argc, ++argv) + { + AesBlock128 plain, cipher, iv; + AesBlock192 key; + Aes192KeySchedule key_schedule; + + if (argc < 2) + exit_with_usage(); + + if (parse_aes_block192(&key, *argv) != 0) + { + fprintf(stderr, "Invalid 192-bit AES block '%s'\n", *argv); + exit_with_usage(); + } + + if (parse_aes_block128(&iv, argv[1]) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); + exit_with_usage(); + } + + aes192_expand_key_schedule(&key, &key_schedule); + + for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) + { + if (strcmp("--", *argv) == 0) + break; + + if (parse_aes_block128(&plain, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + continue; + } + cipher = aes192cbc_encrypt_block(plain, &key_schedule, iv, &iv); + print_aes_block128(&cipher); + } + } + + return 0; +} diff --git a/test/aes192cfb_decrypt.c b/test/aes192cfb_decrypt.c deleted file mode 100644 index aec2840..0000000 --- a/test/aes192cfb_decrypt.c +++ /dev/null @@ -1,62 +0,0 @@ -/** - * \file - * \author Egor Tensin - * \date 2015 - * \copyright This file is licensed under the terms of the MIT License. - * See LICENSE.txt for details. - */ - -#include - -#include -#include -#include - -static void exit_with_usage() -{ - puts("Usage: aes192cfb_decrypt.exe KEY0 IV0 [CIPHER0...] [-- KEY1 IV1 [CIPHER1...]...]"); - exit(EXIT_FAILURE); -} - -int main(int argc, char** argv) -{ - for (--argc, ++argv; argc > -1; --argc, ++argv) - { - AesBlock128 plain, cipher, iv; - AesBlock192 key; - Aes192KeySchedule key_schedule; - - if (argc < 2) - exit_with_usage(); - - if (parse_aes_block192(&key, *argv) != 0) - { - fprintf(stderr, "Invalid 192-bit AES block '%s'\n", *argv); - exit_with_usage(); - } - - if (parse_aes_block128(&iv, argv[1]) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); - exit_with_usage(); - } - - aes192_expand_key_schedule(&key, &key_schedule); - - for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) - { - if (strcmp("--", *argv) == 0) - break; - - if (parse_aes_block128(&cipher, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - continue; - } - plain = aes192cfb_decrypt_block(cipher, &key_schedule, iv, &iv); - print_aes_block128(&plain); - } - } - - return 0; -} diff --git a/test/aes192cfb_decrypt_block.c b/test/aes192cfb_decrypt_block.c new file mode 100644 index 0000000..d8096a5 --- /dev/null +++ b/test/aes192cfb_decrypt_block.c @@ -0,0 +1,62 @@ +/** + * \file + * \author Egor Tensin + * \date 2015 + * \copyright This file is licensed under the terms of the MIT License. + * See LICENSE.txt for details. + */ + +#include + +#include +#include +#include + +static void exit_with_usage() +{ + puts("Usage: aes192cfb_decrypt_block.exe KEY0 IV0 [CIPHER0...] [-- KEY1 IV1 [CIPHER1...]...]"); + exit(EXIT_FAILURE); +} + +int main(int argc, char** argv) +{ + for (--argc, ++argv; argc > -1; --argc, ++argv) + { + AesBlock128 plain, cipher, iv; + AesBlock192 key; + Aes192KeySchedule key_schedule; + + if (argc < 2) + exit_with_usage(); + + if (parse_aes_block192(&key, *argv) != 0) + { + fprintf(stderr, "Invalid 192-bit AES block '%s'\n", *argv); + exit_with_usage(); + } + + if (parse_aes_block128(&iv, argv[1]) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); + exit_with_usage(); + } + + aes192_expand_key_schedule(&key, &key_schedule); + + for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) + { + if (strcmp("--", *argv) == 0) + break; + + if (parse_aes_block128(&cipher, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + continue; + } + plain = aes192cfb_decrypt_block(cipher, &key_schedule, iv, &iv); + print_aes_block128(&plain); + } + } + + return 0; +} diff --git a/test/aes192cfb_encrypt.c b/test/aes192cfb_encrypt.c deleted file mode 100644 index 1fba837..0000000 --- a/test/aes192cfb_encrypt.c +++ /dev/null @@ -1,62 +0,0 @@ -/** - * \file - * \author Egor Tensin - * \date 2015 - * \copyright This file is licensed under the terms of the MIT License. - * See LICENSE.txt for details. - */ - -#include - -#include -#include -#include - -static void exit_with_usage() -{ - puts("Usage: aes192cfb_encrypt.exe KEY0 IV0 [PLAIN0...] [-- KEY1 IV1 [PLAIN1...]...]"); - exit(EXIT_FAILURE); -} - -int main(int argc, char** argv) -{ - for (--argc, ++argv; argc > -1; --argc, ++argv) - { - AesBlock128 plain, cipher, iv; - AesBlock192 key; - Aes192KeySchedule key_schedule; - - if (argc < 2) - exit_with_usage(); - - if (parse_aes_block192(&key, *argv) != 0) - { - fprintf(stderr, "Invalid 192-bit AES block '%s'\n", *argv); - exit_with_usage(); - } - - if (parse_aes_block128(&iv, argv[1]) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); - exit_with_usage(); - } - - aes192_expand_key_schedule(&key, &key_schedule); - - for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) - { - if (strcmp("--", *argv) == 0) - break; - - if (parse_aes_block128(&plain, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - continue; - } - cipher = aes192cfb_encrypt_block(plain, &key_schedule, iv, &iv); - print_aes_block128(&cipher); - } - } - - return 0; -} diff --git a/test/aes192cfb_encrypt_block.c b/test/aes192cfb_encrypt_block.c new file mode 100644 index 0000000..9ee207f --- /dev/null +++ b/test/aes192cfb_encrypt_block.c @@ -0,0 +1,62 @@ +/** + * \file + * \author Egor Tensin + * \date 2015 + * \copyright This file is licensed under the terms of the MIT License. + * See LICENSE.txt for details. + */ + +#include + +#include +#include +#include + +static void exit_with_usage() +{ + puts("Usage: aes192cfb_encrypt_block.exe KEY0 IV0 [PLAIN0...] [-- KEY1 IV1 [PLAIN1...]...]"); + exit(EXIT_FAILURE); +} + +int main(int argc, char** argv) +{ + for (--argc, ++argv; argc > -1; --argc, ++argv) + { + AesBlock128 plain, cipher, iv; + AesBlock192 key; + Aes192KeySchedule key_schedule; + + if (argc < 2) + exit_with_usage(); + + if (parse_aes_block192(&key, *argv) != 0) + { + fprintf(stderr, "Invalid 192-bit AES block '%s'\n", *argv); + exit_with_usage(); + } + + if (parse_aes_block128(&iv, argv[1]) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); + exit_with_usage(); + } + + aes192_expand_key_schedule(&key, &key_schedule); + + for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) + { + if (strcmp("--", *argv) == 0) + break; + + if (parse_aes_block128(&plain, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + continue; + } + cipher = aes192cfb_encrypt_block(plain, &key_schedule, iv, &iv); + print_aes_block128(&cipher); + } + } + + return 0; +} diff --git a/test/aes192ctr_decrypt.c b/test/aes192ctr_decrypt.c deleted file mode 100644 index 9508b8d..0000000 --- a/test/aes192ctr_decrypt.c +++ /dev/null @@ -1,64 +0,0 @@ -/** - * \file - * \author Egor Tensin - * \date 2015 - * \copyright This file is licensed under the terms of the MIT License. - * See LICENSE.txt for details. - */ - -#include - -#include -#include -#include - -static void exit_with_usage() -{ - puts("Usage: aes192ctr_decrypt.exe KEY0 IV0 [CIPHER0...] [-- KEY1 IV1 [CIPHER1...]...]"); - exit(EXIT_FAILURE); -} - -int main(int argc, char** argv) -{ - for (--argc, ++argv; argc > -1; --argc, ++argv) - { - AesBlock128 plain, cipher, iv; - AesBlock192 key; - Aes192KeySchedule key_schedule; - - if (argc < 2) - exit_with_usage(); - - if (parse_aes_block192(&key, *argv) != 0) - { - fprintf(stderr, "Invalid 192-bit AES block '%s'\n", *argv); - exit_with_usage(); - } - - if (parse_aes_block128(&iv, argv[1]) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); - exit_with_usage(); - } - - aes192_expand_key_schedule(&key, &key_schedule); - - int ctr = 0; - - for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) - { - if (strcmp("--", *argv) == 0) - break; - - if (parse_aes_block128(&cipher, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - continue; - } - plain = aes192ctr_decrypt_block(cipher, &key_schedule, iv, ctr++); - print_aes_block128(&plain); - } - } - - return 0; -} diff --git a/test/aes192ctr_decrypt_block.c b/test/aes192ctr_decrypt_block.c new file mode 100644 index 0000000..0c818cf --- /dev/null +++ b/test/aes192ctr_decrypt_block.c @@ -0,0 +1,64 @@ +/** + * \file + * \author Egor Tensin + * \date 2015 + * \copyright This file is licensed under the terms of the MIT License. + * See LICENSE.txt for details. + */ + +#include + +#include +#include +#include + +static void exit_with_usage() +{ + puts("Usage: aes192ctr_decrypt_block.exe KEY0 IV0 [CIPHER0...] [-- KEY1 IV1 [CIPHER1...]...]"); + exit(EXIT_FAILURE); +} + +int main(int argc, char** argv) +{ + for (--argc, ++argv; argc > -1; --argc, ++argv) + { + AesBlock128 plain, cipher, iv; + AesBlock192 key; + Aes192KeySchedule key_schedule; + + if (argc < 2) + exit_with_usage(); + + if (parse_aes_block192(&key, *argv) != 0) + { + fprintf(stderr, "Invalid 192-bit AES block '%s'\n", *argv); + exit_with_usage(); + } + + if (parse_aes_block128(&iv, argv[1]) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); + exit_with_usage(); + } + + aes192_expand_key_schedule(&key, &key_schedule); + + int ctr = 0; + + for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) + { + if (strcmp("--", *argv) == 0) + break; + + if (parse_aes_block128(&cipher, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + continue; + } + plain = aes192ctr_decrypt_block(cipher, &key_schedule, iv, ctr++); + print_aes_block128(&plain); + } + } + + return 0; +} diff --git a/test/aes192ctr_encrypt.c b/test/aes192ctr_encrypt.c deleted file mode 100644 index 17eb1aa..0000000 --- a/test/aes192ctr_encrypt.c +++ /dev/null @@ -1,64 +0,0 @@ -/** - * \file - * \author Egor Tensin - * \date 2015 - * \copyright This file is licensed under the terms of the MIT License. - * See LICENSE.txt for details. - */ - -#include - -#include -#include -#include - -static void exit_with_usage() -{ - puts("Usage: aes192ctr_encrypt.exe KEY0 IV0 [PLAIN0...] [-- KEY1 IV1 [PLAIN1...]...]"); - exit(EXIT_FAILURE); -} - -int main(int argc, char** argv) -{ - for (--argc, ++argv; argc > -1; --argc, ++argv) - { - AesBlock128 plain, cipher, iv; - AesBlock192 key; - Aes192KeySchedule key_schedule; - - if (argc < 2) - exit_with_usage(); - - if (parse_aes_block192(&key, *argv) != 0) - { - fprintf(stderr, "Invalid 192-bit AES block '%s'\n", *argv); - exit_with_usage(); - } - - if (parse_aes_block128(&iv, argv[1]) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); - exit_with_usage(); - } - - aes192_expand_key_schedule(&key, &key_schedule); - - int ctr = 0; - - for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) - { - if (strcmp("--", *argv) == 0) - break; - - if (parse_aes_block128(&plain, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - continue; - } - cipher = aes192ctr_encrypt_block(plain, &key_schedule, iv, ctr++); - print_aes_block128(&cipher); - } - } - - return 0; -} diff --git a/test/aes192ctr_encrypt_block.c b/test/aes192ctr_encrypt_block.c new file mode 100644 index 0000000..1a494c3 --- /dev/null +++ b/test/aes192ctr_encrypt_block.c @@ -0,0 +1,64 @@ +/** + * \file + * \author Egor Tensin + * \date 2015 + * \copyright This file is licensed under the terms of the MIT License. + * See LICENSE.txt for details. + */ + +#include + +#include +#include +#include + +static void exit_with_usage() +{ + puts("Usage: aes192ctr_encrypt_block.exe KEY0 IV0 [PLAIN0...] [-- KEY1 IV1 [PLAIN1...]...]"); + exit(EXIT_FAILURE); +} + +int main(int argc, char** argv) +{ + for (--argc, ++argv; argc > -1; --argc, ++argv) + { + AesBlock128 plain, cipher, iv; + AesBlock192 key; + Aes192KeySchedule key_schedule; + + if (argc < 2) + exit_with_usage(); + + if (parse_aes_block192(&key, *argv) != 0) + { + fprintf(stderr, "Invalid 192-bit AES block '%s'\n", *argv); + exit_with_usage(); + } + + if (parse_aes_block128(&iv, argv[1]) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); + exit_with_usage(); + } + + aes192_expand_key_schedule(&key, &key_schedule); + + int ctr = 0; + + for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) + { + if (strcmp("--", *argv) == 0) + break; + + if (parse_aes_block128(&plain, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + continue; + } + cipher = aes192ctr_encrypt_block(plain, &key_schedule, iv, ctr++); + print_aes_block128(&cipher); + } + } + + return 0; +} diff --git a/test/aes192ecb_decrypt.c b/test/aes192ecb_decrypt.c deleted file mode 100644 index 373a4a3..0000000 --- a/test/aes192ecb_decrypt.c +++ /dev/null @@ -1,57 +0,0 @@ -/** - * \file - * \author Egor Tensin - * \date 2015 - * \copyright This file is licensed under the terms of the MIT License. - * See LICENSE.txt for details. - */ - -#include - -#include -#include -#include - -static void exit_with_usage() -{ - puts("Usage: aes192ecb_decrypt.exe KEY0 [CIPHER0...] [-- KEY1 [CIPHER1...]...]"); - exit(EXIT_FAILURE); -} - -int main(int argc, char** argv) -{ - for (--argc, ++argv; argc > -1; --argc, ++argv) - { - AesBlock128 plain, cipher; - AesBlock192 key; - Aes192KeySchedule key_schedule, inverted_schedule; - - if (argc < 1) - exit_with_usage(); - - if (parse_aes_block192(&key, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - exit_with_usage(); - } - - aes192_expand_key_schedule(&key, &key_schedule); - aes192_invert_key_schedule(&key_schedule, &inverted_schedule); - - for (--argc, ++argv; argc > 0; --argc, ++argv) - { - if (strcmp("--", *argv) == 0) - break; - - if (parse_aes_block128(&cipher, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - continue; - } - plain = aes192ecb_decrypt_block(cipher, &inverted_schedule); - print_aes_block128(&plain); - } - } - - return 0; -} diff --git a/test/aes192ecb_decrypt_block.c b/test/aes192ecb_decrypt_block.c new file mode 100644 index 0000000..c034236 --- /dev/null +++ b/test/aes192ecb_decrypt_block.c @@ -0,0 +1,57 @@ +/** + * \file + * \author Egor Tensin + * \date 2015 + * \copyright This file is licensed under the terms of the MIT License. + * See LICENSE.txt for details. + */ + +#include + +#include +#include +#include + +static void exit_with_usage() +{ + puts("Usage: aes192ecb_decrypt_block.exe KEY0 [CIPHER0...] [-- KEY1 [CIPHER1...]...]"); + exit(EXIT_FAILURE); +} + +int main(int argc, char** argv) +{ + for (--argc, ++argv; argc > -1; --argc, ++argv) + { + AesBlock128 plain, cipher; + AesBlock192 key; + Aes192KeySchedule key_schedule, inverted_schedule; + + if (argc < 1) + exit_with_usage(); + + if (parse_aes_block192(&key, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + exit_with_usage(); + } + + aes192_expand_key_schedule(&key, &key_schedule); + aes192_invert_key_schedule(&key_schedule, &inverted_schedule); + + for (--argc, ++argv; argc > 0; --argc, ++argv) + { + if (strcmp("--", *argv) == 0) + break; + + if (parse_aes_block128(&cipher, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + continue; + } + plain = aes192ecb_decrypt_block(cipher, &inverted_schedule); + print_aes_block128(&plain); + } + } + + return 0; +} diff --git a/test/aes192ecb_encrypt.c b/test/aes192ecb_encrypt.c deleted file mode 100644 index 16a0290..0000000 --- a/test/aes192ecb_encrypt.c +++ /dev/null @@ -1,56 +0,0 @@ -/** - * \file - * \author Egor Tensin - * \date 2015 - * \copyright This file is licensed under the terms of the MIT License. - * See LICENSE.txt for details. - */ - -#include - -#include -#include -#include - -static void exit_with_usage() -{ - puts("Usage: aes192ecb_encrypt.exe KEY0 [PLAIN0...] [-- KEY1 [PLAIN1...]...]"); - exit(EXIT_FAILURE); -} - -int main(int argc, char** argv) -{ - for (--argc, ++argv; argc > -1; --argc, ++argv) - { - AesBlock128 plain, cipher; - AesBlock192 key; - Aes192KeySchedule key_schedule; - - if (argc < 1) - exit_with_usage(); - - if (parse_aes_block192(&key, *argv) != 0) - { - fprintf(stderr, "Invalid 192-bit AES block '%s'\n", *argv); - exit_with_usage(); - } - - aes192_expand_key_schedule(&key, &key_schedule); - - for (--argc, ++argv; argc > 0; --argc, ++argv) - { - if (strcmp("--", *argv) == 0) - break; - - if (parse_aes_block128(&plain, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - continue; - } - cipher = aes192ecb_encrypt_block(plain, &key_schedule); - print_aes_block128(&cipher); - } - } - - return 0; -} diff --git a/test/aes192ecb_encrypt_block.c b/test/aes192ecb_encrypt_block.c new file mode 100644 index 0000000..9af1e3e --- /dev/null +++ b/test/aes192ecb_encrypt_block.c @@ -0,0 +1,56 @@ +/** + * \file + * \author Egor Tensin + * \date 2015 + * \copyright This file is licensed under the terms of the MIT License. + * See LICENSE.txt for details. + */ + +#include + +#include +#include +#include + +static void exit_with_usage() +{ + puts("Usage: aes192ecb_encrypt_block.exe KEY0 [PLAIN0...] [-- KEY1 [PLAIN1...]...]"); + exit(EXIT_FAILURE); +} + +int main(int argc, char** argv) +{ + for (--argc, ++argv; argc > -1; --argc, ++argv) + { + AesBlock128 plain, cipher; + AesBlock192 key; + Aes192KeySchedule key_schedule; + + if (argc < 1) + exit_with_usage(); + + if (parse_aes_block192(&key, *argv) != 0) + { + fprintf(stderr, "Invalid 192-bit AES block '%s'\n", *argv); + exit_with_usage(); + } + + aes192_expand_key_schedule(&key, &key_schedule); + + for (--argc, ++argv; argc > 0; --argc, ++argv) + { + if (strcmp("--", *argv) == 0) + break; + + if (parse_aes_block128(&plain, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + continue; + } + cipher = aes192ecb_encrypt_block(plain, &key_schedule); + print_aes_block128(&cipher); + } + } + + return 0; +} diff --git a/test/aes192ofb_decrypt.c b/test/aes192ofb_decrypt.c deleted file mode 100644 index 621031f..0000000 --- a/test/aes192ofb_decrypt.c +++ /dev/null @@ -1,62 +0,0 @@ -/** - * \file - * \author Egor Tensin - * \date 2015 - * \copyright This file is licensed under the terms of the MIT License. - * See LICENSE.txt for details. - */ - -#include - -#include -#include -#include - -static void exit_with_usage() -{ - puts("Usage: aes192ofb_decrypt.exe KEY0 IV0 [CIPHER0...] [-- KEY1 IV1 [CIPHER1...]...]"); - exit(EXIT_FAILURE); -} - -int main(int argc, char** argv) -{ - for (--argc, ++argv; argc > -1; --argc, ++argv) - { - AesBlock128 plain, cipher, iv; - AesBlock192 key; - Aes192KeySchedule key_schedule; - - if (argc < 2) - exit_with_usage(); - - if (parse_aes_block192(&key, *argv) != 0) - { - fprintf(stderr, "Invalid 192-bit AES block '%s'\n", *argv); - exit_with_usage(); - } - - if (parse_aes_block128(&iv, argv[1]) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); - exit_with_usage(); - } - - aes192_expand_key_schedule(&key, &key_schedule); - - for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) - { - if (strcmp("--", *argv) == 0) - break; - - if (parse_aes_block128(&cipher, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - continue; - } - plain = aes192ofb_decrypt_block(cipher, &key_schedule, iv, &iv); - print_aes_block128(&plain); - } - } - - return 0; -} diff --git a/test/aes192ofb_decrypt_block.c b/test/aes192ofb_decrypt_block.c new file mode 100644 index 0000000..4044435 --- /dev/null +++ b/test/aes192ofb_decrypt_block.c @@ -0,0 +1,62 @@ +/** + * \file + * \author Egor Tensin + * \date 2015 + * \copyright This file is licensed under the terms of the MIT License. + * See LICENSE.txt for details. + */ + +#include + +#include +#include +#include + +static void exit_with_usage() +{ + puts("Usage: aes192ofb_decrypt_block.exe KEY0 IV0 [CIPHER0...] [-- KEY1 IV1 [CIPHER1...]...]"); + exit(EXIT_FAILURE); +} + +int main(int argc, char** argv) +{ + for (--argc, ++argv; argc > -1; --argc, ++argv) + { + AesBlock128 plain, cipher, iv; + AesBlock192 key; + Aes192KeySchedule key_schedule; + + if (argc < 2) + exit_with_usage(); + + if (parse_aes_block192(&key, *argv) != 0) + { + fprintf(stderr, "Invalid 192-bit AES block '%s'\n", *argv); + exit_with_usage(); + } + + if (parse_aes_block128(&iv, argv[1]) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); + exit_with_usage(); + } + + aes192_expand_key_schedule(&key, &key_schedule); + + for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) + { + if (strcmp("--", *argv) == 0) + break; + + if (parse_aes_block128(&cipher, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + continue; + } + plain = aes192ofb_decrypt_block(cipher, &key_schedule, iv, &iv); + print_aes_block128(&plain); + } + } + + return 0; +} diff --git a/test/aes192ofb_encrypt.c b/test/aes192ofb_encrypt.c deleted file mode 100644 index f7cb8d0..0000000 --- a/test/aes192ofb_encrypt.c +++ /dev/null @@ -1,62 +0,0 @@ -/** - * \file - * \author Egor Tensin - * \date 2015 - * \copyright This file is licensed under the terms of the MIT License. - * See LICENSE.txt for details. - */ - -#include - -#include -#include -#include - -static void exit_with_usage() -{ - puts("Usage: aes192ofb_encrypt.exe KEY0 IV0 [PLAIN0...] [-- KEY1 IV1 [PLAIN1...]...]"); - exit(EXIT_FAILURE); -} - -int main(int argc, char** argv) -{ - for (--argc, ++argv; argc > -1; --argc, ++argv) - { - AesBlock128 plain, cipher, iv; - AesBlock192 key; - Aes192KeySchedule key_schedule; - - if (argc < 2) - exit_with_usage(); - - if (parse_aes_block192(&key, *argv) != 0) - { - fprintf(stderr, "Invalid 192-bit AES block '%s'\n", *argv); - exit_with_usage(); - } - - if (parse_aes_block128(&iv, argv[1]) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); - exit_with_usage(); - } - - aes192_expand_key_schedule(&key, &key_schedule); - - for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) - { - if (strcmp("--", *argv) == 0) - break; - - if (parse_aes_block128(&plain, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - continue; - } - cipher = aes192ofb_encrypt_block(plain, &key_schedule, iv, &iv); - print_aes_block128(&cipher); - } - } - - return 0; -} diff --git a/test/aes192ofb_encrypt_block.c b/test/aes192ofb_encrypt_block.c new file mode 100644 index 0000000..8d57208 --- /dev/null +++ b/test/aes192ofb_encrypt_block.c @@ -0,0 +1,62 @@ +/** + * \file + * \author Egor Tensin + * \date 2015 + * \copyright This file is licensed under the terms of the MIT License. + * See LICENSE.txt for details. + */ + +#include + +#include +#include +#include + +static void exit_with_usage() +{ + puts("Usage: aes192ofb_encrypt_block.exe KEY0 IV0 [PLAIN0...] [-- KEY1 IV1 [PLAIN1...]...]"); + exit(EXIT_FAILURE); +} + +int main(int argc, char** argv) +{ + for (--argc, ++argv; argc > -1; --argc, ++argv) + { + AesBlock128 plain, cipher, iv; + AesBlock192 key; + Aes192KeySchedule key_schedule; + + if (argc < 2) + exit_with_usage(); + + if (parse_aes_block192(&key, *argv) != 0) + { + fprintf(stderr, "Invalid 192-bit AES block '%s'\n", *argv); + exit_with_usage(); + } + + if (parse_aes_block128(&iv, argv[1]) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); + exit_with_usage(); + } + + aes192_expand_key_schedule(&key, &key_schedule); + + for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) + { + if (strcmp("--", *argv) == 0) + break; + + if (parse_aes_block128(&plain, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + continue; + } + cipher = aes192ofb_encrypt_block(plain, &key_schedule, iv, &iv); + print_aes_block128(&cipher); + } + } + + return 0; +} diff --git a/test/aes256cbc_decrypt.c b/test/aes256cbc_decrypt.c deleted file mode 100644 index bab00ab..0000000 --- a/test/aes256cbc_decrypt.c +++ /dev/null @@ -1,63 +0,0 @@ -/** - * \file - * \author Egor Tensin - * \date 2015 - * \copyright This file is licensed under the terms of the MIT License. - * See LICENSE.txt for details. - */ - -#include - -#include -#include -#include - -static void exit_with_usage() -{ - puts("Usage: aes256cbc_decrypt.exe KEY0 IV0 [CIPHER0...] [-- KEY1 IV1 [CIPHER1...]...]"); - exit(EXIT_FAILURE); -} - -int main(int argc, char** argv) -{ - for (--argc, ++argv; argc > -1; --argc, ++argv) - { - AesBlock128 plain, cipher, iv; - AesBlock256 key; - Aes256KeySchedule key_schedule, inverted_schedule; - - if (argc < 2) - exit_with_usage(); - - if (parse_aes_block256(&key, *argv) != 0) - { - fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv); - exit_with_usage(); - } - - if (parse_aes_block128(&iv, argv[1]) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); - exit_with_usage(); - } - - aes256_expand_key_schedule(&key, &key_schedule); - aes256_invert_key_schedule(&key_schedule, &inverted_schedule); - - for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) - { - if (strcmp("--", *argv) == 0) - break; - - if (parse_aes_block128(&cipher, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - continue; - } - plain = aes256cbc_decrypt_block(cipher, &inverted_schedule, iv, &iv); - print_aes_block128(&plain); - } - } - - return 0; -} diff --git a/test/aes256cbc_decrypt_block.c b/test/aes256cbc_decrypt_block.c new file mode 100644 index 0000000..7a1defe --- /dev/null +++ b/test/aes256cbc_decrypt_block.c @@ -0,0 +1,63 @@ +/** + * \file + * \author Egor Tensin + * \date 2015 + * \copyright This file is licensed under the terms of the MIT License. + * See LICENSE.txt for details. + */ + +#include + +#include +#include +#include + +static void exit_with_usage() +{ + puts("Usage: aes256cbc_decrypt_block.exe KEY0 IV0 [CIPHER0...] [-- KEY1 IV1 [CIPHER1...]...]"); + exit(EXIT_FAILURE); +} + +int main(int argc, char** argv) +{ + for (--argc, ++argv; argc > -1; --argc, ++argv) + { + AesBlock128 plain, cipher, iv; + AesBlock256 key; + Aes256KeySchedule key_schedule, inverted_schedule; + + if (argc < 2) + exit_with_usage(); + + if (parse_aes_block256(&key, *argv) != 0) + { + fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv); + exit_with_usage(); + } + + if (parse_aes_block128(&iv, argv[1]) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); + exit_with_usage(); + } + + aes256_expand_key_schedule(&key, &key_schedule); + aes256_invert_key_schedule(&key_schedule, &inverted_schedule); + + for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) + { + if (strcmp("--", *argv) == 0) + break; + + if (parse_aes_block128(&cipher, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + continue; + } + plain = aes256cbc_decrypt_block(cipher, &inverted_schedule, iv, &iv); + print_aes_block128(&plain); + } + } + + return 0; +} diff --git a/test/aes256cbc_encrypt.c b/test/aes256cbc_encrypt.c deleted file mode 100644 index 51a80f3..0000000 --- a/test/aes256cbc_encrypt.c +++ /dev/null @@ -1,62 +0,0 @@ -/** - * \file - * \author Egor Tensin - * \date 2015 - * \copyright This file is licensed under the terms of the MIT License. - * See LICENSE.txt for details. - */ - -#include - -#include -#include -#include - -static void exit_with_usage() -{ - puts("Usage: aes256cbc_encrypt.exe KEY0 IV0 [PLAIN0...] [-- KEY1 IV1 [PLAIN1...]...]"); - exit(EXIT_FAILURE); -} - -int main(int argc, char** argv) -{ - for (--argc, ++argv; argc > -1; --argc, ++argv) - { - AesBlock128 plain, cipher, iv; - AesBlock256 key; - Aes256KeySchedule key_schedule; - - if (argc < 2) - exit_with_usage(); - - if (parse_aes_block256(&key, *argv) != 0) - { - fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv); - exit_with_usage(); - } - - if (parse_aes_block128(&iv, argv[1]) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); - exit_with_usage(); - } - - aes256_expand_key_schedule(&key, &key_schedule); - - for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) - { - if (strcmp("--", *argv) == 0) - break; - - if (parse_aes_block128(&plain, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - continue; - } - cipher = aes256cbc_encrypt_block(plain, &key_schedule, iv, &iv); - print_aes_block128(&cipher); - } - } - - return 0; -} diff --git a/test/aes256cbc_encrypt_block.c b/test/aes256cbc_encrypt_block.c new file mode 100644 index 0000000..81ffcc8 --- /dev/null +++ b/test/aes256cbc_encrypt_block.c @@ -0,0 +1,62 @@ +/** + * \file + * \author Egor Tensin + * \date 2015 + * \copyright This file is licensed under the terms of the MIT License. + * See LICENSE.txt for details. + */ + +#include + +#include +#include +#include + +static void exit_with_usage() +{ + puts("Usage: aes256cbc_encrypt_block.exe KEY0 IV0 [PLAIN0...] [-- KEY1 IV1 [PLAIN1...]...]"); + exit(EXIT_FAILURE); +} + +int main(int argc, char** argv) +{ + for (--argc, ++argv; argc > -1; --argc, ++argv) + { + AesBlock128 plain, cipher, iv; + AesBlock256 key; + Aes256KeySchedule key_schedule; + + if (argc < 2) + exit_with_usage(); + + if (parse_aes_block256(&key, *argv) != 0) + { + fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv); + exit_with_usage(); + } + + if (parse_aes_block128(&iv, argv[1]) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); + exit_with_usage(); + } + + aes256_expand_key_schedule(&key, &key_schedule); + + for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) + { + if (strcmp("--", *argv) == 0) + break; + + if (parse_aes_block128(&plain, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + continue; + } + cipher = aes256cbc_encrypt_block(plain, &key_schedule, iv, &iv); + print_aes_block128(&cipher); + } + } + + return 0; +} diff --git a/test/aes256cfb_decrypt.c b/test/aes256cfb_decrypt.c deleted file mode 100644 index c192178..0000000 --- a/test/aes256cfb_decrypt.c +++ /dev/null @@ -1,62 +0,0 @@ -/** - * \file - * \author Egor Tensin - * \date 2015 - * \copyright This file is licensed under the terms of the MIT License. - * See LICENSE.txt for details. - */ - -#include - -#include -#include -#include - -static void exit_with_usage() -{ - puts("Usage: aes256cfb_decrypt.exe KEY0 IV0 [CIPHER0...] [-- KEY1 IV1 [CIPHER1...]...]"); - exit(EXIT_FAILURE); -} - -int main(int argc, char** argv) -{ - for (--argc, ++argv; argc > -1; --argc, ++argv) - { - AesBlock128 plain, cipher, iv; - AesBlock256 key; - Aes256KeySchedule key_schedule; - - if (argc < 2) - exit_with_usage(); - - if (parse_aes_block256(&key, *argv) != 0) - { - fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv); - exit_with_usage(); - } - - if (parse_aes_block128(&iv, argv[1]) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); - exit_with_usage(); - } - - aes256_expand_key_schedule(&key, &key_schedule); - - for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) - { - if (strcmp("--", *argv) == 0) - break; - - if (parse_aes_block128(&cipher, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - continue; - } - plain = aes256cfb_decrypt_block(cipher, &key_schedule, iv, &iv); - print_aes_block128(&plain); - } - } - - return 0; -} diff --git a/test/aes256cfb_decrypt_block.c b/test/aes256cfb_decrypt_block.c new file mode 100644 index 0000000..ffa352a --- /dev/null +++ b/test/aes256cfb_decrypt_block.c @@ -0,0 +1,62 @@ +/** + * \file + * \author Egor Tensin + * \date 2015 + * \copyright This file is licensed under the terms of the MIT License. + * See LICENSE.txt for details. + */ + +#include + +#include +#include +#include + +static void exit_with_usage() +{ + puts("Usage: aes256cfb_decrypt_block.exe KEY0 IV0 [CIPHER0...] [-- KEY1 IV1 [CIPHER1...]...]"); + exit(EXIT_FAILURE); +} + +int main(int argc, char** argv) +{ + for (--argc, ++argv; argc > -1; --argc, ++argv) + { + AesBlock128 plain, cipher, iv; + AesBlock256 key; + Aes256KeySchedule key_schedule; + + if (argc < 2) + exit_with_usage(); + + if (parse_aes_block256(&key, *argv) != 0) + { + fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv); + exit_with_usage(); + } + + if (parse_aes_block128(&iv, argv[1]) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); + exit_with_usage(); + } + + aes256_expand_key_schedule(&key, &key_schedule); + + for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) + { + if (strcmp("--", *argv) == 0) + break; + + if (parse_aes_block128(&cipher, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + continue; + } + plain = aes256cfb_decrypt_block(cipher, &key_schedule, iv, &iv); + print_aes_block128(&plain); + } + } + + return 0; +} diff --git a/test/aes256cfb_encrypt.c b/test/aes256cfb_encrypt.c deleted file mode 100644 index 96f59c5..0000000 --- a/test/aes256cfb_encrypt.c +++ /dev/null @@ -1,62 +0,0 @@ -/** - * \file - * \author Egor Tensin - * \date 2015 - * \copyright This file is licensed under the terms of the MIT License. - * See LICENSE.txt for details. - */ - -#include - -#include -#include -#include - -static void exit_with_usage() -{ - puts("Usage: aes256cfb_encrypt.exe KEY0 IV0 [PLAIN0...] [-- KEY1 IV1 [PLAIN1...]...]"); - exit(EXIT_FAILURE); -} - -int main(int argc, char** argv) -{ - for (--argc, ++argv; argc > -1; --argc, ++argv) - { - AesBlock128 plain, cipher, iv; - AesBlock256 key; - Aes256KeySchedule key_schedule; - - if (argc < 2) - exit_with_usage(); - - if (parse_aes_block256(&key, *argv) != 0) - { - fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv); - exit_with_usage(); - } - - if (parse_aes_block128(&iv, argv[1]) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); - exit_with_usage(); - } - - aes256_expand_key_schedule(&key, &key_schedule); - - for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) - { - if (strcmp("--", *argv) == 0) - break; - - if (parse_aes_block128(&plain, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - continue; - } - cipher = aes256cfb_encrypt_block(plain, &key_schedule, iv, &iv); - print_aes_block128(&cipher); - } - } - - return 0; -} diff --git a/test/aes256cfb_encrypt_block.c b/test/aes256cfb_encrypt_block.c new file mode 100644 index 0000000..5afb7ab --- /dev/null +++ b/test/aes256cfb_encrypt_block.c @@ -0,0 +1,62 @@ +/** + * \file + * \author Egor Tensin + * \date 2015 + * \copyright This file is licensed under the terms of the MIT License. + * See LICENSE.txt for details. + */ + +#include + +#include +#include +#include + +static void exit_with_usage() +{ + puts("Usage: aes256cfb_encrypt_block.exe KEY0 IV0 [PLAIN0...] [-- KEY1 IV1 [PLAIN1...]...]"); + exit(EXIT_FAILURE); +} + +int main(int argc, char** argv) +{ + for (--argc, ++argv; argc > -1; --argc, ++argv) + { + AesBlock128 plain, cipher, iv; + AesBlock256 key; + Aes256KeySchedule key_schedule; + + if (argc < 2) + exit_with_usage(); + + if (parse_aes_block256(&key, *argv) != 0) + { + fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv); + exit_with_usage(); + } + + if (parse_aes_block128(&iv, argv[1]) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); + exit_with_usage(); + } + + aes256_expand_key_schedule(&key, &key_schedule); + + for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) + { + if (strcmp("--", *argv) == 0) + break; + + if (parse_aes_block128(&plain, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + continue; + } + cipher = aes256cfb_encrypt_block(plain, &key_schedule, iv, &iv); + print_aes_block128(&cipher); + } + } + + return 0; +} diff --git a/test/aes256ctr_decrypt.c b/test/aes256ctr_decrypt.c deleted file mode 100644 index d832a1f..0000000 --- a/test/aes256ctr_decrypt.c +++ /dev/null @@ -1,64 +0,0 @@ -/** - * \file - * \author Egor Tensin - * \date 2015 - * \copyright This file is licensed under the terms of the MIT License. - * See LICENSE.txt for details. - */ - -#include - -#include -#include -#include - -static void exit_with_usage() -{ - puts("Usage: aes256ctr_decrypt.exe KEY0 IV0 [CIPHER0...] [-- KEY1 IV1 [CIPHER1...]...]"); - exit(EXIT_FAILURE); -} - -int main(int argc, char** argv) -{ - for (--argc, ++argv; argc > -1; --argc, ++argv) - { - AesBlock128 plain, cipher, iv; - AesBlock256 key; - Aes256KeySchedule key_schedule; - - if (argc < 2) - exit_with_usage(); - - if (parse_aes_block256(&key, *argv) != 0) - { - fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv); - exit_with_usage(); - } - - if (parse_aes_block128(&iv, argv[1]) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); - exit_with_usage(); - } - - aes256_expand_key_schedule(&key, &key_schedule); - - int ctr = 0; - - for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) - { - if (strcmp("--", *argv) == 0) - break; - - if (parse_aes_block128(&cipher, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - continue; - } - plain = aes256ctr_decrypt_block(cipher, &key_schedule, iv, ctr++); - print_aes_block128(&plain); - } - } - - return 0; -} diff --git a/test/aes256ctr_decrypt_block.c b/test/aes256ctr_decrypt_block.c new file mode 100644 index 0000000..79d60e4 --- /dev/null +++ b/test/aes256ctr_decrypt_block.c @@ -0,0 +1,64 @@ +/** + * \file + * \author Egor Tensin + * \date 2015 + * \copyright This file is licensed under the terms of the MIT License. + * See LICENSE.txt for details. + */ + +#include + +#include +#include +#include + +static void exit_with_usage() +{ + puts("Usage: aes256ctr_decrypt_block.exe KEY0 IV0 [CIPHER0...] [-- KEY1 IV1 [CIPHER1...]...]"); + exit(EXIT_FAILURE); +} + +int main(int argc, char** argv) +{ + for (--argc, ++argv; argc > -1; --argc, ++argv) + { + AesBlock128 plain, cipher, iv; + AesBlock256 key; + Aes256KeySchedule key_schedule; + + if (argc < 2) + exit_with_usage(); + + if (parse_aes_block256(&key, *argv) != 0) + { + fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv); + exit_with_usage(); + } + + if (parse_aes_block128(&iv, argv[1]) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); + exit_with_usage(); + } + + aes256_expand_key_schedule(&key, &key_schedule); + + int ctr = 0; + + for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) + { + if (strcmp("--", *argv) == 0) + break; + + if (parse_aes_block128(&cipher, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + continue; + } + plain = aes256ctr_decrypt_block(cipher, &key_schedule, iv, ctr++); + print_aes_block128(&plain); + } + } + + return 0; +} diff --git a/test/aes256ctr_encrypt.c b/test/aes256ctr_encrypt.c deleted file mode 100644 index 28857ac..0000000 --- a/test/aes256ctr_encrypt.c +++ /dev/null @@ -1,64 +0,0 @@ -/** - * \file - * \author Egor Tensin - * \date 2015 - * \copyright This file is licensed under the terms of the MIT License. - * See LICENSE.txt for details. - */ - -#include - -#include -#include -#include - -static void exit_with_usage() -{ - puts("Usage: aes256ctr_encrypt.exe KEY0 IV0 [PLAIN0...] [-- KEY1 IV1 [PLAIN1...]...]"); - exit(EXIT_FAILURE); -} - -int main(int argc, char** argv) -{ - for (--argc, ++argv; argc > -1; --argc, ++argv) - { - AesBlock128 plain, cipher, iv; - AesBlock256 key; - Aes256KeySchedule key_schedule; - - if (argc < 2) - exit_with_usage(); - - if (parse_aes_block256(&key, *argv) != 0) - { - fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv); - exit_with_usage(); - } - - if (parse_aes_block128(&iv, argv[1]) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); - exit_with_usage(); - } - - aes256_expand_key_schedule(&key, &key_schedule); - - int ctr = 0; - - for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) - { - if (strcmp("--", *argv) == 0) - break; - - if (parse_aes_block128(&plain, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - continue; - } - cipher = aes256ctr_encrypt_block(plain, &key_schedule, iv, ctr++); - print_aes_block128(&cipher); - } - } - - return 0; -} diff --git a/test/aes256ctr_encrypt_block.c b/test/aes256ctr_encrypt_block.c new file mode 100644 index 0000000..3b384dc --- /dev/null +++ b/test/aes256ctr_encrypt_block.c @@ -0,0 +1,64 @@ +/** + * \file + * \author Egor Tensin + * \date 2015 + * \copyright This file is licensed under the terms of the MIT License. + * See LICENSE.txt for details. + */ + +#include + +#include +#include +#include + +static void exit_with_usage() +{ + puts("Usage: aes256ctr_encrypt_block.exe KEY0 IV0 [PLAIN0...] [-- KEY1 IV1 [PLAIN1...]...]"); + exit(EXIT_FAILURE); +} + +int main(int argc, char** argv) +{ + for (--argc, ++argv; argc > -1; --argc, ++argv) + { + AesBlock128 plain, cipher, iv; + AesBlock256 key; + Aes256KeySchedule key_schedule; + + if (argc < 2) + exit_with_usage(); + + if (parse_aes_block256(&key, *argv) != 0) + { + fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv); + exit_with_usage(); + } + + if (parse_aes_block128(&iv, argv[1]) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); + exit_with_usage(); + } + + aes256_expand_key_schedule(&key, &key_schedule); + + int ctr = 0; + + for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) + { + if (strcmp("--", *argv) == 0) + break; + + if (parse_aes_block128(&plain, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + continue; + } + cipher = aes256ctr_encrypt_block(plain, &key_schedule, iv, ctr++); + print_aes_block128(&cipher); + } + } + + return 0; +} diff --git a/test/aes256ecb_decrypt.c b/test/aes256ecb_decrypt.c deleted file mode 100644 index eed5528..0000000 --- a/test/aes256ecb_decrypt.c +++ /dev/null @@ -1,57 +0,0 @@ -/** - * \file - * \author Egor Tensin - * \date 2015 - * \copyright This file is licensed under the terms of the MIT License. - * See LICENSE.txt for details. - */ - -#include - -#include -#include -#include - -static void exit_with_usage() -{ - puts("Usage: aes256ecb_decrypt.exe KEY0 [CIPHER0...] [-- KEY1 [CIPHER1...]...]"); - exit(EXIT_FAILURE); -} - -int main(int argc, char** argv) -{ - for (--argc, ++argv; argc > -1; --argc, ++argv) - { - AesBlock128 plain, cipher; - AesBlock256 key; - Aes256KeySchedule key_schedule, inverted_schedule; - - if (argc < 1) - exit_with_usage(); - - if (parse_aes_block256(&key, *argv) != 0) - { - fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv); - exit_with_usage(); - } - - aes256_expand_key_schedule(&key, &key_schedule); - aes256_invert_key_schedule(&key_schedule, &inverted_schedule); - - for (--argc, ++argv; argc > 0; --argc, ++argv) - { - if (strcmp("--", *argv) == 0) - break; - - if (parse_aes_block128(&cipher, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - continue; - } - plain = aes256ecb_decrypt_block(cipher, &inverted_schedule); - print_aes_block128(&plain); - } - } - - return 0; -} diff --git a/test/aes256ecb_decrypt_block.c b/test/aes256ecb_decrypt_block.c new file mode 100644 index 0000000..106aa8b --- /dev/null +++ b/test/aes256ecb_decrypt_block.c @@ -0,0 +1,57 @@ +/** + * \file + * \author Egor Tensin + * \date 2015 + * \copyright This file is licensed under the terms of the MIT License. + * See LICENSE.txt for details. + */ + +#include + +#include +#include +#include + +static void exit_with_usage() +{ + puts("Usage: aes256ecb_decrypt_block.exe KEY0 [CIPHER0...] [-- KEY1 [CIPHER1...]...]"); + exit(EXIT_FAILURE); +} + +int main(int argc, char** argv) +{ + for (--argc, ++argv; argc > -1; --argc, ++argv) + { + AesBlock128 plain, cipher; + AesBlock256 key; + Aes256KeySchedule key_schedule, inverted_schedule; + + if (argc < 1) + exit_with_usage(); + + if (parse_aes_block256(&key, *argv) != 0) + { + fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv); + exit_with_usage(); + } + + aes256_expand_key_schedule(&key, &key_schedule); + aes256_invert_key_schedule(&key_schedule, &inverted_schedule); + + for (--argc, ++argv; argc > 0; --argc, ++argv) + { + if (strcmp("--", *argv) == 0) + break; + + if (parse_aes_block128(&cipher, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + continue; + } + plain = aes256ecb_decrypt_block(cipher, &inverted_schedule); + print_aes_block128(&plain); + } + } + + return 0; +} diff --git a/test/aes256ecb_encrypt.c b/test/aes256ecb_encrypt.c deleted file mode 100644 index cfcc74e..0000000 --- a/test/aes256ecb_encrypt.c +++ /dev/null @@ -1,56 +0,0 @@ -/** - * \file - * \author Egor Tensin - * \date 2015 - * \copyright This file is licensed under the terms of the MIT License. - * See LICENSE.txt for details. - */ - -#include - -#include -#include -#include - -static void exit_with_usage() -{ - puts("Usage: aes256ecb_encrypt.exe KEY0 [PLAIN0...] [-- KEY1 [PLAIN1...]...]"); - exit(EXIT_FAILURE); -} - -int main(int argc, char** argv) -{ - for (--argc, ++argv; argc > -1; --argc, ++argv) - { - AesBlock128 plain, cipher; - AesBlock256 key; - Aes256KeySchedule key_schedule; - - if (argc < 1) - exit_with_usage(); - - if (parse_aes_block256(&key, *argv) != 0) - { - fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv); - exit_with_usage(); - } - - aes256_expand_key_schedule(&key, &key_schedule); - - for (--argc, ++argv; argc > 0; --argc, ++argv) - { - if (strcmp("--", *argv) == 0) - break; - - if (parse_aes_block128(&plain, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - continue; - } - cipher = aes256ecb_encrypt_block(plain, &key_schedule); - print_aes_block128(&cipher); - } - } - - return 0; -} diff --git a/test/aes256ecb_encrypt_block.c b/test/aes256ecb_encrypt_block.c new file mode 100644 index 0000000..4f550b6 --- /dev/null +++ b/test/aes256ecb_encrypt_block.c @@ -0,0 +1,56 @@ +/** + * \file + * \author Egor Tensin + * \date 2015 + * \copyright This file is licensed under the terms of the MIT License. + * See LICENSE.txt for details. + */ + +#include + +#include +#include +#include + +static void exit_with_usage() +{ + puts("Usage: aes256ecb_encrypt_block.exe KEY0 [PLAIN0...] [-- KEY1 [PLAIN1...]...]"); + exit(EXIT_FAILURE); +} + +int main(int argc, char** argv) +{ + for (--argc, ++argv; argc > -1; --argc, ++argv) + { + AesBlock128 plain, cipher; + AesBlock256 key; + Aes256KeySchedule key_schedule; + + if (argc < 1) + exit_with_usage(); + + if (parse_aes_block256(&key, *argv) != 0) + { + fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv); + exit_with_usage(); + } + + aes256_expand_key_schedule(&key, &key_schedule); + + for (--argc, ++argv; argc > 0; --argc, ++argv) + { + if (strcmp("--", *argv) == 0) + break; + + if (parse_aes_block128(&plain, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + continue; + } + cipher = aes256ecb_encrypt_block(plain, &key_schedule); + print_aes_block128(&cipher); + } + } + + return 0; +} diff --git a/test/aes256ofb_decrypt.c b/test/aes256ofb_decrypt.c deleted file mode 100644 index 8c324e9..0000000 --- a/test/aes256ofb_decrypt.c +++ /dev/null @@ -1,62 +0,0 @@ -/** - * \file - * \author Egor Tensin - * \date 2015 - * \copyright This file is licensed under the terms of the MIT License. - * See LICENSE.txt for details. - */ - -#include - -#include -#include -#include - -static void exit_with_usage() -{ - puts("Usage: aes256ofb_decrypt.exe KEY0 IV0 [CIPHER0...] [-- KEY1 IV1 [CIPHER1...]...]"); - exit(EXIT_FAILURE); -} - -int main(int argc, char** argv) -{ - for (--argc, ++argv; argc > -1; --argc, ++argv) - { - AesBlock128 plain, cipher, iv; - AesBlock256 key; - Aes256KeySchedule key_schedule; - - if (argc < 2) - exit_with_usage(); - - if (parse_aes_block256(&key, *argv) != 0) - { - fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv); - exit_with_usage(); - } - - if (parse_aes_block128(&iv, argv[1]) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); - exit_with_usage(); - } - - aes256_expand_key_schedule(&key, &key_schedule); - - for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) - { - if (strcmp("--", *argv) == 0) - break; - - if (parse_aes_block128(&cipher, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - continue; - } - plain = aes256ofb_decrypt_block(cipher, &key_schedule, iv, &iv); - print_aes_block128(&plain); - } - } - - return 0; -} diff --git a/test/aes256ofb_decrypt_block.c b/test/aes256ofb_decrypt_block.c new file mode 100644 index 0000000..7b4c614 --- /dev/null +++ b/test/aes256ofb_decrypt_block.c @@ -0,0 +1,62 @@ +/** + * \file + * \author Egor Tensin + * \date 2015 + * \copyright This file is licensed under the terms of the MIT License. + * See LICENSE.txt for details. + */ + +#include + +#include +#include +#include + +static void exit_with_usage() +{ + puts("Usage: aes256ofb_decrypt_block.exe KEY0 IV0 [CIPHER0...] [-- KEY1 IV1 [CIPHER1...]...]"); + exit(EXIT_FAILURE); +} + +int main(int argc, char** argv) +{ + for (--argc, ++argv; argc > -1; --argc, ++argv) + { + AesBlock128 plain, cipher, iv; + AesBlock256 key; + Aes256KeySchedule key_schedule; + + if (argc < 2) + exit_with_usage(); + + if (parse_aes_block256(&key, *argv) != 0) + { + fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv); + exit_with_usage(); + } + + if (parse_aes_block128(&iv, argv[1]) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); + exit_with_usage(); + } + + aes256_expand_key_schedule(&key, &key_schedule); + + for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) + { + if (strcmp("--", *argv) == 0) + break; + + if (parse_aes_block128(&cipher, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + continue; + } + plain = aes256ofb_decrypt_block(cipher, &key_schedule, iv, &iv); + print_aes_block128(&plain); + } + } + + return 0; +} diff --git a/test/aes256ofb_encrypt.c b/test/aes256ofb_encrypt.c deleted file mode 100644 index 8d31fbe..0000000 --- a/test/aes256ofb_encrypt.c +++ /dev/null @@ -1,62 +0,0 @@ -/** - * \file - * \author Egor Tensin - * \date 2015 - * \copyright This file is licensed under the terms of the MIT License. - * See LICENSE.txt for details. - */ - -#include - -#include -#include -#include - -static void exit_with_usage() -{ - puts("Usage: aes256ofb_encrypt.exe KEY0 IV0 [PLAIN0...] [-- KEY1 IV1 [PLAIN1...]...]"); - exit(EXIT_FAILURE); -} - -int main(int argc, char** argv) -{ - for (--argc, ++argv; argc > -1; --argc, ++argv) - { - AesBlock128 plain, cipher, iv; - AesBlock256 key; - Aes256KeySchedule key_schedule; - - if (argc < 2) - exit_with_usage(); - - if (parse_aes_block256(&key, *argv) != 0) - { - fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv); - exit_with_usage(); - } - - if (parse_aes_block128(&iv, argv[1]) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); - exit_with_usage(); - } - - aes256_expand_key_schedule(&key, &key_schedule); - - for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) - { - if (strcmp("--", *argv) == 0) - break; - - if (parse_aes_block128(&plain, *argv) != 0) - { - fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); - continue; - } - cipher = aes256ofb_encrypt_block(plain, &key_schedule, iv, &iv); - print_aes_block128(&cipher); - } - } - - return 0; -} diff --git a/test/aes256ofb_encrypt_block.c b/test/aes256ofb_encrypt_block.c new file mode 100644 index 0000000..09d2edb --- /dev/null +++ b/test/aes256ofb_encrypt_block.c @@ -0,0 +1,62 @@ +/** + * \file + * \author Egor Tensin + * \date 2015 + * \copyright This file is licensed under the terms of the MIT License. + * See LICENSE.txt for details. + */ + +#include + +#include +#include +#include + +static void exit_with_usage() +{ + puts("Usage: aes256ofb_encrypt_block.exe KEY0 IV0 [PLAIN0...] [-- KEY1 IV1 [PLAIN1...]...]"); + exit(EXIT_FAILURE); +} + +int main(int argc, char** argv) +{ + for (--argc, ++argv; argc > -1; --argc, ++argv) + { + AesBlock128 plain, cipher, iv; + AesBlock256 key; + Aes256KeySchedule key_schedule; + + if (argc < 2) + exit_with_usage(); + + if (parse_aes_block256(&key, *argv) != 0) + { + fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv); + exit_with_usage(); + } + + if (parse_aes_block128(&iv, argv[1]) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); + exit_with_usage(); + } + + aes256_expand_key_schedule(&key, &key_schedule); + + for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) + { + if (strcmp("--", *argv) == 0) + break; + + if (parse_aes_block128(&plain, *argv) != 0) + { + fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); + continue; + } + cipher = aes256ofb_encrypt_block(plain, &key_schedule, iv, &iv); + print_aes_block128(&cipher); + } + } + + return 0; +} diff --git a/test/toolkit.py b/test/toolkit.py index fdbd51e..75a0b1f 100644 --- a/test/toolkit.py +++ b/test/toolkit.py @@ -76,10 +76,10 @@ class Tools: return os.path.join(self._root_dir_path, fn) def get_encrypt_tool_path(self, algo, mode): - return self._get_tool_path('{0}{1}_encrypt.exe'.format(algo, mode)) + return self._get_tool_path('{0}{1}_encrypt_block.exe'.format(algo, mode)) def get_decrypt_tool_path(self, algo, mode): - return self._get_tool_path('{0}{1}_decrypt.exe'.format(algo, mode)) + return self._get_tool_path('{0}{1}_decrypt_block.exe'.format(algo, mode)) def run_tool(self, tool_path, args): cmd_list = ['sde', '--', tool_path] if self._use_sde else [tool_path] -- cgit v1.2.3