8#include <botan/internal/noekeon.h>
10#include <botan/internal/loadstor.h>
11#include <botan/internal/rotate.h>
13#if defined(BOTAN_HAS_CPUID)
14 #include <botan/internal/cpuid.h>
24inline void theta(uint32_t& A0, uint32_t& A1, uint32_t& A2, uint32_t& A3,
const uint32_t EK[4]) {
44inline void theta(uint32_t& A0, uint32_t& A1, uint32_t& A2, uint32_t& A3) {
59inline void gamma(uint32_t& A0, uint32_t& A1, uint32_t& A2, uint32_t& A3) {
76#if defined(BOTAN_HAS_NOEKEON_SIMD)
86#if defined(BOTAN_HAS_NOEKEON_SIMD)
98const uint8_t Noekeon::RC[] = {
99 0x80, 0x1B, 0x36, 0x6C, 0xD8, 0xAB, 0x4D, 0x9A, 0x2F, 0x5E, 0xBC, 0x63, 0xC6, 0x97, 0x35, 0x6A, 0xD4};
107#if defined(BOTAN_HAS_NOEKEON_SIMD)
110 simd_encrypt_4(in, out);
118 for(
size_t i = 0; i != blocks; ++i) {
124 for(
size_t j = 0; j != 16; ++j) {
126 theta(A0, A1, A2, A3, m_EK.data());
132 gamma(A0, A1, A2, A3);
140 theta(A0, A1, A2, A3, m_EK.data());
155#if defined(BOTAN_HAS_NOEKEON_SIMD)
158 simd_decrypt_4(in, out);
166 for(
size_t i = 0; i != blocks; ++i) {
172 for(
size_t j = 16; j != 0; --j) {
173 theta(A0, A1, A2, A3, m_DK.data());
180 gamma(A0, A1, A2, A3);
187 theta(A0, A1, A2, A3, m_DK.data());
198 return !m_EK.empty();
204void Noekeon::key_schedule(std::span<const uint8_t> key) {
210 for(
size_t i = 0; i != 16; ++i) {
212 theta(A0, A1, A2, A3);
218 gamma(A0, A1, A2, A3);
233 theta(A0, A1, A2, A3);
static std::optional< std::string > check(CPUID::Feature feat)
static bool has(CPUID::Feature feat)
size_t parallelism() const override
void encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override
std::string provider() const override
void decrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override
bool has_keying_material() const override
void assert_key_material_set() const
void zap(std::vector< T, Alloc > &vec)
constexpr T rotl(T input)
constexpr T rotr(T input)
constexpr auto store_be(ParamTs &&... params)
constexpr auto load_be(ParamTs &&... params)