8 #include <botan/noekeon.h>
9 #include <botan/loadstor.h>
10 #include <botan/rotate.h>
11 #include <botan/cpuid.h>
20 inline void theta(uint32_t& A0, uint32_t& A1,
21 uint32_t& A2, uint32_t& A3,
25 T ^= rotl<8>(
T) ^ rotr<8>(T);
35 T ^= rotl<8>(
T) ^ rotr<8>(T);
43 inline void theta(uint32_t& A0, uint32_t& A1,
44 uint32_t& A2, uint32_t& A3)
47 T ^= rotl<8>(
T) ^ rotr<8>(T);
52 T ^= rotl<8>(
T) ^ rotr<8>(T);
60 inline void gamma(uint32_t& A0, uint32_t& A1, uint32_t& A2, uint32_t& A3)
79 #if defined(BOTAN_HAS_NOEKEON_SIMD)
91 #if defined(BOTAN_HAS_NOEKEON_SIMD)
104 const uint8_t Noekeon::RC[] = {
105 0x80, 0x1B, 0x36, 0x6C, 0xD8, 0xAB, 0x4D, 0x9A,
106 0x2F, 0x5E, 0xBC, 0x63, 0xC6, 0x97, 0x35, 0x6A,
116 #if defined(BOTAN_HAS_NOEKEON_SIMD)
121 simd_encrypt_4(in, out);
129 for(
size_t i = 0; i != blocks; ++i)
136 for(
size_t j = 0; j != 16; ++j)
139 theta(A0, A1, A2, A3, m_EK.data());
145 gamma(A0, A1, A2, A3);
153 theta(A0, A1, A2, A3, m_EK.data());
169 #if defined(BOTAN_HAS_NOEKEON_SIMD)
174 simd_decrypt_4(in, out);
182 for(
size_t i = 0; i != blocks; ++i)
189 for(
size_t j = 16; j != 0; --j)
191 theta(A0, A1, A2, A3, m_DK.data());
198 gamma(A0, A1, A2, A3);
205 theta(A0, A1, A2, A3, m_DK.data());
218 void Noekeon::key_schedule(
const uint8_t key[],
size_t)
225 for(
size_t i = 0; i != 16; ++i)
228 theta(A0, A1, A2, A3);
234 gamma(A0, A1, A2, A3);
249 theta(A0, A1, A2, A3);
void zap(std::vector< T, Alloc > &vec)
uint32_t load_be< uint32_t >(const uint8_t in[], size_t off)
void encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override
void decrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override
static bool has_simd_32()
std::string provider() const override
void verify_key_set(bool cond) const
size_t parallelism() const override