aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/cxx/include/aesnixx/mode.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'cxx/include/aesnixx/mode.hpp')
-rw-r--r--cxx/include/aesnixx/mode.hpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/cxx/include/aesnixx/mode.hpp b/cxx/include/aesnixx/mode.hpp
index ec26170..9bcbbd5 100644
--- a/cxx/include/aesnixx/mode.hpp
+++ b/cxx/include/aesnixx/mode.hpp
@@ -10,7 +10,22 @@
#include <aesni/all.h>
+#include <type_traits>
+
namespace aesni
{
typedef AesNI_Mode Mode;
+
+ template <Mode mode>
+ struct ModeRequiresInitializationVector : public std::true_type
+ { };
+
+ template <>
+ struct ModeRequiresInitializationVector<AESNI_ECB> : public std::false_type
+ { };
+
+ inline bool mode_requires_initialization_vector(Mode mode)
+ {
+ return mode != AESNI_ECB;
+ }
}