Debian Codegraph @

others/mbedtls/tf-psa-crypto/drivers/pqcp/mldsa-native/dev/fips202/aarch64/x2_v84a.h

raw
1 /*
2 * Copyright (c) The mlkem-native project authors
3 * Copyright (c) The mldsa-native project authors
4 * SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
5 */
6
7 #ifndef MLD_FIPS202_NATIVE_AARCH64_X2_V84A_H
8 #define MLD_FIPS202_NATIVE_AARCH64_X2_V84A_H
9
10 #if !defined(__ARM_FEATURE_SHA3)
11 #error This backend can only be used if SHA3 extensions are available.
12 #endif
13
14 /* Part of backend API */
15 #define MLD_USE_FIPS202_X4_NATIVE
16 /* Guard for assembly file */
17 #define MLD_FIPS202_AARCH64_NEED_X2_V84A
18
19 #if !defined(__ASSEMBLER__)
20 #include "../api.h"
21 #include "src/fips202_native_aarch64.h"
22
23
24 static MLD_INLINE int mld_keccak_f1600_x4_native(uint64_t *state)
25 {
26 if (!mld_sys_check_capability(MLD_SYS_CAP_SHA3))
27 {
28 return MLD_NATIVE_FUNC_FALLBACK;
29 }
30
31 mld_keccak_f1600_x2_v84a_asm(state + 0 * 25, mld_keccakf1600_round_constants);
32 mld_keccak_f1600_x2_v84a_asm(state + 2 * 25, mld_keccakf1600_round_constants);
33 return MLD_NATIVE_FUNC_SUCCESS;
34 }
35 #endif /* !__ASSEMBLER__ */
36
37 #endif /* !MLD_FIPS202_NATIVE_AARCH64_X2_V84A_H */