7#include <botan/internal/ctr.h>
9#include <botan/assert.h>
10#include <botan/internal/simd_4x32.h>
15size_t CTR_BE::ctr_proc_bs16_ctr4_simd32(
const uint8_t* in, uint8_t* out,
size_t length) {
19 const size_t pad_size = m_pad.size();
20 if(length < pad_size) {
24 const size_t ctr_blocks = m_ctr_blocks;
30 const uint32_t N =
static_cast<uint32_t
>(ctr_blocks);
33 SIMD_4x32 ctr0 = starting_ctr + SIMD_4x32(0, 0, 0, N);
34 SIMD_4x32 ctr1 = starting_ctr + SIMD_4x32(0, 0, 0, N + 1);
35 SIMD_4x32 ctr2 = starting_ctr + SIMD_4x32(0, 0, 0, N + 2);
36 SIMD_4x32 ctr3 = starting_ctr + SIMD_4x32(0, 0, 0, N + 3);
37 const SIMD_4x32 inc4 = SIMD_4x32(0, 0, 0, 4);
39 const uint8_t* pad_buf = m_pad.data();
40 uint8_t* ctr_buf = m_counter.data();
42 const size_t ctr_block_quads = ctr_blocks / 4;
46 while(length >= pad_size) {
47 for(
size_t i = 0; i != ctr_block_quads; ++i) {
48 const size_t off = i * 64;
51 ctr0.store_be(ctr_buf + off);
52 ctr1.store_be(ctr_buf + off + 16);
53 ctr2.store_be(ctr_buf + off + 32);
54 ctr3.store_be(ctr_buf + off + 48);
71 p0.store_le(out + off);
72 p1.store_le(out + off + 16);
73 p2.store_le(out + off + 32);
74 p3.store_le(out + off + 48);
80 processed += pad_size;
83 m_cipher->encrypt_n(m_counter.data(), m_pad.data(), ctr_blocks);
#define BOTAN_ASSERT_NOMSG(expr)
#define BOTAN_DEBUG_ASSERT(expr)
static SIMD_4x32 BOTAN_FN_ISA_SIMD_4X32 load_be(const void *in) noexcept
static SIMD_4x32 BOTAN_FN_ISA_SIMD_4X32 load_le(const void *in) noexcept