aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2015-07-28 23:44:05 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2015-07-28 23:44:05 +0300
commitea39cbc0c4e78cb6d7b34ea902bf4925edce23dc (patch)
tree5718193734922a0c79390a73fb9410b14deebce8
parentbugfix (diff)
downloadaes-tools-ea39cbc0c4e78cb6d7b34ea902bf4925edce23dc.tar.gz
aes-tools-ea39cbc0c4e78cb6d7b34ea902bf4925edce23dc.zip
cxx: more mode helpers
Diffstat (limited to '')
-rw-r--r--cxx/include/aesnixx/mode.hpp17
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;
+ }
}