32 #ifndef MCKL_RANDOM_AES_HPP 33 #define MCKL_RANDOM_AES_HPP 49 #ifndef MCKL_AES128_ROUNDS 52 #define MCKL_AES128_ROUNDS 10 57 #ifndef MCKL_AES192_ROUNDS 58 #define MCKL_AES192_ROUNDS 12 63 #ifndef MCKL_AES256_ROUNDS 64 #define MCKL_AES256_ROUNDS 14 69 #ifndef MCKL_ARS_ROUNDS 70 #define MCKL_ARS_ROUNDS 5 83 template <
typename Constants>
86 template <
typename KeySeqType>
89 #else // MCKL_USE_AESNI 95 template <
typename Constants>
98 template <
typename KeySeqType>
101 #endif // MCKL_USE_AESNI 107 template <std::
size_t Rounds = MCKL_AES128_ROUNDS>
113 template <std::
size_t Rounds = MCKL_AES192_ROUNDS>
119 template <std::
size_t Rounds = MCKL_AES256_ROUNDS>
135 template <
typename KeySeqType>
138 static_assert(KeySeqType::rounds() != 0,
139 "**AESGenerate** used with KeySeqType::rounds() equal to zero");
156 template <
typename ResultType>
162 template <
typename ResultType>
171 return gen1.key_seq_ == gen2.key_seq_;
177 return !(gen1 == gen2);
180 template <
typename CharT,
typename Traits>
182 std::basic_ostream<CharT, Traits> &os,
194 template <
typename CharT,
typename Traits>
203 is >> std::ws >> gen_tmp.key_seq_;
206 gen = std::move(gen_tmp);
218 template <
typename ResultType,
typename KeySeqType>
223 template <
typename ResultType, std::
size_t Rounds = MCKL_AES128_ROUNDS>
228 template <
typename ResultType, std::
size_t Rounds = MCKL_AES192_ROUNDS>
233 template <
typename ResultType, std::
size_t Rounds = MCKL_AES256_ROUNDS>
278 #endif // MCKL_RANDOM_AES_HPP void operator()(const void *plain, void *cipher) const
Counter based RNG engine.
RNG generator using AES round functions.
#define MCKL_PUSH_GCC_WARNING(warning)
friend bool operator==(const AESGenerator< KeySeqType > &gen1, const AESGenerator< KeySeqType > &gen2)
typename internal::CounterImpl< T, K >::type Counter
A counter type with the same width as std::array<T, K> but with possibly fewer elements.
friend std::basic_istream< CharT, Traits > & operator>>(std::basic_istream< CharT, Traits > &is, AESGenerator< KeySeqType > &gen)
void operator()(ctr_type &ctr, ResultType *r) const
void operator()(ctr_type &ctr, std::size_t n, ResultType *r) const
static void eval(const void *plain, void *cipher, const KeySeqType &ks)
static constexpr std::size_t size()
void reset(const key_type &key)
friend std::basic_ostream< CharT, Traits > & operator<<(std::basic_ostream< CharT, Traits > &os, const AESGenerator< KeySeqType > &gen)
typename KeySeqType::key_type key_type
#define MCKL_ARS_ROUNDS
ARSEngine default rounds.
Counter< std::uint32_t, 4 > ctr_type
#define MCKL_POP_GCC_WARNING
friend bool operator!=(const AESGenerator< KeySeqType > &gen1, const AESGenerator< KeySeqType > &gen2)