8 #include <botan/noekeon.h>
9 #include <botan/loadstor.h>
10 #include <botan/cpuid.h>
19 inline void theta(uint32_t& A0, uint32_t& A1,
20 uint32_t& A2, uint32_t& A3,
42 inline void theta(uint32_t& A0, uint32_t& A1,
43 uint32_t& A2, uint32_t& A3)
59 inline void gamma(uint32_t& A0, uint32_t& A1, uint32_t& A2, uint32_t& A3)
78 #if defined(BOTAN_HAS_NOEKEON_SIMD)
91 const uint8_t Noekeon::RC[] = {
92 0x80, 0x1B, 0x36, 0x6C, 0xD8, 0xAB, 0x4D, 0x9A,
93 0x2F, 0x5E, 0xBC, 0x63, 0xC6, 0x97, 0x35, 0x6A,
101 #if defined(BOTAN_HAS_NOEKEON_SIMD)
106 simd_encrypt_4(in, out);
114 for(
size_t i = 0; i != blocks; ++i)
121 for(
size_t j = 0; j != 16; ++j)
124 theta(A0, A1, A2, A3, m_EK.data());
130 gamma(A0, A1, A2, A3);
138 theta(A0, A1, A2, A3, m_EK.data());
152 #if defined(BOTAN_HAS_NOEKEON_SIMD)
157 simd_decrypt_4(in, out);
165 for(
size_t i = 0; i != blocks; ++i)
172 for(
size_t j = 16; j != 0; --j)
174 theta(A0, A1, A2, A3, m_DK.data());
181 gamma(A0, A1, A2, A3);
188 theta(A0, A1, A2, A3, m_DK.data());
201 void Noekeon::key_schedule(
const uint8_t key[],
size_t)
208 for(
size_t i = 0; i != 16; ++i)
211 theta(A0, A1, A2, A3);
217 gamma(A0, A1, A2, A3);
232 theta(A0, A1, A2, A3);
void zap(std::vector< T, Alloc > &vec)
void store_be(uint16_t in, uint8_t out[2])
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
T rotate_left(T input, size_t rot)
void decrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override
static bool has_simd_32()
T rotate_right(T input, size_t rot)
std::string provider() const override