native 0.0.1
Vectors, masks and wide register packs for C++26
Loading...
Searching...
No Matches
aes.h
1// SPDX-License-Identifier: BSD-2-Clause OR Apache-2.0
2#pragma once
4#include "native/config.h"
5#include "native/attributes.h"
6#include "native/isa.h"
7#include <cstdint>
8#if NATIVE_HOST_NEON
9#include <arm_neon.h>
10#endif
11
12#if NATIVE_HOST_NEON || defined(NATIVE_DOXYGEN)
13namespace native::detail::arm_aes {
14
15 template<isa<arm> Arch> requires(Arch.has(arm_feature::aes))
17 uint8x16_t aese(uint8x16_t state, uint8x16_t round_key) noexcept {
18 return vaeseq_u8(state, round_key);
19 }
20
21 template<isa<arm> Arch> requires(Arch.has(arm_feature::aes))
23 uint8x16_t aesd(uint8x16_t state, uint8x16_t round_key) noexcept {
24 return vaesdq_u8(state, round_key);
25 }
26
27 template<isa<arm> Arch> requires(Arch.has(arm_feature::aes))
29 uint8x16_t aesmc(uint8x16_t state) noexcept {
30 return vaesmcq_u8(state);
31 }
32
33 template<isa<arm> Arch> requires(Arch.has(arm_feature::aes))
35 uint8x16_t aesimc(uint8x16_t state) noexcept {
36 return vaesimcq_u8(state);
37 }
38
39 // Reject Clang's implicit same-size vector conversions and scalar narrowing.
40 template<isa<arm> Arch, class... T> void aese(T...) = delete;
41
42 template<isa<arm> Arch, class... T> void aesd(T...) = delete;
43
44 template<isa<arm> Arch, class... T> void aesmc(T...) = delete;
45
46 template<isa<arm> Arch, class... T> void aesimc(T...) = delete;
47
48}
49#endif
Compiler attributes for host code, with shader-safe shared modifiers.
constexpr simd< std::uint8_t, 16, Arch > aesimc(simd< std::uint8_t, 16, Arch > state) noexcept
Apply inverse AES MixColumns independently to the four state columns.
constexpr simd< std::uint8_t, 16, Arch > aesmc(simd< std::uint8_t, 16, Arch > state) noexcept
Apply AES MixColumns independently to the four state columns.
constexpr simd< std::uint8_t, 16, Arch > aesd(simd< std::uint8_t, 16, Arch > state, simd< std::uint8_t, 16, Arch > round_key) noexcept
Apply AddRoundKey, inverse ShiftRows and inverse SubBytes to one AES state.
constexpr simd< std::uint8_t, 16, Arch > aese(simd< std::uint8_t, 16, Arch > state, simd< std::uint8_t, 16, Arch > round_key) noexcept
Apply AddRoundKey, SubBytes and ShiftRows to one AES state.
#define native_inline
inline [[always_inline]]
Definition attributes.h:212
#define native_nodiscard
C++17 [[nodiscard]].
Definition attributes.h:189
#define native_const
[[const]] is not const
Definition attributes.h:108
#define native_target(x)
this indicates a required feature set for the current multiversioned function.
Definition attributes.h:476