8#include <botan/internal/noekeon.h>
10#include <botan/internal/simd_32.h>
19inline void theta(SIMD_4x32& A0,
26 const SIMD_4x32& K3) {
27 SIMD_4x32
T = A0 ^ A2;
28 T ^=
T.rotl<8>() ^
T.rotr<8>();
38 T ^=
T.rotl<8>() ^
T.rotr<8>();
46inline void gamma(SIMD_4x32& A0, SIMD_4x32& A1, SIMD_4x32& A2, SIMD_4x32& A3) {
65void Noekeon::simd_encrypt_4(
const uint8_t in[], uint8_t out[])
const {
78 for(
size_t i = 0; i != 16; ++i) {
81 theta(A0, A1, A2, A3, K0, K1, K2, K3);
87 gamma(A0, A1, A2, A3);
95 theta(A0, A1, A2, A3, K0, K1, K2, K3);
100 A1.store_be(out + 16);
101 A2.store_be(out + 32);
102 A3.store_be(out + 48);
108void Noekeon::simd_decrypt_4(
const uint8_t in[], uint8_t out[])
const {
121 for(
size_t i = 0; i != 16; ++i) {
122 theta(A0, A1, A2, A3, K0, K1, K2, K3);
130 gamma(A0, A1, A2, A3);
137 theta(A0, A1, A2, A3, K0, K1, K2, K3);
143 A1.store_be(out + 16);
144 A2.store_be(out + 32);
145 A3.store_be(out + 48);
static SIMD_4x32 load_be(const void *in) noexcept
static void transpose(SIMD_4x32 &B0, SIMD_4x32 &B1, SIMD_4x32 &B2, SIMD_4x32 &B3) noexcept
static SIMD_4x32 splat(uint32_t B) noexcept