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,163 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) The mldsa-native project authors
|
|
3
|
+
* Copyright (c) The mlkem-native project authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/*yaml
|
|
8
|
+
Name: rej_uniform_eta4_aarch64_asm
|
|
9
|
+
Description: AArch64 rejection sampling of eta=4 secret coefficients
|
|
10
|
+
Signature: uint64_t mld_rej_uniform_eta4_aarch64_asm(int32_t r[256], const uint8_t *buf, unsigned buflen, const uint8_t table[4096])
|
|
11
|
+
ABI:
|
|
12
|
+
Architecture: aarch64
|
|
13
|
+
CallingConvention: AAPCS64
|
|
14
|
+
Features: [NEON]
|
|
15
|
+
x0:
|
|
16
|
+
type: buffer
|
|
17
|
+
size_bytes: 1024
|
|
18
|
+
permissions: write-only
|
|
19
|
+
c_parameter: int32_t r[256]
|
|
20
|
+
description: Output buffer (256 x int32_t)
|
|
21
|
+
x1:
|
|
22
|
+
type: buffer
|
|
23
|
+
size_bytes: x2
|
|
24
|
+
permissions: read-only
|
|
25
|
+
c_parameter: const uint8_t *buf
|
|
26
|
+
description: Input buffer
|
|
27
|
+
x2:
|
|
28
|
+
type: scalar
|
|
29
|
+
c_parameter: unsigned buflen
|
|
30
|
+
description: Length of input buffer (must be a multiple of 8)
|
|
31
|
+
test_with: 272 # MLD_AARCH64_REJ_UNIFORM_ETA4_BUFLEN
|
|
32
|
+
x3:
|
|
33
|
+
type: buffer
|
|
34
|
+
size_bytes: 4096
|
|
35
|
+
permissions: read-only
|
|
36
|
+
c_parameter: const uint8_t table[4096]
|
|
37
|
+
description: Lookup table (4096 x uint8_t)
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
#include "../../../common.h"
|
|
41
|
+
#if defined(MLD_ARITH_BACKEND_AARCH64) && \
|
|
42
|
+
!defined(MLD_CONFIG_NO_KEYPAIR_API) && \
|
|
43
|
+
!defined(MLD_CONFIG_MULTILEVEL_NO_SHARED) && \
|
|
44
|
+
(defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || MLDSA_ETA == 4)
|
|
45
|
+
|
|
46
|
+
/*
|
|
47
|
+
* WARNING: This file is auto-derived from the mldsa-native source file
|
|
48
|
+
* dev/aarch64_opt/src/mldsa_rej_uniform_eta4_aarch64_asm.S using scripts/simpasm. Do not modify it directly.
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
.text
|
|
52
|
+
.balign 4
|
|
53
|
+
.global MLD_ASM_NAMESPACE(rej_uniform_eta4_aarch64_asm)
|
|
54
|
+
MLD_ASM_FN_SYMBOL(rej_uniform_eta4_aarch64_asm)
|
|
55
|
+
|
|
56
|
+
.cfi_startproc
|
|
57
|
+
sub sp, sp, #0x240
|
|
58
|
+
.cfi_adjust_cfa_offset 0x240
|
|
59
|
+
mov x7, #0x1 // =1
|
|
60
|
+
movk x7, #0x2, lsl #16
|
|
61
|
+
movk x7, #0x4, lsl #32
|
|
62
|
+
movk x7, #0x8, lsl #48
|
|
63
|
+
mov v31.d[0], x7
|
|
64
|
+
mov x7, #0x10 // =16
|
|
65
|
+
movk x7, #0x20, lsl #16
|
|
66
|
+
movk x7, #0x40, lsl #32
|
|
67
|
+
movk x7, #0x80, lsl #48
|
|
68
|
+
mov v31.d[1], x7
|
|
69
|
+
movi v30.8h, #0x9
|
|
70
|
+
movi v7.8h, #0x4
|
|
71
|
+
mov x8, sp
|
|
72
|
+
mov x7, x8
|
|
73
|
+
mov x11, #0x0 // =0
|
|
74
|
+
eor v16.16b, v16.16b, v16.16b
|
|
75
|
+
|
|
76
|
+
Lmld_rej_uniform_eta4_initial_zero:
|
|
77
|
+
str q16, [x7], #0x40
|
|
78
|
+
stur q16, [x7, #-0x30]
|
|
79
|
+
stur q16, [x7, #-0x20]
|
|
80
|
+
stur q16, [x7, #-0x10]
|
|
81
|
+
add x11, x11, #0x20
|
|
82
|
+
cmp x11, #0x100
|
|
83
|
+
b.lt Lmld_rej_uniform_eta4_initial_zero
|
|
84
|
+
mov x7, x8
|
|
85
|
+
mov x9, #0x0 // =0
|
|
86
|
+
mov x4, #0x100 // =256
|
|
87
|
+
|
|
88
|
+
Lmld_rej_uniform_eta4_loop8:
|
|
89
|
+
cmp x9, x4
|
|
90
|
+
b.hs Lmld_rej_uniform_eta4_memory_copy
|
|
91
|
+
sub x2, x2, #0x8
|
|
92
|
+
ld1 { v0.8b }, [x1], #8
|
|
93
|
+
movi v26.8b, #0xf
|
|
94
|
+
and v27.8b, v0.8b, v26.8b
|
|
95
|
+
ushr v28.8b, v0.8b, #0x4
|
|
96
|
+
zip1 v26.8b, v27.8b, v28.8b
|
|
97
|
+
zip2 v29.8b, v27.8b, v28.8b
|
|
98
|
+
ushll v16.8h, v26.8b, #0x0
|
|
99
|
+
ushll v17.8h, v29.8b, #0x0
|
|
100
|
+
cmhi v4.8h, v30.8h, v16.8h
|
|
101
|
+
cmhi v5.8h, v30.8h, v17.8h
|
|
102
|
+
and v4.16b, v4.16b, v31.16b
|
|
103
|
+
and v5.16b, v5.16b, v31.16b
|
|
104
|
+
uaddlv s20, v4.8h
|
|
105
|
+
uaddlv s21, v5.8h
|
|
106
|
+
fmov w12, s20
|
|
107
|
+
fmov w13, s21
|
|
108
|
+
ldr q24, [x3, x12, lsl #4]
|
|
109
|
+
ldr q25, [x3, x13, lsl #4]
|
|
110
|
+
cnt v4.16b, v4.16b
|
|
111
|
+
cnt v5.16b, v5.16b
|
|
112
|
+
uaddlv s20, v4.8h
|
|
113
|
+
uaddlv s21, v5.8h
|
|
114
|
+
fmov w12, s20
|
|
115
|
+
fmov w13, s21
|
|
116
|
+
tbl v16.16b, { v16.16b }, v24.16b
|
|
117
|
+
tbl v17.16b, { v17.16b }, v25.16b
|
|
118
|
+
st1 { v16.8h }, [x7]
|
|
119
|
+
add x7, x7, x12, lsl #1
|
|
120
|
+
st1 { v17.8h }, [x7]
|
|
121
|
+
add x7, x7, x13, lsl #1
|
|
122
|
+
add x12, x12, x13
|
|
123
|
+
add x9, x9, x12
|
|
124
|
+
cmp x2, #0x8
|
|
125
|
+
b.hs Lmld_rej_uniform_eta4_loop8
|
|
126
|
+
|
|
127
|
+
Lmld_rej_uniform_eta4_memory_copy:
|
|
128
|
+
cmp x9, x4
|
|
129
|
+
csel x9, x9, x4, lo
|
|
130
|
+
mov x11, #0x0 // =0
|
|
131
|
+
mov x7, x8
|
|
132
|
+
|
|
133
|
+
Lmld_rej_uniform_eta4_final_copy:
|
|
134
|
+
ldr q16, [x7], #0x20
|
|
135
|
+
ldur q18, [x7, #-0x10]
|
|
136
|
+
sub v16.8h, v7.8h, v16.8h
|
|
137
|
+
sub v18.8h, v7.8h, v18.8h
|
|
138
|
+
sshll2 v17.4s, v16.8h, #0x0
|
|
139
|
+
sshll v16.4s, v16.4h, #0x0
|
|
140
|
+
sshll2 v19.4s, v18.8h, #0x0
|
|
141
|
+
sshll v18.4s, v18.4h, #0x0
|
|
142
|
+
str q16, [x0], #0x40
|
|
143
|
+
stur q17, [x0, #-0x30]
|
|
144
|
+
stur q18, [x0, #-0x20]
|
|
145
|
+
stur q19, [x0, #-0x10]
|
|
146
|
+
add x11, x11, #0x10
|
|
147
|
+
cmp x11, #0x100
|
|
148
|
+
b.lt Lmld_rej_uniform_eta4_final_copy
|
|
149
|
+
mov x0, x9
|
|
150
|
+
add sp, sp, #0x240
|
|
151
|
+
.cfi_adjust_cfa_offset -0x240
|
|
152
|
+
ret
|
|
153
|
+
.cfi_endproc
|
|
154
|
+
|
|
155
|
+
MLD_ASM_FN_SIZE(rej_uniform_eta4_aarch64_asm)
|
|
156
|
+
|
|
157
|
+
#endif /* MLD_ARITH_BACKEND_AARCH64 && !MLD_CONFIG_NO_KEYPAIR_API && \
|
|
158
|
+
!MLD_CONFIG_MULTILEVEL_NO_SHARED && \
|
|
159
|
+
(MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLDSA_ETA == 4) */
|
|
160
|
+
|
|
161
|
+
#if defined(__ELF__)
|
|
162
|
+
.section .note.GNU-stack,"",%progbits
|
|
163
|
+
#endif
|
data/ext/mldsa_gh_native/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_table.c
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) The mldsa-native project authors
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* WARNING: This file is auto-generated from scripts/autogen
|
|
8
|
+
* in the mldsa-native repository.
|
|
9
|
+
* Do not modify it directly.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
#include "../../../common.h"
|
|
13
|
+
|
|
14
|
+
#if defined(MLD_ARITH_BACKEND_AARCH64) && \
|
|
15
|
+
!defined(MLD_CONFIG_MULTILEVEL_NO_SHARED)
|
|
16
|
+
|
|
17
|
+
#include "arith_native_aarch64.h"
|
|
18
|
+
|
|
19
|
+
#if !defined(MLD_CONFIG_NO_SIGN_API) || !defined(MLD_CONFIG_NO_VERIFY_API)
|
|
20
|
+
/* Table of indices used for tbl instructions in polyz_unpack_{17,19}.
|
|
21
|
+
* See autogen for details. */
|
|
22
|
+
|
|
23
|
+
#if defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || MLD_CONFIG_PARAMETER_SET == 44
|
|
24
|
+
MLD_ALIGN MLD_INTERNAL_DATA_DEFINITION const uint8_t
|
|
25
|
+
mld_polyz_unpack_17_indices[64] = {
|
|
26
|
+
0, 1, 2, 255, 2, 3, 4, 255, 4, 5, 6, 255, 6, 7, 8, 255,
|
|
27
|
+
9, 10, 11, 255, 11, 12, 13, 255, 13, 14, 15, 255, 15, 16, 17, 255,
|
|
28
|
+
2, 3, 4, 255, 4, 5, 6, 255, 6, 7, 8, 255, 8, 9, 10, 255,
|
|
29
|
+
11, 12, 13, 255, 13, 14, 15, 255, 15, 28, 29, 255, 29, 30, 31, 255,
|
|
30
|
+
};
|
|
31
|
+
#endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLD_CONFIG_PARAMETER_SET == 44 \
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
#if defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || \
|
|
35
|
+
(MLD_CONFIG_PARAMETER_SET == 65 || MLD_CONFIG_PARAMETER_SET == 87)
|
|
36
|
+
MLD_ALIGN MLD_INTERNAL_DATA_DEFINITION const uint8_t
|
|
37
|
+
mld_polyz_unpack_19_indices[64] = {
|
|
38
|
+
0, 1, 2, 255, 2, 3, 4, 255, 5, 6, 7, 255, 7, 8, 9, 255,
|
|
39
|
+
10, 11, 12, 255, 12, 13, 14, 255, 15, 16, 17, 255, 17, 18, 19, 255,
|
|
40
|
+
4, 5, 6, 255, 6, 7, 8, 255, 9, 10, 11, 255, 11, 12, 13, 255,
|
|
41
|
+
14, 15, 24, 255, 24, 25, 26, 255, 27, 28, 29, 255, 29, 30, 31, 255,
|
|
42
|
+
};
|
|
43
|
+
#endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLD_CONFIG_PARAMETER_SET == 65 \
|
|
44
|
+
|| MLD_CONFIG_PARAMETER_SET == 87 */
|
|
45
|
+
|
|
46
|
+
#endif /* !MLD_CONFIG_NO_SIGN_API || !MLD_CONFIG_NO_VERIFY_API */
|
|
47
|
+
|
|
48
|
+
#else /* MLD_ARITH_BACKEND_AARCH64 && !MLD_CONFIG_MULTILEVEL_NO_SHARED */
|
|
49
|
+
|
|
50
|
+
MLD_EMPTY_CU(aarch64_polyz_unpack_table)
|
|
51
|
+
|
|
52
|
+
#endif /* !(MLD_ARITH_BACKEND_AARCH64 && !MLD_CONFIG_MULTILEVEL_NO_SHARED) */
|