diff options
Diffstat (limited to '')
-rw-r--r-- | utils/block_cmd_parser.hpp | 16 | ||||
-rw-r--r-- | utils/block_dumper.hpp | 64 |
2 files changed, 40 insertions, 40 deletions
diff --git a/utils/block_cmd_parser.hpp b/utils/block_cmd_parser.hpp index db6da84..c343152 100644 --- a/utils/block_cmd_parser.hpp +++ b/utils/block_cmd_parser.hpp @@ -30,15 +30,15 @@ namespace class Settings { public: - aesni::Algorithm get_algorithm() const { return algorithm; } - aesni::Mode get_mode() const { return mode; } + aes::Algorithm get_algorithm() const { return algorithm; } + aes::Mode get_mode() const { return mode; } bool use_boxes() const { return use_boxes_flag; } bool verbose() const { return verbose_flag; } private: - aesni::Algorithm algorithm; - aesni::Mode mode; + aes::Algorithm algorithm; + aes::Mode mode; bool use_boxes_flag = false; bool verbose_flag = false; @@ -61,8 +61,8 @@ namespace options.add_options() ("help,h", "show this message and exit") ("use-boxes,b", po::bool_switch(&settings.use_boxes_flag)->default_value(false), "use the \"boxes\" interface") - ("mode,m", po::value<aesni::Mode>(&settings.mode)->required(), "set mode of operation") - ("algorithm,a", po::value<aesni::Algorithm>(&settings.algorithm)->required(), "set algorithm") + ("mode,m", po::value<aes::Mode>(&settings.mode)->required(), "set mode of operation") + ("algorithm,a", po::value<aes::Algorithm>(&settings.algorithm)->required(), "set algorithm") ("verbose,v", po::bool_switch(&settings.verbose_flag)->default_value(false), "enable verbose output"); std::vector<std::string> args; @@ -112,7 +112,7 @@ namespace std::string iv_string; - if (aesni::mode_requires_initialization_vector(settings.get_mode())) + if (aes::mode_requires_initialization_vector(settings.get_mode())) { if (args.empty()) { @@ -137,7 +137,7 @@ namespace args.pop_front(); } - if (aesni::mode_requires_initialization_vector(settings.get_mode())) + if (aes::mode_requires_initialization_vector(settings.get_mode())) { inputs.emplace_back( std::move(key_string), diff --git a/utils/block_dumper.hpp b/utils/block_dumper.hpp index f41018d..d2b76bf 100644 --- a/utils/block_dumper.hpp +++ b/utils/block_dumper.hpp @@ -17,92 +17,92 @@ namespace { - template <aesni::Algorithm algorithm> - void dump_block(const char* name, const typename aesni::Types<algorithm>::Block& block) + template <aes::Algorithm algorithm> + void dump_block(const char* name, const typename aes::Types<algorithm>::Block& block) { - std::cout << name << ": " << aesni::to_string<algorithm>(block) << "\n" << aesni::to_matrix_string<algorithm>(block) << "\n"; + std::cout << name << ": " << aes::to_string<algorithm>(block) << "\n" << aes::to_matrix_string<algorithm>(block) << "\n"; } - template <aesni::Algorithm algorithm> - void dump_plaintext(const typename aesni::Types<algorithm>::Block& block) + template <aes::Algorithm algorithm> + void dump_plaintext(const typename aes::Types<algorithm>::Block& block) { dump_block<algorithm>("Plaintext", block); } - template <aesni::Algorithm algorithm> - void dump_key(const typename aesni::Types<algorithm>::Key& key) + template <aes::Algorithm algorithm> + void dump_key(const typename aes::Types<algorithm>::Key& key) { - std::cout << "Key: " << aesni::to_string<algorithm>(key) << "\n\n"; + std::cout << "Key: " << aes::to_string<algorithm>(key) << "\n\n"; } - template <aesni::Algorithm algorithm> - void dump_ciphertext(const typename aesni::Types<algorithm>::Block& ciphertext) + template <aes::Algorithm algorithm> + void dump_ciphertext(const typename aes::Types<algorithm>::Block& ciphertext) { dump_block<algorithm>("Ciphertext", ciphertext); } - template <aesni::Algorithm algorithm> - void dump_iv(const typename aesni::Types<algorithm>::Block& iv) + template <aes::Algorithm algorithm> + void dump_iv(const typename aes::Types<algorithm>::Block& iv) { dump_block<algorithm>("Initialization vector", iv); } - template <aesni::Algorithm algorithm> - void dump_round_keys(const char* name, const typename aesni::Types<algorithm>::RoundKeys& round_keys) + template <aes::Algorithm algorithm> + void dump_round_keys(const char* name, const typename aes::Types<algorithm>::RoundKeys& round_keys) { std::cout << name << ":\n"; - for (std::size_t i = 0; i < aesni::get_number_of_rounds<algorithm>(); ++i) - std::cout << "\t[" << i << "]: " << aesni::to_string<algorithm>(round_keys.keys[i]) << "\n"; + for (std::size_t i = 0; i < aes::get_number_of_rounds<algorithm>(); ++i) + std::cout << "\t[" << i << "]: " << aes::to_string<algorithm>(round_keys.keys[i]) << "\n"; std::cout << "\n"; } - template <aesni::Algorithm algorithm> - void dump_encryption_keys(const typename aesni::Types<algorithm>::RoundKeys& round_keys) + template <aes::Algorithm algorithm> + void dump_encryption_keys(const typename aes::Types<algorithm>::RoundKeys& round_keys) { dump_round_keys<algorithm>("Encryption round keys", round_keys); } - template <aesni::Algorithm algorithm> - void dump_decryption_keys(const typename aesni::Types<algorithm>::RoundKeys& round_keys) + template <aes::Algorithm algorithm> + void dump_decryption_keys(const typename aes::Types<algorithm>::RoundKeys& round_keys) { dump_round_keys<algorithm>("Decryption round keys", round_keys); } - template <aesni::Algorithm algorithm, aesni::Mode mode> + template <aes::Algorithm algorithm, aes::Mode mode> void dump_wrapper( - const aesni::EncryptWrapper<algorithm, mode>& wrapper) + const aes::EncryptWrapper<algorithm, mode>& wrapper) { dump_encryption_keys<algorithm>(wrapper.encryption_keys); } - template <aesni::Algorithm algorithm, aesni::Mode mode> + template <aes::Algorithm algorithm, aes::Mode mode> void dump_wrapper( - const aesni::DecryptWrapper<algorithm, mode>& wrapper) + const aes::DecryptWrapper<algorithm, mode>& wrapper) { dump_decryption_keys<algorithm>(wrapper.decryption_keys); } - template <aesni::Algorithm algorithm, aesni::Mode mode, typename std::enable_if<aesni::ModeRequiresInitializationVector<mode>::value>::type* = 0> + template <aes::Algorithm algorithm, aes::Mode mode, typename std::enable_if<aes::ModeRequiresInitializationVector<mode>::value>::type* = 0> void dump_next_iv( - const aesni::EncryptWrapper<algorithm, mode>& wrapper) + const aes::EncryptWrapper<algorithm, mode>& wrapper) { dump_block<algorithm>("Next initialization vector", wrapper.iv); } - template <aesni::Algorithm algorithm, aesni::Mode mode, typename std::enable_if<!aesni::ModeRequiresInitializationVector<mode>::value>::type* = 0> + template <aes::Algorithm algorithm, aes::Mode mode, typename std::enable_if<!aes::ModeRequiresInitializationVector<mode>::value>::type* = 0> void dump_next_iv( - const aesni::EncryptWrapper<algorithm, mode>&) + const aes::EncryptWrapper<algorithm, mode>&) { } - template <aesni::Algorithm algorithm, aesni::Mode mode, typename std::enable_if<aesni::ModeRequiresInitializationVector<mode>::value>::type* = 0> + template <aes::Algorithm algorithm, aes::Mode mode, typename std::enable_if<aes::ModeRequiresInitializationVector<mode>::value>::type* = 0> void dump_next_iv( - const aesni::DecryptWrapper<algorithm, mode>& wrapper) + const aes::DecryptWrapper<algorithm, mode>& wrapper) { dump_block<algorithm>("Next initialization vector", wrapper.iv); } - template <aesni::Algorithm algorithm, aesni::Mode mode, typename std::enable_if<!aesni::ModeRequiresInitializationVector<mode>::value>::type* = 0> + template <aes::Algorithm algorithm, aes::Mode mode, typename std::enable_if<!aes::ModeRequiresInitializationVector<mode>::value>::type* = 0> void dump_next_iv( - const aesni::DecryptWrapper<algorithm, mode>&) + const aes::DecryptWrapper<algorithm, mode>&) { } } |