mldsa_gh 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +88 -0
- data/ext/mldsa_gh_native/extconf.rb +14 -0
- data/ext/mldsa_gh_native/mldsa_gh_native.c +222 -0
- data/ext/mldsa_gh_native/mldsa_gh_native_all.c +24 -0
- data/ext/mldsa_gh_native/mldsa_gh_native_all.h +26 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/BUILDING.md +108 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/LICENSE +305 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/README.md +247 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/README.md +23 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/mldsa_native.c +803 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/mldsa_native.h +956 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/mldsa_native_asm.S +830 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/mldsa_native_config.h +855 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/cbmc.h +233 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/common.h +301 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/context.h +152 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/ct.c +21 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/ct.h +373 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/debug.c +75 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/debug.h +125 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/fips202/fips202.c +270 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/fips202/fips202.h +224 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/fips202/fips202x4.c +187 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/fips202/fips202x4.h +125 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/fips202/keccakf1600.c +510 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/fips202/keccakf1600.h +110 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/auto.h +85 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/fips202_native_aarch64.h +69 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_scalar_aarch64_asm.S +378 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_v84a_aarch64_asm.S +207 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x2_v84a_aarch64_asm.S +262 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_scalar_hybrid_aarch64_asm.S +1080 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_v84a_scalar_hybrid_aarch64_asm.S +990 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccakf1600_round_constants.c +47 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x1_scalar.h +27 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x1_v84a.h +36 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x2_v84a.h +40 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x4_v8a_scalar.h +32 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x4_v8a_v84a_scalar.h +37 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/fips202/native/api.h +129 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/README.md +10 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/mve.h +67 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/fips202_native_armv81m.h +37 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S +717 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.c +42 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_state_extract_bytes_mve.S +334 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_state_xor_bytes_mve.S +355 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccakf1600_round_constants.c +53 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/fips202/native/auto.h +35 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/keccak_f1600_x4_avx2.h +34 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/fips202_native_x86_64.h +45 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/keccak_f1600_x4_avx2_asm.S +488 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/keccakf1600_constants.c +52 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/aarch64/meta.h +314 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/aarch64/src/aarch64_zetas.c +248 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/aarch64/src/arith_native_aarch64.h +367 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_intt_aarch64_asm.S +786 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_ntt_aarch64_asm.S +686 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_pointwise_montgomery_aarch64_asm.S +106 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_poly_caddq_aarch64_asm.S +69 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_poly_chknorm_aarch64_asm.S +76 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_poly_decompose_32_aarch64_asm.S +108 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_poly_decompose_88_aarch64_asm.S +108 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_poly_use_hint_32_aarch64_asm.S +125 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_poly_use_hint_88_aarch64_asm.S +133 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_polyvecl_pointwise_acc_montgomery_l4_aarch64_asm.S +157 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_polyvecl_pointwise_acc_montgomery_l5_aarch64_asm.S +173 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_polyvecl_pointwise_acc_montgomery_l7_aarch64_asm.S +205 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_polyz_unpack_17_aarch64_asm.S +103 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_polyz_unpack_19_aarch64_asm.S +100 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_rej_uniform_aarch64_asm.S +222 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_rej_uniform_eta2_aarch64_asm.S +170 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_rej_uniform_eta4_aarch64_asm.S +163 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_table.c +52 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta_table.c +547 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_table.c +63 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/api.h +617 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/meta.h +24 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/x86_64/meta.h +323 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/x86_64/src/arith_native_x86_64.h +330 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/x86_64/src/consts.c +157 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/x86_64/src/consts.h +27 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_intt_avx2_asm.S +2333 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_ntt_avx2_asm.S +2405 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_nttunpack_avx2_asm.S +254 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_pointwise_acc_l4_avx2_asm.S +173 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_pointwise_acc_l5_avx2_asm.S +189 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_pointwise_acc_l7_avx2_asm.S +221 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_pointwise_avx2_asm.S +158 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_caddq_avx2_asm.S +199 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_chknorm_avx2_asm.S +176 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_decompose_32_avx2_asm.S +490 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_decompose_88_avx2_asm.S +489 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_use_hint_32_avx2_asm.S +123 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_use_hint_88_avx2_asm.S +125 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_polyz_unpack_17_avx2_asm.S +355 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_polyz_unpack_19_avx2_asm.S +355 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_rej_uniform_avx2_asm.S +132 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_rej_uniform_eta2_avx2_asm.S +205 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_rej_uniform_eta4_avx2_asm.S +176 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_table.c +161 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/packing.c +213 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/packing.h +277 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/params.h +153 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/poly.c +1066 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/poly.h +464 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/poly_kl.c +910 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/poly_kl.h +367 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/polyvec.c +509 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/polyvec.h +435 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/polyvec_lazy.c +311 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/polyvec_lazy.h +652 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/randombytes.h +26 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/reduce.h +144 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/rounding.h +265 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/sign.c +1720 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/sign.h +850 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/symmetric.h +68 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/sys.h +327 -0
- data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/zetas.inc +55 -0
- data/lib/mldsa/parameter_set.rb +82 -0
- data/lib/mldsa/signing_key.rb +147 -0
- data/lib/mldsa/verify_key.rb +72 -0
- data/lib/mldsa/version.rb +7 -0
- data/lib/mldsa_gh.rb +93 -0
- metadata +225 -0
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
#include "../../../../common.h"
|
|
8
|
+
#include "../../../../ct.h"
|
|
9
|
+
|
|
10
|
+
#if defined(MLD_FIPS202_ARMV81M_NEED_X4) && \
|
|
11
|
+
!defined(MLD_CONFIG_MULTILEVEL_NO_SHARED)
|
|
12
|
+
|
|
13
|
+
#include "fips202_native_armv81m.h"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
/*
|
|
17
|
+
* Keccak-f1600 x4 permutation (on bit-interleaved state)
|
|
18
|
+
* State is expected to already be in bit-interleaved format.
|
|
19
|
+
*/
|
|
20
|
+
#define mld_keccak_f1600_x4_native_impl \
|
|
21
|
+
MLD_NAMESPACE(keccak_f1600_x4_native_impl)
|
|
22
|
+
MLD_INTERNAL_API
|
|
23
|
+
int mld_keccak_f1600_x4_native_impl(uint64_t *state)
|
|
24
|
+
{
|
|
25
|
+
MLD_ALIGN uint64_t state_tmp[100];
|
|
26
|
+
mld_keccak_f1600_x4_mve_asm(state, state_tmp,
|
|
27
|
+
mld_keccakf1600_round_constants);
|
|
28
|
+
mld_zeroize(state_tmp, sizeof(state_tmp));
|
|
29
|
+
return MLD_NATIVE_FUNC_SUCCESS;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
#else /* MLD_FIPS202_ARMV81M_NEED_X4 && !MLD_CONFIG_MULTILEVEL_NO_SHARED */
|
|
33
|
+
|
|
34
|
+
MLD_EMPTY_CU(keccak_f1600_x4_mve)
|
|
35
|
+
|
|
36
|
+
#endif /* !(MLD_FIPS202_ARMV81M_NEED_X4 && !MLD_CONFIG_MULTILEVEL_NO_SHARED) \
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
/* To facilitate single-compilation-unit (SCU) builds, undefine all macros.
|
|
40
|
+
* Don't modify by hand -- this is auto-generated by scripts/autogen. */
|
|
41
|
+
/* Some macros are kept because they are also defined in a header. */
|
|
42
|
+
/* Keep: mld_keccak_f1600_x4_native_impl (mve.h) */
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) The mlkem-native project authors
|
|
3
|
+
* Copyright (c) The mldsa-native project authors
|
|
4
|
+
* Copyright (c) 2026 Arm Limited
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
// Overview
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
// MVE/Helium implementation of KeccakF1600x4_StateExtractBytes
|
|
12
|
+
// (inverse of keccak_f1600_x4_state_xor_bytes_mve.S).
|
|
13
|
+
//
|
|
14
|
+
// void KeccakF1600x4_StateExtractBytes(state, d0, d1, d2, d3, offset, length)
|
|
15
|
+
//
|
|
16
|
+
// Reads 'length' bytes from the bit-interleaved Keccak state starting at
|
|
17
|
+
// byte 'offset', recombines the even and odd halves of each lane back
|
|
18
|
+
// into plain bytes, and writes them to four output buffers (d0..d3).
|
|
19
|
+
//
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
// Bit-interleaving background
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
// Each 64-bit Keccak lane is stored as two 32-bit words:
|
|
24
|
+
// even half -- bits 0, 2, 4, ..., 62 of the lane
|
|
25
|
+
// odd half -- bits 1, 3, 5, ..., 63 of the lane
|
|
26
|
+
// This representation allows 64-bit lane rotations (used in the Keccak
|
|
27
|
+
// round function) to be implemented as pairs of 32-bit rotations.
|
|
28
|
+
//
|
|
29
|
+
// Batched (x4) processing:
|
|
30
|
+
// Four Keccak instances are processed as a batch. Their states are
|
|
31
|
+
// stored interleaved in a single 800-byte buffer: first the even
|
|
32
|
+
// halves of all 25 lanes (400 bytes), then the odd halves (400 bytes).
|
|
33
|
+
// Within each 16-byte row, the four u32 words correspond to
|
|
34
|
+
// instances 0..3 of the same lane, enabling SIMD-parallel operations
|
|
35
|
+
// across all four instances.
|
|
36
|
+
//
|
|
37
|
+
// State memory layout (25 lanes x 4 instances x 2 halves):
|
|
38
|
+
// S[i][l]_even/odd = even/odd half of lane l, instance i (u32)
|
|
39
|
+
// Each row is 16 bytes (one Q-register).
|
|
40
|
+
// Offset Contents
|
|
41
|
+
// 0 S[0][ 0]_even, S[1][ 0]_even, S[2][ 0]_even, S[3][ 0]_even
|
|
42
|
+
// 16 S[0][ 1]_even, S[1][ 1]_even, S[2][ 1]_even, S[3][ 1]_even
|
|
43
|
+
// ...
|
|
44
|
+
// 384 S[0][24]_even, S[1][24]_even, S[2][24]_even, S[3][24]_even
|
|
45
|
+
// 400 S[0][ 0]_odd, S[1][ 0]_odd, S[2][ 0]_odd, S[3][ 0]_odd
|
|
46
|
+
// 416 S[0][ 1]_odd, S[1][ 1]_odd, S[2][ 1]_odd, S[3][ 1]_odd
|
|
47
|
+
// ...
|
|
48
|
+
// 784 S[0][24]_odd, S[1][24]_odd, S[2][24]_odd, S[3][24]_odd
|
|
49
|
+
//
|
|
50
|
+
// ---------------------------------------------------------------------------
|
|
51
|
+
// Three-phase structure
|
|
52
|
+
// ---------------------------------------------------------------------------
|
|
53
|
+
// Prologue -- if offset is not 8-byte aligned, extract
|
|
54
|
+
// min(length, 8-(offset%8)) bytes via predicated byte stores.
|
|
55
|
+
// Main -- process full 8-byte groups: load even/odd lane pair,
|
|
56
|
+
// de-interleave, scatter-store to output buffers.
|
|
57
|
+
// Tail -- extract remaining <8 bytes via predicated byte stores.
|
|
58
|
+
|
|
59
|
+
#include "../../../../common.h"
|
|
60
|
+
#if defined(MLD_FIPS202_ARMV81M_NEED_X4) && \
|
|
61
|
+
!defined(MLD_CONFIG_MULTILEVEL_NO_SHARED)
|
|
62
|
+
|
|
63
|
+
/*
|
|
64
|
+
* WARNING: This file is auto-derived from the mldsa-native source file
|
|
65
|
+
* dev/fips202/armv81m/src/keccak_f1600_x4_state_extract_bytes_mve.S using scripts/simpasm. Do not modify it directly.
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
.thumb
|
|
69
|
+
.syntax unified
|
|
70
|
+
|
|
71
|
+
.text
|
|
72
|
+
.balign 4
|
|
73
|
+
.global MLD_ASM_NAMESPACE(keccak_f1600_x4_state_extract_bytes_asm)
|
|
74
|
+
MLD_ASM_FN_SYMBOL(keccak_f1600_x4_state_extract_bytes_asm)
|
|
75
|
+
|
|
76
|
+
.cfi_startproc
|
|
77
|
+
push.w {r4, r5, r6, r7, r8, r9, r10, r11, r12, lr}
|
|
78
|
+
.cfi_adjust_cfa_offset 0x28
|
|
79
|
+
.cfi_rel_offset r4, 0x0
|
|
80
|
+
.cfi_rel_offset r5, 0x4
|
|
81
|
+
.cfi_rel_offset r6, 0x8
|
|
82
|
+
.cfi_rel_offset r7, 0xc
|
|
83
|
+
.cfi_rel_offset r8, 0x10
|
|
84
|
+
.cfi_rel_offset r9, 0x14
|
|
85
|
+
.cfi_rel_offset r10, 0x18
|
|
86
|
+
.cfi_rel_offset r11, 0x1c
|
|
87
|
+
.cfi_rel_offset lr, 0x24
|
|
88
|
+
vpush {d8, d9, d10, d11, d12, d13, d14, d15}
|
|
89
|
+
.cfi_adjust_cfa_offset 0x40
|
|
90
|
+
.cfi_rel_offset d8, 0x0
|
|
91
|
+
.cfi_rel_offset d9, 0x8
|
|
92
|
+
.cfi_rel_offset d10, 0x10
|
|
93
|
+
.cfi_rel_offset d11, 0x18
|
|
94
|
+
.cfi_rel_offset d12, 0x20
|
|
95
|
+
.cfi_rel_offset d13, 0x28
|
|
96
|
+
.cfi_rel_offset d14, 0x30
|
|
97
|
+
.cfi_rel_offset d15, 0x38
|
|
98
|
+
ldr r4, [sp, #0x68]
|
|
99
|
+
ldr.w r10, [sp, #0x6c]
|
|
100
|
+
ldr r6, [sp, #0x70]
|
|
101
|
+
cmp r6, #0x0
|
|
102
|
+
beq.w Lmld_keccak_f1600_x4_state_extract_bytes_asm_exit @ imm = #0x2ea
|
|
103
|
+
and r5, r10, #0x7
|
|
104
|
+
bic r9, r10, #0x7
|
|
105
|
+
add.w r8, r0, r9, lsl #1
|
|
106
|
+
add.w r7, r8, #0x190
|
|
107
|
+
cmp r5, #0x0
|
|
108
|
+
beq.w Lmld_keccak_f1600_x4_state_extract_bytes_asm_pre_main @ imm = #0x112
|
|
109
|
+
vldrw.u32 q0, [r8], #16
|
|
110
|
+
vldrw.u32 q1, [r7], #16
|
|
111
|
+
vrev32.16 q2, q0
|
|
112
|
+
vrev32.16 q3, q1
|
|
113
|
+
vsli.32 q0, q0, #0x8
|
|
114
|
+
vsli.16 q0, q0, #0x4
|
|
115
|
+
vsli.8 q0, q0, #0x1
|
|
116
|
+
vshr.u8 q4, q0, #0x3
|
|
117
|
+
vsli.8 q0, q4, #0x4
|
|
118
|
+
vshr.u8 q4, q0, #0x5
|
|
119
|
+
vsli.8 q0, q4, #0x6
|
|
120
|
+
vsli.32 q1, q1, #0x8
|
|
121
|
+
vsli.16 q1, q1, #0x4
|
|
122
|
+
vsli.8 q1, q1, #0x1
|
|
123
|
+
vshr.u8 q4, q1, #0x3
|
|
124
|
+
vsli.8 q1, q4, #0x4
|
|
125
|
+
vshr.u8 q4, q1, #0x5
|
|
126
|
+
vsli.8 q1, q4, #0x6
|
|
127
|
+
mov.w r0, #0x55
|
|
128
|
+
vdup.8 q4, r0
|
|
129
|
+
vand q0, q0, q4
|
|
130
|
+
vand q1, q1, q4
|
|
131
|
+
vshl.i32 q1, q1, #0x1
|
|
132
|
+
vorr q0, q0, q1
|
|
133
|
+
vsli.32 q2, q2, #0x8
|
|
134
|
+
vsli.16 q2, q2, #0x4
|
|
135
|
+
vsli.8 q2, q2, #0x1
|
|
136
|
+
vshr.u8 q1, q2, #0x3
|
|
137
|
+
vsli.8 q2, q1, #0x4
|
|
138
|
+
vshr.u8 q1, q2, #0x5
|
|
139
|
+
vsli.8 q2, q1, #0x6
|
|
140
|
+
vsli.32 q3, q3, #0x8
|
|
141
|
+
vsli.16 q3, q3, #0x4
|
|
142
|
+
vsli.8 q3, q3, #0x1
|
|
143
|
+
vshr.u8 q1, q3, #0x3
|
|
144
|
+
vsli.8 q3, q1, #0x4
|
|
145
|
+
vshr.u8 q1, q3, #0x5
|
|
146
|
+
vsli.8 q3, q1, #0x6
|
|
147
|
+
vand q1, q2, q4
|
|
148
|
+
vand q3, q3, q4
|
|
149
|
+
vshl.i32 q3, q3, #0x1
|
|
150
|
+
vorr q1, q1, q3
|
|
151
|
+
vrev64.32 q2, q0
|
|
152
|
+
vrev64.32 q3, q1
|
|
153
|
+
movw r0, #0xf0f
|
|
154
|
+
vmsr p0, r0
|
|
155
|
+
vpsel q0, q0, q3
|
|
156
|
+
vpsel q1, q2, q1
|
|
157
|
+
vmov.f64 d4, d1
|
|
158
|
+
vmov.f64 d6, d3
|
|
159
|
+
rsb.w lr, r5, #0x8
|
|
160
|
+
cmp r6, lr
|
|
161
|
+
it ls
|
|
162
|
+
movls lr, r6
|
|
163
|
+
vctp.8 lr
|
|
164
|
+
vmrs r11, p0
|
|
165
|
+
lsl.w r11, r11, r5
|
|
166
|
+
vmsr p0, r11
|
|
167
|
+
subs r1, r1, r5
|
|
168
|
+
subs r2, r2, r5
|
|
169
|
+
subs r3, r3, r5
|
|
170
|
+
subs r4, r4, r5
|
|
171
|
+
vpstttt
|
|
172
|
+
vstrbt.8 q0, [r1], #4
|
|
173
|
+
vstrbt.8 q1, [r2], #4
|
|
174
|
+
vstrbt.8 q2, [r3], #4
|
|
175
|
+
vstrbt.8 q3, [r4], #4
|
|
176
|
+
subs.w r6, r6, lr
|
|
177
|
+
cmp r6, #0x0
|
|
178
|
+
beq.w Lmld_keccak_f1600_x4_state_extract_bytes_asm_exit @ imm = #0x1cc
|
|
179
|
+
vmov q7[2], q7[0], r1, r3
|
|
180
|
+
vmov q7[3], q7[1], r2, r4
|
|
181
|
+
b Lmld_keccak_f1600_x4_state_extract_bytes_asm_main_body @ imm = #0xe
|
|
182
|
+
|
|
183
|
+
Lmld_keccak_f1600_x4_state_extract_bytes_asm_pre_main:
|
|
184
|
+
vmov q7[2], q7[0], r1, r3
|
|
185
|
+
vmov q7[3], q7[1], r2, r4
|
|
186
|
+
mov.w r12, #0x4
|
|
187
|
+
vsub.i32 q7, q7, r12
|
|
188
|
+
|
|
189
|
+
Lmld_keccak_f1600_x4_state_extract_bytes_asm_main_body:
|
|
190
|
+
lsr.w lr, r6, #0x3
|
|
191
|
+
wls lr, lr, Lmld_keccak_f1600_x4_state_extract_bytes_asm_main_loop_end @ imm = #0xb4
|
|
192
|
+
|
|
193
|
+
Lmld_keccak_f1600_x4_state_extract_bytes_asm_main_loop_start:
|
|
194
|
+
vldrw.u32 q0, [r8], #16
|
|
195
|
+
vldrw.u32 q1, [r7], #16
|
|
196
|
+
vrev32.16 q2, q0
|
|
197
|
+
vrev32.16 q3, q1
|
|
198
|
+
vsli.32 q0, q0, #0x8
|
|
199
|
+
vsli.16 q0, q0, #0x4
|
|
200
|
+
vsli.8 q0, q0, #0x1
|
|
201
|
+
vshr.u8 q4, q0, #0x3
|
|
202
|
+
vsli.8 q0, q4, #0x4
|
|
203
|
+
vshr.u8 q4, q0, #0x5
|
|
204
|
+
vsli.8 q0, q4, #0x6
|
|
205
|
+
vsli.32 q1, q1, #0x8
|
|
206
|
+
vsli.16 q1, q1, #0x4
|
|
207
|
+
vsli.8 q1, q1, #0x1
|
|
208
|
+
vshr.u8 q4, q1, #0x3
|
|
209
|
+
vsli.8 q1, q4, #0x4
|
|
210
|
+
vshr.u8 q4, q1, #0x5
|
|
211
|
+
vsli.8 q1, q4, #0x6
|
|
212
|
+
mov.w r0, #0x55
|
|
213
|
+
vdup.8 q4, r0
|
|
214
|
+
vand q0, q0, q4
|
|
215
|
+
vand q1, q1, q4
|
|
216
|
+
vshl.i32 q1, q1, #0x1
|
|
217
|
+
vorr q0, q0, q1
|
|
218
|
+
vsli.32 q2, q2, #0x8
|
|
219
|
+
vsli.16 q2, q2, #0x4
|
|
220
|
+
vsli.8 q2, q2, #0x1
|
|
221
|
+
vshr.u8 q1, q2, #0x3
|
|
222
|
+
vsli.8 q2, q1, #0x4
|
|
223
|
+
vshr.u8 q1, q2, #0x5
|
|
224
|
+
vsli.8 q2, q1, #0x6
|
|
225
|
+
vsli.32 q3, q3, #0x8
|
|
226
|
+
vsli.16 q3, q3, #0x4
|
|
227
|
+
vsli.8 q3, q3, #0x1
|
|
228
|
+
vshr.u8 q1, q3, #0x3
|
|
229
|
+
vsli.8 q3, q1, #0x4
|
|
230
|
+
vshr.u8 q1, q3, #0x5
|
|
231
|
+
vsli.8 q3, q1, #0x6
|
|
232
|
+
vand q1, q2, q4
|
|
233
|
+
vand q3, q3, q4
|
|
234
|
+
vshl.i32 q3, q3, #0x1
|
|
235
|
+
vorr q1, q1, q3
|
|
236
|
+
vstrw.32 q0, [q7, #4]!
|
|
237
|
+
vstrw.32 q1, [q7, #4]!
|
|
238
|
+
le lr, Lmld_keccak_f1600_x4_state_extract_bytes_asm_main_loop_start @ imm = #-0xb4
|
|
239
|
+
|
|
240
|
+
Lmld_keccak_f1600_x4_state_extract_bytes_asm_main_loop_end:
|
|
241
|
+
ands r6, r6, #0x7
|
|
242
|
+
beq Lmld_keccak_f1600_x4_state_extract_bytes_asm_exit @ imm = #0xee
|
|
243
|
+
mov.w r12, #0x4
|
|
244
|
+
vadd.i32 q7, q7, r12
|
|
245
|
+
vmov r1, r3, q7[2], q7[0]
|
|
246
|
+
vmov r2, r4, q7[3], q7[1]
|
|
247
|
+
vldrw.u32 q0, [r8], #16
|
|
248
|
+
vldrw.u32 q1, [r7], #16
|
|
249
|
+
vrev32.16 q2, q0
|
|
250
|
+
vrev32.16 q3, q1
|
|
251
|
+
vsli.32 q0, q0, #0x8
|
|
252
|
+
vsli.16 q0, q0, #0x4
|
|
253
|
+
vsli.8 q0, q0, #0x1
|
|
254
|
+
vshr.u8 q4, q0, #0x3
|
|
255
|
+
vsli.8 q0, q4, #0x4
|
|
256
|
+
vshr.u8 q4, q0, #0x5
|
|
257
|
+
vsli.8 q0, q4, #0x6
|
|
258
|
+
vsli.32 q1, q1, #0x8
|
|
259
|
+
vsli.16 q1, q1, #0x4
|
|
260
|
+
vsli.8 q1, q1, #0x1
|
|
261
|
+
vshr.u8 q4, q1, #0x3
|
|
262
|
+
vsli.8 q1, q4, #0x4
|
|
263
|
+
vshr.u8 q4, q1, #0x5
|
|
264
|
+
vsli.8 q1, q4, #0x6
|
|
265
|
+
mov.w r0, #0x55
|
|
266
|
+
vdup.8 q4, r0
|
|
267
|
+
vand q0, q0, q4
|
|
268
|
+
vand q1, q1, q4
|
|
269
|
+
vshl.i32 q1, q1, #0x1
|
|
270
|
+
vorr q0, q0, q1
|
|
271
|
+
vsli.32 q2, q2, #0x8
|
|
272
|
+
vsli.16 q2, q2, #0x4
|
|
273
|
+
vsli.8 q2, q2, #0x1
|
|
274
|
+
vshr.u8 q1, q2, #0x3
|
|
275
|
+
vsli.8 q2, q1, #0x4
|
|
276
|
+
vshr.u8 q1, q2, #0x5
|
|
277
|
+
vsli.8 q2, q1, #0x6
|
|
278
|
+
vsli.32 q3, q3, #0x8
|
|
279
|
+
vsli.16 q3, q3, #0x4
|
|
280
|
+
vsli.8 q3, q3, #0x1
|
|
281
|
+
vshr.u8 q1, q3, #0x3
|
|
282
|
+
vsli.8 q3, q1, #0x4
|
|
283
|
+
vshr.u8 q1, q3, #0x5
|
|
284
|
+
vsli.8 q3, q1, #0x6
|
|
285
|
+
vand q1, q2, q4
|
|
286
|
+
vand q3, q3, q4
|
|
287
|
+
vshl.i32 q3, q3, #0x1
|
|
288
|
+
vorr q1, q1, q3
|
|
289
|
+
vrev64.32 q2, q0
|
|
290
|
+
vrev64.32 q3, q1
|
|
291
|
+
movw r0, #0xf0f
|
|
292
|
+
vmsr p0, r0
|
|
293
|
+
vpsel q0, q0, q3
|
|
294
|
+
vpsel q1, q2, q1
|
|
295
|
+
vmov.f64 d4, d1
|
|
296
|
+
vmov.f64 d6, d3
|
|
297
|
+
vctp.8 r6
|
|
298
|
+
vpstttt
|
|
299
|
+
vstrbt.8 q0, [r1], #4
|
|
300
|
+
vstrbt.8 q1, [r2], #4
|
|
301
|
+
vstrbt.8 q2, [r3], #4
|
|
302
|
+
vstrbt.8 q3, [r4], #4
|
|
303
|
+
|
|
304
|
+
Lmld_keccak_f1600_x4_state_extract_bytes_asm_exit:
|
|
305
|
+
vpop {d8, d9, d10, d11, d12, d13, d14, d15}
|
|
306
|
+
.cfi_restore d8
|
|
307
|
+
.cfi_restore d9
|
|
308
|
+
.cfi_restore d10
|
|
309
|
+
.cfi_restore d11
|
|
310
|
+
.cfi_restore d12
|
|
311
|
+
.cfi_restore d13
|
|
312
|
+
.cfi_restore d14
|
|
313
|
+
.cfi_restore d15
|
|
314
|
+
.cfi_adjust_cfa_offset -0x40
|
|
315
|
+
pop.w {r4, r5, r6, r7, r8, r9, r10, r11, r12, pc}
|
|
316
|
+
.cfi_restore r4
|
|
317
|
+
.cfi_restore r5
|
|
318
|
+
.cfi_restore r6
|
|
319
|
+
.cfi_restore r7
|
|
320
|
+
.cfi_restore r8
|
|
321
|
+
.cfi_restore r9
|
|
322
|
+
.cfi_restore r10
|
|
323
|
+
.cfi_restore r11
|
|
324
|
+
.cfi_restore lr
|
|
325
|
+
.cfi_adjust_cfa_offset -0x28
|
|
326
|
+
.cfi_endproc
|
|
327
|
+
|
|
328
|
+
MLD_ASM_FN_SIZE(keccak_f1600_x4_state_extract_bytes_asm)
|
|
329
|
+
|
|
330
|
+
#endif /* MLD_FIPS202_ARMV81M_NEED_X4 && !MLD_CONFIG_MULTILEVEL_NO_SHARED */
|
|
331
|
+
|
|
332
|
+
#if defined(__ELF__)
|
|
333
|
+
.section .note.GNU-stack,"",%progbits
|
|
334
|
+
#endif
|