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];
23 const SIMD_8x32 CTR1 = SIMD_8x32(0, C < 1, C < 2, C < 3, C < 4, C < 5, C < 6, C < 7);
42 for(
size_t r = 0; r != rounds / 2; ++r) {
113 R15 = R15.rotl<16>();
114 R12 = R12.rotl<16>();
115 R13 = R13.rotl<16>();
116 R14 = R14.rotl<16>();
128 R05 = R05.rotl<12>();
129 R06 = R06.rotl<12>();
130 R07 = R07.rotl<12>();
131 R04 = R04.rotl<12>();
184 R00.store_le(output);
185 R08.store_le(output + 32 * 1);
186 R01.store_le(output + 32 * 2);
187 R09.store_le(output + 32 * 3);
188 R02.store_le(output + 32 * 4);
189 R10.store_le(output + 32 * 5);
190 R03.store_le(output + 32 * 6);
191 R11.store_le(output + 32 * 7);
192 R04.store_le(output + 32 * 8);
193 R12.store_le(output + 32 * 9);
194 R05.store_le(output + 32 * 10);
195 R13.store_le(output + 32 * 11);
196 R06.store_le(output + 32 * 12);
197 R14.store_le(output + 32 * 13);
198 R07.store_le(output + 32 * 14);
199 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