From ea39cbc0c4e78cb6d7b34ea902bf4925edce23dc Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Tue, 28 Jul 2015 23:44:05 +0300 Subject: cxx: more mode helpers --- cxx/include/aesnixx/mode.hpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'cxx/include/aesnixx') 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 : public std::false_type { }; + template + struct ModeUsesEncryptionKeysOnly : public std::true_type + { }; + inline bool mode_requires_initialization_vector(Mode mode) { return mode != AESNI_ECB; } + + template <> + struct ModeUsesEncryptionKeysOnly : public std::false_type + { }; + + template <> + struct ModeUsesEncryptionKeysOnly : public std::false_type + { }; + + inline bool mode_uses_encryption_keys_only(Mode mode) + { + return mode != AESNI_ECB && mode != AESNI_CBC; + } } -- cgit v1.2.3