diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2015-06-18 17:04:59 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2015-06-18 17:04:59 +0300 |
commit | d7d598c27211cae8fb173270f0d2e5d815c8191d (patch) | |
tree | 8efd9194205ebd6db0e7f8327555e0577c636f31 | |
parent | test: README update (diff) | |
download | aes-tools-d7d598c27211cae8fb173270f0d2e5d815c8191d.tar.gz aes-tools-d7d598c27211cae8fb173270f0d2e5d815c8191d.zip |
cxx: implement more stuff
-rw-r--r-- | cxx/include/aesnixx/aes.hpp | 2 | ||||
-rw-r--r-- | cxx/include/aesnixx/data.hpp | 25 | ||||
-rw-r--r-- | examples/common.hpp | 2 |
3 files changed, 27 insertions, 2 deletions
diff --git a/cxx/include/aesnixx/aes.hpp b/cxx/include/aesnixx/aes.hpp index d30fd60..55dfa0e 100644 --- a/cxx/include/aesnixx/aes.hpp +++ b/cxx/include/aesnixx/aes.hpp @@ -124,7 +124,7 @@ namespace aesni typedef AesNI_Aes256_RoundKeys RoundKeys256; template <typename RoundKeysT> - inline std::size_t get_number_of_keys(const RoundKeysT& round_keys) + inline std::size_t get_number_of_rounds(const RoundKeysT& round_keys) { return sizeof(round_keys) / sizeof(Block128); } diff --git a/cxx/include/aesnixx/data.hpp b/cxx/include/aesnixx/data.hpp index 1eaac24..bd7e9bd 100644 --- a/cxx/include/aesnixx/data.hpp +++ b/cxx/include/aesnixx/data.hpp @@ -20,4 +20,29 @@ namespace aesni { dest = aesni_make_block128(hi3, hi2, lo1, lo0); } + + inline void load_block(Block128& dest, const void* src) + { + dest = aesni_load_block128(src); + } + + inline void load_block_aligned(Block128& dest, const void* src) + { + dest = aesni_load_block128_aligned(src); + } + + inline void store_block(void* dest, Block128& src) + { + aesni_store_block128(dest, src); + } + + inline void store_block_aligned(void* dest, Block128& src) + { + aesni_store_block128_aligned(dest, src); + } + + inline Block128 xor_block(Block128& a, Block128& b) + { + return aesni_xor_block128(a, b); + } } diff --git a/examples/common.hpp b/examples/common.hpp index d7b3394..25ee87d 100644 --- a/examples/common.hpp +++ b/examples/common.hpp @@ -86,7 +86,7 @@ namespace void dump_schedule(const char* name, const KeyScheduleT& schedule) { std::cout << name << ":\n"; - for (std::size_t i = 0; i < aesni::aes::get_number_of_keys(schedule); ++i) + for (std::size_t i = 0; i < aesni::aes::get_number_of_rounds(schedule); ++i) std::cout << "\t[" << i << "]: " << aesni::aes::to_string(schedule.keys[i]) << "\n"; std::cout << "\n"; } |