7#include <botan/internal/shacal2.h>
17void SHACAL2::armv8_encrypt_blocks(const uint8_t in[], uint8_t out[],
size_t blocks)
const {
18 const uint32_t* input32 =
reinterpret_cast<const uint32_t*
>(in);
19 uint32_t* output32 =
reinterpret_cast<uint32_t*
>(out);
22 uint32x4_t B0_0 = vld1q_u32(input32 + 0);
23 uint32x4_t B0_1 = vld1q_u32(input32 + 4);
24 uint32x4_t B1_0 = vld1q_u32(input32 + 8);
25 uint32x4_t B1_1 = vld1q_u32(input32 + 12);
27 B0_0 = vreinterpretq_u32_u8(vrev32q_u8(vreinterpretq_u8_u32(B0_0)));
28 B0_1 = vreinterpretq_u32_u8(vrev32q_u8(vreinterpretq_u8_u32(B0_1)));
29 B1_0 = vreinterpretq_u32_u8(vrev32q_u8(vreinterpretq_u8_u32(B1_0)));
30 B1_1 = vreinterpretq_u32_u8(vrev32q_u8(vreinterpretq_u8_u32(B1_1)));
32 for(
size_t i = 0; i != 8; ++i) {
33 const auto RK0 = vld1q_u32(&m_RK[8 * i]);
34 const auto RK1 = vld1q_u32(&m_RK[8 * i + 4]);
36 const auto T0_0 = vsha256hq_u32(B0_0, B0_1, RK0);
37 const auto T0_1 = vsha256h2q_u32(B0_1, B0_0, RK0);
38 const auto T1_0 = vsha256hq_u32(B1_0, B1_1, RK0);
39 const auto T1_1 = vsha256h2q_u32(B1_1, B1_0, RK0);
41 B0_0 = vsha256hq_u32(T0_0, T0_1, RK1);
42 B0_1 = vsha256h2q_u32(T0_1, T0_0, RK1);
43 B1_0 = vsha256hq_u32(T1_0, T1_1, RK1);
44 B1_1 = vsha256h2q_u32(T1_1, T1_0, RK1);
47 B0_0 = vreinterpretq_u32_u8(vrev32q_u8(vreinterpretq_u8_u32(B0_0)));
48 B0_1 = vreinterpretq_u32_u8(vrev32q_u8(vreinterpretq_u8_u32(B0_1)));
49 B1_0 = vreinterpretq_u32_u8(vrev32q_u8(vreinterpretq_u8_u32(B1_0)));
50 B1_1 = vreinterpretq_u32_u8(vrev32q_u8(vreinterpretq_u8_u32(B1_1)));
52 vst1q_u32(&output32[0], B0_0);
53 vst1q_u32(&output32[4], B0_1);
54 vst1q_u32(&output32[8], B1_0);
55 vst1q_u32(&output32[12], B1_1);
63 uint32x4_t B0 = vld1q_u32(input32 + 0);
64 uint32x4_t B1 = vld1q_u32(input32 + 4);
66 B0 = vreinterpretq_u32_u8(vrev32q_u8(vreinterpretq_u8_u32(B0)));
67 B1 = vreinterpretq_u32_u8(vrev32q_u8(vreinterpretq_u8_u32(B1)));
69 for(
size_t i = 0; i != 8; ++i) {
70 const auto RK0 = vld1q_u32(&m_RK[8 * i]);
71 const auto RK1 = vld1q_u32(&m_RK[8 * i + 4]);
73 const auto T0 = vsha256hq_u32(B0, B1, RK0);
74 const auto T1 = vsha256h2q_u32(B1, B0, RK0);
76 B0 = vsha256hq_u32(T0, T1, RK1);
77 B1 = vsha256h2q_u32(T1, T0, RK1);
80 B0 = vreinterpretq_u32_u8(vrev32q_u8(vreinterpretq_u8_u32(B0)));
81 B1 = vreinterpretq_u32_u8(vrev32q_u8(vreinterpretq_u8_u32(B1)));
83 vst1q_u32(&output32[0], B0);
84 vst1q_u32(&output32[4], B1);
#define BOTAN_FUNC_ISA(isa)