diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2015-06-24 05:59:11 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2015-06-24 05:59:11 +0300 |
commit | 225ef13cc7f58b69ef4c4db6308a225c726359f7 (patch) | |
tree | 75454aa3d5b4042ddacbf22ddab2680c47caf405 | |
parent | test: locate executables in PATH (diff) | |
download | aes-tools-225ef13cc7f58b69ef4c4db6308a225c726359f7.tar.gz aes-tools-225ef13cc7f58b69ef4c4db6308a225c726359f7.zip |
move executables from test/ to utils/
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | test/CMakeLists.txt | 37 | ||||
-rw-r--r-- | test/README.md | 4 | ||||
-rw-r--r-- | utils/CMakeLists.txt | 32 | ||||
-rw-r--r-- | utils/block/CMakeLists.txt | 27 | ||||
-rw-r--r-- | utils/block/aes128cbc_decrypt_block.c (renamed from test/aes128cbc_decrypt_block.c) | 0 | ||||
-rw-r--r-- | utils/block/aes128cbc_encrypt_block.c (renamed from test/aes128cbc_encrypt_block.c) | 0 | ||||
-rw-r--r-- | utils/block/aes128cfb_decrypt_block.c (renamed from test/aes128cfb_decrypt_block.c) | 0 | ||||
-rw-r--r-- | utils/block/aes128cfb_encrypt_block.c (renamed from test/aes128cfb_encrypt_block.c) | 0 | ||||
-rw-r--r-- | utils/block/aes128ctr_decrypt_block.c (renamed from test/aes128ctr_decrypt_block.c) | 0 | ||||
-rw-r--r-- | utils/block/aes128ctr_encrypt_block.c (renamed from test/aes128ctr_encrypt_block.c) | 0 | ||||
-rw-r--r-- | utils/block/aes128ecb_decrypt_block.c (renamed from test/aes128ecb_decrypt_block.c) | 0 | ||||
-rw-r--r-- | utils/block/aes128ecb_encrypt_block.c (renamed from test/aes128ecb_encrypt_block.c) | 0 | ||||
-rw-r--r-- | utils/block/aes128ofb_decrypt_block.c (renamed from test/aes128ofb_decrypt_block.c) | 0 | ||||
-rw-r--r-- | utils/block/aes128ofb_encrypt_block.c (renamed from test/aes128ofb_encrypt_block.c) | 0 | ||||
-rw-r--r-- | utils/block/aes192cbc_decrypt_block.c (renamed from test/aes192cbc_decrypt_block.c) | 0 | ||||
-rw-r--r-- | utils/block/aes192cbc_encrypt_block.c (renamed from test/aes192cbc_encrypt_block.c) | 0 | ||||
-rw-r--r-- | utils/block/aes192cfb_decrypt_block.c (renamed from test/aes192cfb_decrypt_block.c) | 0 | ||||
-rw-r--r-- | utils/block/aes192cfb_encrypt_block.c (renamed from test/aes192cfb_encrypt_block.c) | 0 | ||||
-rw-r--r-- | utils/block/aes192ctr_decrypt_block.c (renamed from test/aes192ctr_decrypt_block.c) | 0 | ||||
-rw-r--r-- | utils/block/aes192ctr_encrypt_block.c (renamed from test/aes192ctr_encrypt_block.c) | 0 | ||||
-rw-r--r-- | utils/block/aes192ecb_decrypt_block.c (renamed from test/aes192ecb_decrypt_block.c) | 0 | ||||
-rw-r--r-- | utils/block/aes192ecb_encrypt_block.c (renamed from test/aes192ecb_encrypt_block.c) | 0 | ||||
-rw-r--r-- | utils/block/aes192ofb_decrypt_block.c (renamed from test/aes192ofb_decrypt_block.c) | 0 | ||||
-rw-r--r-- | utils/block/aes192ofb_encrypt_block.c (renamed from test/aes192ofb_encrypt_block.c) | 0 | ||||
-rw-r--r-- | utils/block/aes256cbc_decrypt_block.c (renamed from test/aes256cbc_decrypt_block.c) | 0 | ||||
-rw-r--r-- | utils/block/aes256cbc_encrypt_block.c (renamed from test/aes256cbc_encrypt_block.c) | 0 | ||||
-rw-r--r-- | utils/block/aes256cfb_decrypt_block.c (renamed from test/aes256cfb_decrypt_block.c) | 0 | ||||
-rw-r--r-- | utils/block/aes256cfb_encrypt_block.c (renamed from test/aes256cfb_encrypt_block.c) | 0 | ||||
-rw-r--r-- | utils/block/aes256ctr_decrypt_block.c (renamed from test/aes256ctr_decrypt_block.c) | 0 | ||||
-rw-r--r-- | utils/block/aes256ctr_encrypt_block.c (renamed from test/aes256ctr_encrypt_block.c) | 0 | ||||
-rw-r--r-- | utils/block/aes256ecb_decrypt_block.c (renamed from test/aes256ecb_decrypt_block.c) | 0 | ||||
-rw-r--r-- | utils/block/aes256ecb_encrypt_block.c (renamed from test/aes256ecb_encrypt_block.c) | 0 | ||||
-rw-r--r-- | utils/block/aes256ofb_decrypt_block.c (renamed from test/aes256ofb_decrypt_block.c) | 0 | ||||
-rw-r--r-- | utils/block/aes256ofb_encrypt_block.c (renamed from test/aes256ofb_encrypt_block.c) | 0 | ||||
-rw-r--r-- | utils/block/cxx/CMakeLists.txt | 11 | ||||
-rw-r--r-- | utils/block/cxx/README.md | 60 | ||||
-rw-r--r-- | utils/block/cxx/aes_common.hpp (renamed from test/aes_common.hpp) | 0 | ||||
-rw-r--r-- | utils/block/cxx/aes_decrypt_block.cpp (renamed from test/aes_decrypt_block.cpp) | 0 | ||||
-rw-r--r-- | utils/block/cxx/aes_encrypt_block.cpp (renamed from test/aes_encrypt_block.cpp) | 0 | ||||
-rw-r--r-- | utils/file/CMakeLists.txt | 10 | ||||
-rw-r--r-- | utils/file/aes128ecb_decrypt_file.cpp (renamed from utils/aes128ecb_decrypt_file.cpp) | 0 | ||||
-rw-r--r-- | utils/file/aes128ecb_encrypt_file.cpp (renamed from utils/aes128ecb_encrypt_file.cpp) | 0 | ||||
-rw-r--r-- | utils/file/cxx/CMakeLists.txt | 21 | ||||
-rw-r--r-- | utils/file/cxx/README.md (renamed from utils/README.md) | 4 | ||||
-rw-r--r-- | utils/file/cxx/aes_common.hpp (renamed from utils/aes_common.hpp) | 0 | ||||
-rw-r--r-- | utils/file/cxx/aes_decrypt_bmp.cpp (renamed from utils/aes_decrypt_bmp.cpp) | 0 | ||||
-rw-r--r-- | utils/file/cxx/aes_decrypt_file.cpp (renamed from utils/aes_decrypt_file.cpp) | 0 | ||||
-rw-r--r-- | utils/file/cxx/aes_encrypt_bmp.cpp (renamed from utils/aes_encrypt_bmp.cpp) | 0 | ||||
-rw-r--r-- | utils/file/cxx/aes_encrypt_file.cpp (renamed from utils/aes_encrypt_file.cpp) | 0 | ||||
-rw-r--r-- | utils/file/cxx/bmp/butterfly.bmp (renamed from utils/bmp/butterfly.bmp) | bin | 503370 -> 503370 bytes | |||
-rw-r--r-- | utils/file/cxx/bmp/cipherfly_cbc.bmp (renamed from utils/bmp/cipherfly_cbc.bmp) | bin | 503382 -> 503382 bytes | |||
-rw-r--r-- | utils/file/cxx/bmp/cipherfly_ecb.bmp (renamed from utils/bmp/cipherfly_ecb.bmp) | bin | 503382 -> 503382 bytes |
53 files changed, 135 insertions, 72 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 1301aa7..19b6707 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,5 +17,4 @@ target_compile_definitions(libaesni PRIVATE _CRT_SECURE_NO_WARNINGS) add_subdirectory(cxx) add_subdirectory(examples) -add_subdirectory(test) add_subdirectory(utils) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt deleted file mode 100644 index 2d58160..0000000 --- a/test/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -macro(test prefix) - 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_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) -test(aes128cbc) -test(aes128cfb) -test(aes128ofb) -test(aes128ctr) -test(aes192ecb) -test(aes192cbc) -test(aes192cfb) -test(aes192ofb) -test(aes192ctr) -test(aes256ecb) -test(aes256cbc) -test(aes256cfb) -test(aes256ofb) -test(aes256ctr) - -find_package(Boost REQUIRED COMPONENTS program_options) - -add_executable(test_aes_encrypt_block aes_encrypt_block.cpp aes_common.hpp) -target_include_directories(test_aes_encrypt_block PRIVATE ${Boost_INCLUDE_DIRS}) -target_link_libraries(test_aes_encrypt_block libaesni libaesnixx ${Boost_LIBRARIES}) -set_target_properties(test_aes_encrypt_block PROPERTIES OUTPUT_NAME aes_encrypt_block) - -add_executable(test_aes_decrypt_block aes_decrypt_block.cpp aes_common.hpp) -target_include_directories(test_aes_decrypt_block PRIVATE ${Boost_INCLUDE_DIRS}) -target_link_libraries(test_aes_decrypt_block libaesni libaesnixx ${Boost_LIBRARIES}) -set_target_properties(test_aes_decrypt_block PROPERTIES OUTPUT_NAME aes_decrypt_block) diff --git a/test/README.md b/test/README.md index e05b840..7b3b128 100644 --- a/test/README.md +++ b/test/README.md @@ -41,11 +41,11 @@ Use `--help` to see the script's usage details. To test the implementation against the vectors from [NIST SP 800-38A](http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf) using `nist-sp-800-32a.py`. - python nist-sp-800-38a.py -p C:\build\test\Debug + python nist-sp-800-38a.py -p C:\build\utils\block\cxx\Debug ### Cryptographic Algorithm Validation Program To test the implementation against the vectors from [CAVP](http://csrc.nist.gov/groups/STM/cavp/) using `cavp.py`. The AES Known Answer Test (KAT) Vectors are used and read from `KAT_AES.zip`. - python cavp.py -p C:\build\test\Debug + python cavp.py -p C:\build\utils\block\cxx\Debug diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index d13bdeb..ce18593 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -1,30 +1,2 @@ -macro(util prefix) - add_executable(util_${prefix} ${prefix}.cpp) - target_link_libraries(util_${prefix} libaesnixx libaesni) - set_target_properties(util_${prefix} PROPERTIES OUTPUT_NAME ${prefix}) -endmacro() - -util(aes128ecb_encrypt_file) -util(aes128ecb_decrypt_file) - -find_package(Boost REQUIRED COMPONENTS program_options) - -add_executable(util_aes_encrypt_file aes_encrypt_file.cpp aes_common.hpp) -target_include_directories(util_aes_encrypt_file PRIVATE ${Boost_INCLUDE_DIRS}) -target_link_libraries(util_aes_encrypt_file libaesni libaesnixx ${Boost_LIBRARIES}) -set_target_properties(util_aes_encrypt_file PROPERTIES OUTPUT_NAME aes_encrypt_file) - -add_executable(util_aes_decrypt_file aes_decrypt_file.cpp aes_common.hpp) -target_include_directories(util_aes_decrypt_file PRIVATE ${Boost_INCLUDE_DIRS}) -target_link_libraries(util_aes_decrypt_file libaesni libaesnixx ${Boost_LIBRARIES}) -set_target_properties(util_aes_decrypt_file PROPERTIES OUTPUT_NAME aes_decrypt_file) - -add_executable(util_aes_encrypt_bmp aes_encrypt_bmp.cpp aes_common.hpp) -target_include_directories(util_aes_encrypt_bmp PRIVATE ${Boost_INCLUDE_DIRS}) -target_link_libraries(util_aes_encrypt_bmp libaesni libaesnixx ${Boost_LIBRARIES}) -set_target_properties(util_aes_encrypt_bmp PROPERTIES OUTPUT_NAME aes_encrypt_bmp) - -add_executable(util_aes_decrypt_bmp aes_decrypt_bmp.cpp aes_common.hpp) -target_include_directories(util_aes_decrypt_bmp PRIVATE ${Boost_INCLUDE_DIRS}) -target_link_libraries(util_aes_decrypt_bmp libaesni libaesnixx ${Boost_LIBRARIES}) -set_target_properties(util_aes_decrypt_bmp PROPERTIES OUTPUT_NAME aes_decrypt_bmp) +add_subdirectory(block) +add_subdirectory(file) diff --git a/utils/block/CMakeLists.txt b/utils/block/CMakeLists.txt new file mode 100644 index 0000000..4b232bd --- /dev/null +++ b/utils/block/CMakeLists.txt @@ -0,0 +1,27 @@ +macro(util prefix) + add_executable(util_${prefix}_encrypt_block ${prefix}_encrypt_block.c) + target_link_libraries(util_${prefix}_encrypt_block libaesni) + set_target_properties(util_${prefix}_encrypt_block PROPERTIES OUTPUT_NAME ${prefix}_encrypt_block) + + add_executable(util_${prefix}_decrypt_block ${prefix}_decrypt_block.c) + target_link_libraries(util_${prefix}_decrypt_block libaesni) + set_target_properties(util_${prefix}_decrypt_block PROPERTIES OUTPUT_NAME ${prefix}_decrypt_block) +endmacro() + +util(aes128ecb) +util(aes128cbc) +util(aes128cfb) +util(aes128ofb) +util(aes128ctr) +util(aes192ecb) +util(aes192cbc) +util(aes192cfb) +util(aes192ofb) +util(aes192ctr) +util(aes256ecb) +util(aes256cbc) +util(aes256cfb) +util(aes256ofb) +util(aes256ctr) + +add_subdirectory(cxx) diff --git a/test/aes128cbc_decrypt_block.c b/utils/block/aes128cbc_decrypt_block.c index 95120e7..95120e7 100644 --- a/test/aes128cbc_decrypt_block.c +++ b/utils/block/aes128cbc_decrypt_block.c diff --git a/test/aes128cbc_encrypt_block.c b/utils/block/aes128cbc_encrypt_block.c index 68f95a3..68f95a3 100644 --- a/test/aes128cbc_encrypt_block.c +++ b/utils/block/aes128cbc_encrypt_block.c diff --git a/test/aes128cfb_decrypt_block.c b/utils/block/aes128cfb_decrypt_block.c index ef68e44..ef68e44 100644 --- a/test/aes128cfb_decrypt_block.c +++ b/utils/block/aes128cfb_decrypt_block.c diff --git a/test/aes128cfb_encrypt_block.c b/utils/block/aes128cfb_encrypt_block.c index 6f8fb4d..6f8fb4d 100644 --- a/test/aes128cfb_encrypt_block.c +++ b/utils/block/aes128cfb_encrypt_block.c diff --git a/test/aes128ctr_decrypt_block.c b/utils/block/aes128ctr_decrypt_block.c index 85d07f5..85d07f5 100644 --- a/test/aes128ctr_decrypt_block.c +++ b/utils/block/aes128ctr_decrypt_block.c diff --git a/test/aes128ctr_encrypt_block.c b/utils/block/aes128ctr_encrypt_block.c index a62f3cd..a62f3cd 100644 --- a/test/aes128ctr_encrypt_block.c +++ b/utils/block/aes128ctr_encrypt_block.c diff --git a/test/aes128ecb_decrypt_block.c b/utils/block/aes128ecb_decrypt_block.c index 9fbf26d..9fbf26d 100644 --- a/test/aes128ecb_decrypt_block.c +++ b/utils/block/aes128ecb_decrypt_block.c diff --git a/test/aes128ecb_encrypt_block.c b/utils/block/aes128ecb_encrypt_block.c index 45a1123..45a1123 100644 --- a/test/aes128ecb_encrypt_block.c +++ b/utils/block/aes128ecb_encrypt_block.c diff --git a/test/aes128ofb_decrypt_block.c b/utils/block/aes128ofb_decrypt_block.c index e61e70f..e61e70f 100644 --- a/test/aes128ofb_decrypt_block.c +++ b/utils/block/aes128ofb_decrypt_block.c diff --git a/test/aes128ofb_encrypt_block.c b/utils/block/aes128ofb_encrypt_block.c index 6613ca9..6613ca9 100644 --- a/test/aes128ofb_encrypt_block.c +++ b/utils/block/aes128ofb_encrypt_block.c diff --git a/test/aes192cbc_decrypt_block.c b/utils/block/aes192cbc_decrypt_block.c index 13edbe4..13edbe4 100644 --- a/test/aes192cbc_decrypt_block.c +++ b/utils/block/aes192cbc_decrypt_block.c diff --git a/test/aes192cbc_encrypt_block.c b/utils/block/aes192cbc_encrypt_block.c index d89c12d..d89c12d 100644 --- a/test/aes192cbc_encrypt_block.c +++ b/utils/block/aes192cbc_encrypt_block.c diff --git a/test/aes192cfb_decrypt_block.c b/utils/block/aes192cfb_decrypt_block.c index cedc7d0..cedc7d0 100644 --- a/test/aes192cfb_decrypt_block.c +++ b/utils/block/aes192cfb_decrypt_block.c diff --git a/test/aes192cfb_encrypt_block.c b/utils/block/aes192cfb_encrypt_block.c index 357df8d..357df8d 100644 --- a/test/aes192cfb_encrypt_block.c +++ b/utils/block/aes192cfb_encrypt_block.c diff --git a/test/aes192ctr_decrypt_block.c b/utils/block/aes192ctr_decrypt_block.c index b094964..b094964 100644 --- a/test/aes192ctr_decrypt_block.c +++ b/utils/block/aes192ctr_decrypt_block.c diff --git a/test/aes192ctr_encrypt_block.c b/utils/block/aes192ctr_encrypt_block.c index 977c7bf..977c7bf 100644 --- a/test/aes192ctr_encrypt_block.c +++ b/utils/block/aes192ctr_encrypt_block.c diff --git a/test/aes192ecb_decrypt_block.c b/utils/block/aes192ecb_decrypt_block.c index 29e7274..29e7274 100644 --- a/test/aes192ecb_decrypt_block.c +++ b/utils/block/aes192ecb_decrypt_block.c diff --git a/test/aes192ecb_encrypt_block.c b/utils/block/aes192ecb_encrypt_block.c index a74759c..a74759c 100644 --- a/test/aes192ecb_encrypt_block.c +++ b/utils/block/aes192ecb_encrypt_block.c diff --git a/test/aes192ofb_decrypt_block.c b/utils/block/aes192ofb_decrypt_block.c index eaa9d2a..eaa9d2a 100644 --- a/test/aes192ofb_decrypt_block.c +++ b/utils/block/aes192ofb_decrypt_block.c diff --git a/test/aes192ofb_encrypt_block.c b/utils/block/aes192ofb_encrypt_block.c index fed0c5a..fed0c5a 100644 --- a/test/aes192ofb_encrypt_block.c +++ b/utils/block/aes192ofb_encrypt_block.c diff --git a/test/aes256cbc_decrypt_block.c b/utils/block/aes256cbc_decrypt_block.c index 0021007..0021007 100644 --- a/test/aes256cbc_decrypt_block.c +++ b/utils/block/aes256cbc_decrypt_block.c diff --git a/test/aes256cbc_encrypt_block.c b/utils/block/aes256cbc_encrypt_block.c index e01ab95..e01ab95 100644 --- a/test/aes256cbc_encrypt_block.c +++ b/utils/block/aes256cbc_encrypt_block.c diff --git a/test/aes256cfb_decrypt_block.c b/utils/block/aes256cfb_decrypt_block.c index 9d320a5..9d320a5 100644 --- a/test/aes256cfb_decrypt_block.c +++ b/utils/block/aes256cfb_decrypt_block.c diff --git a/test/aes256cfb_encrypt_block.c b/utils/block/aes256cfb_encrypt_block.c index 94e8619..94e8619 100644 --- a/test/aes256cfb_encrypt_block.c +++ b/utils/block/aes256cfb_encrypt_block.c diff --git a/test/aes256ctr_decrypt_block.c b/utils/block/aes256ctr_decrypt_block.c index a0f9ef0..a0f9ef0 100644 --- a/test/aes256ctr_decrypt_block.c +++ b/utils/block/aes256ctr_decrypt_block.c diff --git a/test/aes256ctr_encrypt_block.c b/utils/block/aes256ctr_encrypt_block.c index fbae884..fbae884 100644 --- a/test/aes256ctr_encrypt_block.c +++ b/utils/block/aes256ctr_encrypt_block.c diff --git a/test/aes256ecb_decrypt_block.c b/utils/block/aes256ecb_decrypt_block.c index 16ffe77..16ffe77 100644 --- a/test/aes256ecb_decrypt_block.c +++ b/utils/block/aes256ecb_decrypt_block.c diff --git a/test/aes256ecb_encrypt_block.c b/utils/block/aes256ecb_encrypt_block.c index 01ae7ed..01ae7ed 100644 --- a/test/aes256ecb_encrypt_block.c +++ b/utils/block/aes256ecb_encrypt_block.c diff --git a/test/aes256ofb_decrypt_block.c b/utils/block/aes256ofb_decrypt_block.c index a57c8db..a57c8db 100644 --- a/test/aes256ofb_decrypt_block.c +++ b/utils/block/aes256ofb_decrypt_block.c diff --git a/test/aes256ofb_encrypt_block.c b/utils/block/aes256ofb_encrypt_block.c index 7dc01b8..7dc01b8 100644 --- a/test/aes256ofb_encrypt_block.c +++ b/utils/block/aes256ofb_encrypt_block.c diff --git a/utils/block/cxx/CMakeLists.txt b/utils/block/cxx/CMakeLists.txt new file mode 100644 index 0000000..8df91d0 --- /dev/null +++ b/utils/block/cxx/CMakeLists.txt @@ -0,0 +1,11 @@ +find_package(Boost REQUIRED COMPONENTS program_options) + +add_executable(util_aes_encrypt_block aes_encrypt_block.cpp aes_common.hpp) +target_include_directories(util_aes_encrypt_block PRIVATE ${Boost_INCLUDE_DIRS}) +target_link_libraries(util_aes_encrypt_block libaesni libaesnixx ${Boost_LIBRARIES}) +set_target_properties(util_aes_encrypt_block PROPERTIES OUTPUT_NAME aes_encrypt_block) + +add_executable(util_aes_decrypt_block aes_decrypt_block.cpp aes_common.hpp) +target_include_directories(util_aes_decrypt_block PRIVATE ${Boost_INCLUDE_DIRS}) +target_link_libraries(util_aes_decrypt_block libaesni libaesnixx ${Boost_LIBRARIES}) +set_target_properties(util_aes_decrypt_block PROPERTIES OUTPUT_NAME aes_decrypt_block) diff --git a/utils/block/cxx/README.md b/utils/block/cxx/README.md new file mode 100644 index 0000000..bce2434 --- /dev/null +++ b/utils/block/cxx/README.md @@ -0,0 +1,60 @@ +# Block encryption utilities + +Here are a couple of useful block encryption utilities built on top of the library. +Each of the utilities accepts `--help` flag, which can be used to examine utility's usage info. + +On older CPUs, you can run the utilities [using Intel SDE](https://github.com/egor-tensin/aesni#running-on-older-cpus). + +## aes_encrypt_block.exe + +Encrypts 16-byte blocks using AES-128/192/256 in the specified mode of operation. + +### Usage examples + +For example, to encrypt + +* the plaintext block `0x00112233445566778899aabbccddeeff` +* using AES-128 in ECB mode +* with key `0x000102030405060708090a0b0c0d0e0f`, + +run: + + aes_encrypt_block.exe -a aes128 -m ecb 000102030405060708090a0b0c0d0e0f 00112233445566778899aabbccddeeff + +To encrypt + +* the plaintext block `0x00112233445566778899aabbccddeeff` +* using AES-192 in OFB mode +* with initialization vector `0x22222222222222222222222222222222` +* and key `0x000102030405060708090a0b0c0d0e0f101112131415161718`, + +run: + + aes_encrypt_block.exe -a aes192 -m ofb 000102030405060708090a0b0c0d0e0f101112131415161718 22222222222222222222222222222222 00112233445566778899aabbccddeeff + +## aes_decrypt_block.exe + +Decrypts 16-byte blocks using AES-128/192/256 in the specified mode of operation. + +### Usage examples + +For example, to decrypt + +* the ciphertext block `0x69c4e0d86a7b0430d8cdb78070b4c55a` +* using AES-128 in ECB mode +* with key `0x000102030405060708090a0b0c0d0e0f`, + +run: + + aes_decrypt_block.exe -a aes128 -m ecb 000102030405060708090a0b0c0d0e0f 69c4e0d86a7b0430d8cdb78070b4c55a + +To decrypt + +* the ciphertext block `0x762a5ab50929189cefdb99434790aad8` +* using AES-192 in OFB mode +* with initialization vector `0x22222222222222222222222222222222` +* and key `0x000102030405060708090a0b0c0d0e0f101112131415161718`, + +run: + + aes_decrypt_block.exe -a aes192 -m ofb 000102030405060708090a0b0c0d0e0f101112131415161718 22222222222222222222222222222222 bda298884f5c3a9eb7068aa7063a3b75 diff --git a/test/aes_common.hpp b/utils/block/cxx/aes_common.hpp index 78126e5..78126e5 100644 --- a/test/aes_common.hpp +++ b/utils/block/cxx/aes_common.hpp diff --git a/test/aes_decrypt_block.cpp b/utils/block/cxx/aes_decrypt_block.cpp index 9898d4e..9898d4e 100644 --- a/test/aes_decrypt_block.cpp +++ b/utils/block/cxx/aes_decrypt_block.cpp diff --git a/test/aes_encrypt_block.cpp b/utils/block/cxx/aes_encrypt_block.cpp index 9458831..9458831 100644 --- a/test/aes_encrypt_block.cpp +++ b/utils/block/cxx/aes_encrypt_block.cpp diff --git a/utils/file/CMakeLists.txt b/utils/file/CMakeLists.txt new file mode 100644 index 0000000..ad949f7 --- /dev/null +++ b/utils/file/CMakeLists.txt @@ -0,0 +1,10 @@ +macro(util prefix) + add_executable(util_${prefix} ${prefix}.cpp) + target_link_libraries(util_${prefix} libaesnixx libaesni) + set_target_properties(util_${prefix} PROPERTIES OUTPUT_NAME ${prefix}) +endmacro() + +util(aes128ecb_encrypt_file) +util(aes128ecb_decrypt_file) + +add_subdirectory(cxx) diff --git a/utils/aes128ecb_decrypt_file.cpp b/utils/file/aes128ecb_decrypt_file.cpp index 9b8b15c..9b8b15c 100644 --- a/utils/aes128ecb_decrypt_file.cpp +++ b/utils/file/aes128ecb_decrypt_file.cpp diff --git a/utils/aes128ecb_encrypt_file.cpp b/utils/file/aes128ecb_encrypt_file.cpp index a43c4d9..a43c4d9 100644 --- a/utils/aes128ecb_encrypt_file.cpp +++ b/utils/file/aes128ecb_encrypt_file.cpp diff --git a/utils/file/cxx/CMakeLists.txt b/utils/file/cxx/CMakeLists.txt new file mode 100644 index 0000000..75895a0 --- /dev/null +++ b/utils/file/cxx/CMakeLists.txt @@ -0,0 +1,21 @@ +find_package(Boost REQUIRED COMPONENTS program_options) + +add_executable(util_aes_encrypt_file aes_encrypt_file.cpp aes_common.hpp) +target_include_directories(util_aes_encrypt_file PRIVATE ${Boost_INCLUDE_DIRS}) +target_link_libraries(util_aes_encrypt_file libaesni libaesnixx ${Boost_LIBRARIES}) +set_target_properties(util_aes_encrypt_file PROPERTIES OUTPUT_NAME aes_encrypt_file) + +add_executable(util_aes_decrypt_file aes_decrypt_file.cpp aes_common.hpp) +target_include_directories(util_aes_decrypt_file PRIVATE ${Boost_INCLUDE_DIRS}) +target_link_libraries(util_aes_decrypt_file libaesni libaesnixx ${Boost_LIBRARIES}) +set_target_properties(util_aes_decrypt_file PROPERTIES OUTPUT_NAME aes_decrypt_file) + +add_executable(util_aes_encrypt_bmp aes_encrypt_bmp.cpp aes_common.hpp) +target_include_directories(util_aes_encrypt_bmp PRIVATE ${Boost_INCLUDE_DIRS}) +target_link_libraries(util_aes_encrypt_bmp libaesni libaesnixx ${Boost_LIBRARIES}) +set_target_properties(util_aes_encrypt_bmp PROPERTIES OUTPUT_NAME aes_encrypt_bmp) + +add_executable(util_aes_decrypt_bmp aes_decrypt_bmp.cpp aes_common.hpp) +target_include_directories(util_aes_decrypt_bmp PRIVATE ${Boost_INCLUDE_DIRS}) +target_link_libraries(util_aes_decrypt_bmp libaesni libaesnixx ${Boost_LIBRARIES}) +set_target_properties(util_aes_decrypt_bmp PROPERTIES OUTPUT_NAME aes_decrypt_bmp) diff --git a/utils/README.md b/utils/file/cxx/README.md index ec23774..bf79cb2 100644 --- a/utils/README.md +++ b/utils/file/cxx/README.md @@ -1,6 +1,6 @@ -# Utilities +# File encryption utilities -Here are a couple of useful utilities built on top of the library. +Here are a couple of useful file encryption utilities built on top of the library. Each of the utilities accepts `--help` flag, which can be used to examine utility's usage info. The included utilities are: diff --git a/utils/aes_common.hpp b/utils/file/cxx/aes_common.hpp index c15565f..c15565f 100644 --- a/utils/aes_common.hpp +++ b/utils/file/cxx/aes_common.hpp diff --git a/utils/aes_decrypt_bmp.cpp b/utils/file/cxx/aes_decrypt_bmp.cpp index 85dffe5..85dffe5 100644 --- a/utils/aes_decrypt_bmp.cpp +++ b/utils/file/cxx/aes_decrypt_bmp.cpp diff --git a/utils/aes_decrypt_file.cpp b/utils/file/cxx/aes_decrypt_file.cpp index af0d119..af0d119 100644 --- a/utils/aes_decrypt_file.cpp +++ b/utils/file/cxx/aes_decrypt_file.cpp diff --git a/utils/aes_encrypt_bmp.cpp b/utils/file/cxx/aes_encrypt_bmp.cpp index cf55b0b..cf55b0b 100644 --- a/utils/aes_encrypt_bmp.cpp +++ b/utils/file/cxx/aes_encrypt_bmp.cpp diff --git a/utils/aes_encrypt_file.cpp b/utils/file/cxx/aes_encrypt_file.cpp index 0b367d9..0b367d9 100644 --- a/utils/aes_encrypt_file.cpp +++ b/utils/file/cxx/aes_encrypt_file.cpp diff --git a/utils/bmp/butterfly.bmp b/utils/file/cxx/bmp/butterfly.bmp Binary files differindex 105a55a..105a55a 100644 --- a/utils/bmp/butterfly.bmp +++ b/utils/file/cxx/bmp/butterfly.bmp diff --git a/utils/bmp/cipherfly_cbc.bmp b/utils/file/cxx/bmp/cipherfly_cbc.bmp Binary files differindex 664b557..664b557 100644 --- a/utils/bmp/cipherfly_cbc.bmp +++ b/utils/file/cxx/bmp/cipherfly_cbc.bmp diff --git a/utils/bmp/cipherfly_ecb.bmp b/utils/file/cxx/bmp/cipherfly_ecb.bmp Binary files differindex 78de9a8..78de9a8 100644 --- a/utils/bmp/cipherfly_ecb.bmp +++ b/utils/file/cxx/bmp/cipherfly_ecb.bmp |