diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2015-07-07 17:04:48 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2015-07-07 17:04:48 +0300 |
commit | 1bafa86f2f7b1019314b5629f4fd80c7cf9c837c (patch) | |
tree | 9601e8dcc4b3b7d9e76fe398c3d0aa61325ee1bb | |
parent | code style (diff) | |
download | aes-tools-1bafa86f2f7b1019314b5629f4fd80c7cf9c837c.tar.gz aes-tools-1bafa86f2f7b1019314b5629f4fd80c7cf9c837c.zip |
utils: rearrange files
Diffstat (limited to '')
-rw-r--r-- | README.md | 8 | ||||
-rw-r--r-- | utils/CMakeLists.txt | 33 | ||||
-rw-r--r-- | utils/README.md (renamed from utils/file/README.md) | 63 | ||||
-rw-r--r-- | utils/aes_block_common.hpp (renamed from utils/block/aes_common.hpp) | 0 | ||||
-rw-r--r-- | utils/aes_decrypt_block.cpp (renamed from utils/block/aes_decrypt_block.cpp) | 2 | ||||
-rw-r--r-- | utils/aes_decrypt_bmp.cpp (renamed from utils/file/aes_decrypt_bmp.cpp) | 2 | ||||
-rw-r--r-- | utils/aes_decrypt_file.cpp (renamed from utils/file/aes_decrypt_file.cpp) | 2 | ||||
-rw-r--r-- | utils/aes_encrypt_block.cpp (renamed from utils/block/aes_encrypt_block.cpp) | 2 | ||||
-rw-r--r-- | utils/aes_encrypt_bmp.cpp (renamed from utils/file/aes_encrypt_bmp.cpp) | 2 | ||||
-rw-r--r-- | utils/aes_encrypt_file.cpp (renamed from utils/file/aes_encrypt_file.cpp) | 2 | ||||
-rw-r--r-- | utils/aes_file_common.hpp (renamed from utils/file/aes_common.hpp) | 0 | ||||
-rw-r--r-- | utils/block/CMakeLists.txt | 11 | ||||
-rw-r--r-- | utils/block/README.md | 60 | ||||
-rw-r--r-- | utils/bmp/butterfly.bmp (renamed from utils/file/bmp/butterfly.bmp) | bin | 503370 -> 503370 bytes | |||
-rw-r--r-- | utils/bmp/cipherfly_cbc.bmp (renamed from utils/file/bmp/cipherfly_cbc.bmp) | bin | 503382 -> 503382 bytes | |||
-rw-r--r-- | utils/bmp/cipherfly_ecb.bmp (renamed from utils/file/bmp/cipherfly_ecb.bmp) | bin | 503382 -> 503382 bytes | |||
-rw-r--r-- | utils/file/CMakeLists.txt | 21 |
17 files changed, 97 insertions, 111 deletions
@@ -16,14 +16,6 @@ To enable CMake to find Boost libraries, pass the path to the root Boost directo Remember that in order to link to the static Boost libraries, you also have to pass `-D Boost_USE_STATIC_LIBS=ON` to CMake. -## Utilities - -A couple of useful utilities built on top of the library are included. -Namely, - -* [the file encryption utilities](utils/file#file-encryption-utilities), -* and [the block encryption utilities](utils/block#block-encryption-utilities) (used mainly for testing). - ## Running on older CPUs To run the executables that are using the AES-NI instruction set on a CPU w/o the support for these instructions, one can use diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index ce18593..e4a768a 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -1,2 +1,31 @@ -add_subdirectory(block) -add_subdirectory(file) +find_package(Boost REQUIRED COMPONENTS program_options) + +add_executable(util_aes_encrypt_block aes_encrypt_block.cpp aes_block_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_block_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) + +add_executable(util_aes_encrypt_file aes_encrypt_file.cpp aes_file_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_file_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_file_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_file_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/file/README.md b/utils/README.md index bf79cb2..47db570 100644 --- a/utils/file/README.md +++ b/utils/README.md @@ -1,15 +1,72 @@ -# File encryption utilities +# Utilities -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. +Here are a couple of useful utilities built on top of the library. +Each of the utilities accepts the `--help` flag, which can be used to examine utility's usage info. The included utilities are: +* [block encryption](#block-encryption) utilities, * [file encryption](#file-encryption) utilities, * and [bitmap encryption](#bitmap-encryption) utilities. +## Block encryption + 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 + ## File encryption ### aes_encrypt_file.exe diff --git a/utils/block/aes_common.hpp b/utils/aes_block_common.hpp index 327efad..327efad 100644 --- a/utils/block/aes_common.hpp +++ b/utils/aes_block_common.hpp diff --git a/utils/block/aes_decrypt_block.cpp b/utils/aes_decrypt_block.cpp index a8a39f4..778aecb 100644 --- a/utils/block/aes_decrypt_block.cpp +++ b/utils/aes_decrypt_block.cpp @@ -6,7 +6,7 @@ * See LICENSE.txt for details. */ -#include "aes_common.hpp" +#include "aes_block_common.hpp" #include <aesni/all.h> diff --git a/utils/file/aes_decrypt_bmp.cpp b/utils/aes_decrypt_bmp.cpp index 85dffe5..b9f669e 100644 --- a/utils/file/aes_decrypt_bmp.cpp +++ b/utils/aes_decrypt_bmp.cpp @@ -6,7 +6,7 @@ * See LICENSE.txt for details. */ -#include "aes_common.hpp" +#include "aes_file_common.hpp" #include <aesni/all.h> diff --git a/utils/file/aes_decrypt_file.cpp b/utils/aes_decrypt_file.cpp index e2da979..650ca5e 100644 --- a/utils/file/aes_decrypt_file.cpp +++ b/utils/aes_decrypt_file.cpp @@ -6,7 +6,7 @@ * See LICENSE.txt for details. */ -#include "aes_common.hpp" +#include "aes_file_common.hpp" #include <aesni/all.h> diff --git a/utils/block/aes_encrypt_block.cpp b/utils/aes_encrypt_block.cpp index 3b0e837..89e935b 100644 --- a/utils/block/aes_encrypt_block.cpp +++ b/utils/aes_encrypt_block.cpp @@ -6,7 +6,7 @@ * See LICENSE.txt for details. */ -#include "aes_common.hpp" +#include "aes_block_common.hpp" #include <aesni/all.h> diff --git a/utils/file/aes_encrypt_bmp.cpp b/utils/aes_encrypt_bmp.cpp index cf55b0b..f36cfb0 100644 --- a/utils/file/aes_encrypt_bmp.cpp +++ b/utils/aes_encrypt_bmp.cpp @@ -6,7 +6,7 @@ * See LICENSE.txt for details. */ -#include "aes_common.hpp" +#include "aes_file_common.hpp" #include <aesni/all.h> diff --git a/utils/file/aes_encrypt_file.cpp b/utils/aes_encrypt_file.cpp index ff6753f..93b7cbd 100644 --- a/utils/file/aes_encrypt_file.cpp +++ b/utils/aes_encrypt_file.cpp @@ -6,7 +6,7 @@ * See LICENSE.txt for details. */ -#include "aes_common.hpp" +#include "aes_file_common.hpp" #include <aesni/all.h> diff --git a/utils/file/aes_common.hpp b/utils/aes_file_common.hpp index 28e16df..28e16df 100644 --- a/utils/file/aes_common.hpp +++ b/utils/aes_file_common.hpp diff --git a/utils/block/CMakeLists.txt b/utils/block/CMakeLists.txt deleted file mode 100644 index 8df91d0..0000000 --- a/utils/block/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -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/README.md b/utils/block/README.md deleted file mode 100644 index bce2434..0000000 --- a/utils/block/README.md +++ /dev/null @@ -1,60 +0,0 @@ -# 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/utils/file/bmp/butterfly.bmp b/utils/bmp/butterfly.bmp Binary files differindex 105a55a..105a55a 100644 --- a/utils/file/bmp/butterfly.bmp +++ b/utils/bmp/butterfly.bmp diff --git a/utils/file/bmp/cipherfly_cbc.bmp b/utils/bmp/cipherfly_cbc.bmp Binary files differindex 664b557..664b557 100644 --- a/utils/file/bmp/cipherfly_cbc.bmp +++ b/utils/bmp/cipherfly_cbc.bmp diff --git a/utils/file/bmp/cipherfly_ecb.bmp b/utils/bmp/cipherfly_ecb.bmp Binary files differindex 78de9a8..78de9a8 100644 --- a/utils/file/bmp/cipherfly_ecb.bmp +++ b/utils/bmp/cipherfly_ecb.bmp diff --git a/utils/file/CMakeLists.txt b/utils/file/CMakeLists.txt deleted file mode 100644 index 75895a0..0000000 --- a/utils/file/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -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) |