diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2015-07-28 23:44:05 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2015-07-28 23:44:05 +0300 |
commit | ea39cbc0c4e78cb6d7b34ea902bf4925edce23dc (patch) | |
tree | 5718193734922a0c79390a73fb9410b14deebce8 /cxx/include/aesnixx | |
parent | bugfix (diff) | |
download | aes-tools-ea39cbc0c4e78cb6d7b34ea902bf4925edce23dc.tar.gz aes-tools-ea39cbc0c4e78cb6d7b34ea902bf4925edce23dc.zip |
cxx: more mode helpers
Diffstat (limited to 'cxx/include/aesnixx')
-rw-r--r-- | cxx/include/aesnixx/mode.hpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/cxx/include/aesnixx/mode.hpp b/cxx/include/aesnixx/mode.hpp index 9bcbbd5..a0af051 100644 --- a/cxx/include/aesnixx/mode.hpp +++ b/cxx/include/aesnixx/mode.hpp @@ -24,8 +24,25 @@ namespace aesni struct ModeRequiresInitializationVector<AESNI_ECB> : public std::false_type { }; + template <Mode mode> + struct ModeUsesEncryptionKeysOnly : public std::true_type + { }; + inline bool mode_requires_initialization_vector(Mode mode) { return mode != AESNI_ECB; } + + template <> + struct ModeUsesEncryptionKeysOnly<AESNI_ECB> : public std::false_type + { }; + + template <> + struct ModeUsesEncryptionKeysOnly<AESNI_CBC> : public std::false_type + { }; + + inline bool mode_uses_encryption_keys_only(Mode mode) + { + return mode != AESNI_ECB && mode != AESNI_CBC; + } } |