7#include <botan/internal/chacha.h>
9#include <botan/assert.h>
10#include <botan/internal/simd_avx2.h>
15void BOTAN_FN_ISA_AVX2 ChaCha::chacha_avx2_x8(uint8_t output[64 * 8], uint32_t state[16],
size_t rounds) {
19 const SIMD_8x32 CTR0 = SIMD_8x32(0, 1, 2, 3, 4, 5, 6, 7);
21 const uint32_t C = 0xFFFFFFFF - state[12];
22 const SIMD_8x32 CTR1 = SIMD_8x32(0, C < 1, C < 2, C < 3, C < 4, C < 5, C < 6, C < 7);
41 for(
size_t r = 0; r != rounds / 2; ++r) {
112 R15 = R15.rotl<16>();
113 R12 = R12.rotl<16>();
114 R13 = R13.rotl<16>();
115 R14 = R14.rotl<16>();
127 R05 = R05.rotl<12>();
128 R06 = R06.rotl<12>();
129 R07 = R07.rotl<12>();
130 R04 = R04.rotl<12>();
183 R00.store_le(output);
184 R08.store_le(output + 32 * 1);
185 R01.store_le(output + 32 * 2);
186 R09.store_le(output + 32 * 3);
187 R02.store_le(output + 32 * 4);
188 R10.store_le(output + 32 * 5);
189 R03.store_le(output + 32 * 6);
190 R11.store_le(output + 32 * 7);
191 R04.store_le(output + 32 * 8);
192 R12.store_le(output + 32 * 9);
193 R05.store_le(output + 32 * 10);
194 R13.store_le(output + 32 * 11);
195 R06.store_le(output + 32 * 12);
196 R14.store_le(output + 32 * 13);
197 R07.store_le(output + 32 * 14);
198 R15.store_le(output + 32 * 15);
#define BOTAN_ASSERT(expr, assertion_made)
static BOTAN_FN_ISA_AVX2 void reset_registers() noexcept
static BOTAN_FN_ISA_AVX2 void transpose(SIMD_8x32 &B0, SIMD_8x32 &B1, SIMD_8x32 &B2, SIMD_8x32 &B3) noexcept
static BOTAN_FN_ISA_AVX2 void zero_registers() noexcept
static BOTAN_FN_ISA_AVX2 SIMD_8x32 splat(uint32_t B) noexcept