pq_crypto 0.6.1 → 0.6.2
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 +4 -4
- data/CHANGELOG.md +5 -0
- data/SECURITY.md +7 -0
- data/ext/pqcrypto/pqcrypto_version.h +1 -1
- data/ext/pqcrypto/vendor/.vendored +4 -4
- data/ext/pqcrypto/vendor/mldsa-native/README.md +23 -10
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/README.md +23 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native.c +114 -58
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native.h +498 -461
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native_asm.S +145 -85
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native_config.h +456 -422
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/cbmc.h +47 -25
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/common.h +26 -14
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/ct.h +56 -81
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/debug.h +17 -24
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202.c +33 -40
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202.h +67 -87
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202x4.c +19 -14
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202x4.h +13 -5
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/keccakf1600.c +84 -10
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/keccakf1600.h +10 -5
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/auto.h +6 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/fips202_native_aarch64.h +22 -15
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_scalar_aarch64_asm.S +376 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_v84a_aarch64_asm.S +204 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x2_v84a_aarch64_asm.S +259 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_scalar_hybrid_aarch64_asm.S +1077 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_v84a_scalar_hybrid_aarch64_asm.S +987 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccakf1600_round_constants.c +16 -10
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x1_scalar.h +2 -1
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x1_v84a.h +1 -1
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x2_v84a.h +4 -2
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x4_v8a_scalar.h +2 -2
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x4_v8a_v84a_scalar.h +1 -1
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/api.h +60 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/mve.h +48 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/fips202_native_armv81m.h +18 -1
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S +658 -582
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.c +5 -100
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccakf1600_round_constants.c +26 -25
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/state_extract_bytes_x4_mve.S +334 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/state_xor_bytes_x4_mve.S +355 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/auto.h +8 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/{xkcp.h → keccak_f1600_x4_avx2.h} +11 -8
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/fips202_native_x86_64.h +44 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/keccak_f1600_x4_avx2_asm.S +454 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/keccakf1600_constants.c +52 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/meta.h +37 -28
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/aarch64_zetas.c +213 -196
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/arith_native_aarch64.h +248 -64
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/intt_aarch64_asm.S +753 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l4_aarch64_asm.S +129 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l5_aarch64_asm.S +145 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l7_aarch64_asm.S +177 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/ntt_aarch64_asm.S +653 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/pointwise_montgomery_aarch64_asm.S +84 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_caddq_aarch64_asm.S +53 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_chknorm_aarch64_asm.S +55 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_decompose_32_aarch64_asm.S +86 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_decompose_88_aarch64_asm.S +86 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_use_hint_32_aarch64_asm.S +103 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_use_hint_88_aarch64_asm.S +111 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_17_aarch64_asm.S +75 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_19_aarch64_asm.S +72 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_table.c +23 -11
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_aarch64_asm.S +189 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta2_aarch64_asm.S +137 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta4_aarch64_asm.S +130 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta_table.c +520 -516
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_table.c +34 -33
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/api.h +202 -242
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/meta.h +25 -17
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/arith_native_x86_64.h +112 -28
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/consts.c +1 -1
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/consts.h +1 -1
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/intt_avx2_asm.S +2311 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/ntt_avx2_asm.S +2383 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/nttunpack_avx2_asm.S +238 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l4_avx2_asm.S +139 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l5_avx2_asm.S +155 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l7_avx2_asm.S +187 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_avx2_asm.S +130 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_caddq_avx2_asm.S +190 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_decompose_32_avx2.c +6 -4
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_decompose_88_avx2.c +6 -4
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_use_hint_32_avx2.c +9 -8
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_use_hint_88_avx2.c +10 -9
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/polyz_unpack_17_avx2.c +8 -5
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/polyz_unpack_19_avx2.c +8 -5
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_eta2_avx2.c +6 -4
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_eta4_avx2.c +6 -4
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_table.c +130 -129
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/packing.c +109 -180
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/packing.h +169 -150
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly.c +56 -40
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly.h +149 -164
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly_kl.c +52 -57
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly_kl.h +132 -167
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec.c +57 -424
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec.h +167 -474
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec_lazy.c +308 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec_lazy.h +653 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/reduce.h +22 -29
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/rounding.h +37 -43
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sign.c +511 -367
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sign.h +456 -417
- data/lib/pq_crypto/version.rb +1 -1
- data/script/vendor_libs.rb +3 -3
- metadata +41 -35
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_scalar_asm.S +0 -376
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_v84a_asm.S +0 -204
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x2_v84a_asm.S +0 -259
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_scalar_hybrid_asm.S +0 -1077
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_v84a_scalar_hybrid_asm.S +0 -987
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/KeccakP_1600_times4_SIMD256.c +0 -488
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/KeccakP_1600_times4_SIMD256.h +0 -16
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/intt.S +0 -753
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l4.S +0 -129
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l5.S +0 -145
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l7.S +0 -177
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/ntt.S +0 -653
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/pointwise_montgomery.S +0 -79
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_caddq_asm.S +0 -53
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_chknorm_asm.S +0 -55
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_decompose_32_asm.S +0 -85
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_decompose_88_asm.S +0 -85
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_use_hint_32_asm.S +0 -102
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_use_hint_88_asm.S +0 -110
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_17_asm.S +0 -72
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_19_asm.S +0 -69
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_asm.S +0 -189
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta2_asm.S +0 -135
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta4_asm.S +0 -128
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/intt.S +0 -2311
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/ntt.S +0 -2383
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/nttunpack.S +0 -239
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise.S +0 -131
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l4.S +0 -139
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l5.S +0 -155
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l7.S +0 -187
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_caddq_avx2.c +0 -61
|
@@ -18,21 +18,32 @@
|
|
|
18
18
|
#define mld_aarch64_intt_zetas_layer123456 \
|
|
19
19
|
MLD_NAMESPACE(aarch64_intt_zetas_layer123456)
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
MLD_INTERNAL_DATA_DECLARATION const int32_t
|
|
22
|
+
mld_aarch64_ntt_zetas_layer123456[144];
|
|
23
|
+
MLD_INTERNAL_DATA_DECLARATION const int32_t mld_aarch64_ntt_zetas_layer78[384];
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
MLD_INTERNAL_DATA_DECLARATION const int32_t mld_aarch64_intt_zetas_layer78[384];
|
|
26
|
+
MLD_INTERNAL_DATA_DECLARATION const int32_t
|
|
27
|
+
mld_aarch64_intt_zetas_layer123456[160];
|
|
26
28
|
|
|
27
29
|
#define mld_rej_uniform_table MLD_NAMESPACE(rej_uniform_table)
|
|
28
|
-
|
|
30
|
+
MLD_INTERNAL_DATA_DECLARATION const uint8_t mld_rej_uniform_table[256];
|
|
31
|
+
#if !defined(MLD_CONFIG_NO_KEYPAIR_API)
|
|
29
32
|
#define mld_rej_uniform_eta_table MLD_NAMESPACE(rej_uniform_eta_table)
|
|
30
|
-
|
|
33
|
+
MLD_INTERNAL_DATA_DECLARATION const uint8_t mld_rej_uniform_eta_table[4096];
|
|
34
|
+
#endif
|
|
31
35
|
|
|
36
|
+
#if !defined(MLD_CONFIG_NO_SIGN_API) || !defined(MLD_CONFIG_NO_VERIFY_API)
|
|
37
|
+
#if defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || MLD_CONFIG_PARAMETER_SET == 44
|
|
32
38
|
#define mld_polyz_unpack_17_indices MLD_NAMESPACE(polyz_unpack_17_indices)
|
|
33
|
-
|
|
39
|
+
MLD_INTERNAL_DATA_DECLARATION const uint8_t mld_polyz_unpack_17_indices[64];
|
|
40
|
+
#endif
|
|
41
|
+
#if defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || \
|
|
42
|
+
(MLD_CONFIG_PARAMETER_SET == 65 || MLD_CONFIG_PARAMETER_SET == 87)
|
|
34
43
|
#define mld_polyz_unpack_19_indices MLD_NAMESPACE(polyz_unpack_19_indices)
|
|
35
|
-
|
|
44
|
+
MLD_INTERNAL_DATA_DECLARATION const uint8_t mld_polyz_unpack_19_indices[64];
|
|
45
|
+
#endif
|
|
46
|
+
#endif /* !MLD_CONFIG_NO_SIGN_API || !MLD_CONFIG_NO_VERIFY_API */
|
|
36
47
|
|
|
37
48
|
|
|
38
49
|
/*
|
|
@@ -49,11 +60,11 @@ extern const uint8_t mld_polyz_unpack_19_indices[];
|
|
|
49
60
|
*/
|
|
50
61
|
#define MLD_AARCH64_REJ_UNIFORM_ETA4_BUFLEN (2 * 136)
|
|
51
62
|
|
|
52
|
-
#define
|
|
53
|
-
void
|
|
54
|
-
|
|
63
|
+
#define mld_ntt_aarch64_asm MLD_NAMESPACE(ntt_aarch64_asm)
|
|
64
|
+
void mld_ntt_aarch64_asm(int32_t *r, const int32_t *zetas_l123456,
|
|
65
|
+
const int32_t *zetas_l78)
|
|
55
66
|
/* This must be kept in sync with the HOL-Light specification
|
|
56
|
-
* in proofs/hol_light/aarch64/proofs/
|
|
67
|
+
* in proofs/hol_light/aarch64/proofs/ntt_aarch64_asm.ml */
|
|
57
68
|
__contract__(
|
|
58
69
|
requires(memory_no_alias(r, sizeof(int32_t) * MLDSA_N))
|
|
59
70
|
requires(array_abs_bound(r, 0, MLDSA_N, 8380417))
|
|
@@ -65,34 +76,94 @@ __contract__(
|
|
|
65
76
|
/* check-magic: on */
|
|
66
77
|
);
|
|
67
78
|
|
|
68
|
-
#define
|
|
69
|
-
void
|
|
79
|
+
#define mld_intt_aarch64_asm MLD_NAMESPACE(intt_aarch64_asm)
|
|
80
|
+
void mld_intt_aarch64_asm(int32_t *r, const int32_t *zetas_l78,
|
|
81
|
+
const int32_t *zetas_l123456)
|
|
82
|
+
/* This must be kept in sync with the HOL-Light specification
|
|
83
|
+
* in proofs/hol_light/aarch64/proofs/intt_aarch64_asm.ml */
|
|
84
|
+
__contract__(
|
|
85
|
+
requires(memory_no_alias(r, sizeof(int32_t) * MLDSA_N))
|
|
86
|
+
requires(array_abs_bound(r, 0, MLDSA_N, 8380417))
|
|
87
|
+
requires(zetas_l78 == mld_aarch64_intt_zetas_layer78)
|
|
88
|
+
requires(zetas_l123456 == mld_aarch64_intt_zetas_layer123456)
|
|
89
|
+
assigns(memory_slice(r, sizeof(int32_t) * MLDSA_N))
|
|
90
|
+
/* check-magic: off */
|
|
91
|
+
ensures(array_abs_bound(r, 0, MLDSA_N, 8380417))
|
|
92
|
+
/* check-magic: on */
|
|
93
|
+
);
|
|
70
94
|
|
|
71
|
-
#define
|
|
95
|
+
#define mld_rej_uniform_aarch64_asm MLD_NAMESPACE(rej_uniform_aarch64_asm)
|
|
72
96
|
MLD_MUST_CHECK_RETURN_VALUE
|
|
73
|
-
uint64_t
|
|
74
|
-
|
|
97
|
+
uint64_t mld_rej_uniform_aarch64_asm(int32_t *r, const uint8_t *buf,
|
|
98
|
+
unsigned buflen, const uint8_t *table)
|
|
99
|
+
/* This must be kept in sync with the HOL-Light specification
|
|
100
|
+
* in proofs/hol_light/aarch64/proofs/rej_uniform_aarch64_asm.ml. */
|
|
101
|
+
__contract__(
|
|
102
|
+
requires(buflen % 24 == 0)
|
|
103
|
+
requires(memory_no_alias(buf, buflen))
|
|
104
|
+
requires(table == mld_rej_uniform_table)
|
|
105
|
+
requires(memory_no_alias(r, sizeof(int32_t) * MLDSA_N))
|
|
106
|
+
assigns(memory_slice(r, sizeof(int32_t) * MLDSA_N))
|
|
107
|
+
ensures(return_value <= MLDSA_N)
|
|
108
|
+
ensures(array_bound(r, 0, (unsigned) return_value, 0, MLDSA_Q))
|
|
109
|
+
);
|
|
75
110
|
|
|
76
|
-
#
|
|
111
|
+
#if !defined(MLD_CONFIG_NO_KEYPAIR_API)
|
|
112
|
+
#define mld_rej_uniform_eta2_aarch64_asm \
|
|
113
|
+
MLD_NAMESPACE(rej_uniform_eta2_aarch64_asm)
|
|
77
114
|
MLD_MUST_CHECK_RETURN_VALUE
|
|
78
|
-
uint64_t
|
|
79
|
-
|
|
115
|
+
uint64_t mld_rej_uniform_eta2_aarch64_asm(int32_t *r, const uint8_t *buf,
|
|
116
|
+
unsigned buflen,
|
|
117
|
+
const uint8_t *table);
|
|
80
118
|
|
|
81
|
-
#define
|
|
119
|
+
#define mld_rej_uniform_eta4_aarch64_asm \
|
|
120
|
+
MLD_NAMESPACE(rej_uniform_eta4_aarch64_asm)
|
|
82
121
|
MLD_MUST_CHECK_RETURN_VALUE
|
|
83
|
-
uint64_t
|
|
84
|
-
|
|
122
|
+
uint64_t mld_rej_uniform_eta4_aarch64_asm(int32_t *r, const uint8_t *buf,
|
|
123
|
+
unsigned buflen,
|
|
124
|
+
const uint8_t *table);
|
|
125
|
+
#endif /* !MLD_CONFIG_NO_KEYPAIR_API */
|
|
85
126
|
|
|
86
|
-
#
|
|
87
|
-
|
|
127
|
+
#if !defined(MLD_CONFIG_NO_SIGN_API)
|
|
128
|
+
#define mld_poly_decompose_32_aarch64_asm \
|
|
129
|
+
MLD_NAMESPACE(poly_decompose_32_aarch64_asm)
|
|
130
|
+
void mld_poly_decompose_32_aarch64_asm(int32_t *a1, int32_t *a0)
|
|
131
|
+
/* This must be kept in sync with the HOL-Light specification
|
|
132
|
+
* in proofs/hol_light/aarch64/proofs/poly_decompose_32_aarch64_asm.ml */
|
|
133
|
+
__contract__(
|
|
134
|
+
requires(memory_no_alias(a1, sizeof(int32_t) * MLDSA_N))
|
|
135
|
+
requires(memory_no_alias(a0, sizeof(int32_t) * MLDSA_N))
|
|
136
|
+
requires(array_bound(a0, 0, MLDSA_N, 0, MLDSA_Q))
|
|
137
|
+
assigns(memory_slice(a1, sizeof(int32_t) * MLDSA_N))
|
|
138
|
+
assigns(memory_slice(a0, sizeof(int32_t) * MLDSA_N))
|
|
139
|
+
/* check-magic: 16 == (MLDSA_Q - 1) / (2 * ((MLDSA_Q - 1) / 32)) */
|
|
140
|
+
ensures(array_bound(a1, 0, MLDSA_N, 0, 16))
|
|
141
|
+
/* check-magic: 261889 == (MLDSA_Q - 1) / 32 + 1 */
|
|
142
|
+
ensures(array_abs_bound(a0, 0, MLDSA_N, 261889))
|
|
143
|
+
);
|
|
88
144
|
|
|
89
|
-
#define
|
|
90
|
-
|
|
145
|
+
#define mld_poly_decompose_88_aarch64_asm \
|
|
146
|
+
MLD_NAMESPACE(poly_decompose_88_aarch64_asm)
|
|
147
|
+
void mld_poly_decompose_88_aarch64_asm(int32_t *a1, int32_t *a0)
|
|
148
|
+
/* This must be kept in sync with the HOL-Light specification
|
|
149
|
+
* in proofs/hol_light/aarch64/proofs/poly_decompose_88_aarch64_asm.ml */
|
|
150
|
+
__contract__(
|
|
151
|
+
requires(memory_no_alias(a1, sizeof(int32_t) * MLDSA_N))
|
|
152
|
+
requires(memory_no_alias(a0, sizeof(int32_t) * MLDSA_N))
|
|
153
|
+
requires(array_bound(a0, 0, MLDSA_N, 0, MLDSA_Q))
|
|
154
|
+
assigns(memory_slice(a1, sizeof(int32_t) * MLDSA_N))
|
|
155
|
+
assigns(memory_slice(a0, sizeof(int32_t) * MLDSA_N))
|
|
156
|
+
/* check-magic: 44 == (MLDSA_Q - 1) / (2 * ((MLDSA_Q - 1) / 88)) */
|
|
157
|
+
ensures(array_bound(a1, 0, MLDSA_N, 0, 44))
|
|
158
|
+
/* check-magic: 95233 == (MLDSA_Q - 1) / 88 + 1 */
|
|
159
|
+
ensures(array_abs_bound(a0, 0, MLDSA_N, 95233))
|
|
160
|
+
);
|
|
161
|
+
#endif /* !MLD_CONFIG_NO_SIGN_API */
|
|
91
162
|
|
|
92
|
-
#define
|
|
93
|
-
void
|
|
163
|
+
#define mld_poly_caddq_aarch64_asm MLD_NAMESPACE(poly_caddq_aarch64_asm)
|
|
164
|
+
void mld_poly_caddq_aarch64_asm(int32_t *a)
|
|
94
165
|
/* This must be kept in sync with the HOL-Light specification
|
|
95
|
-
* in proofs/hol_light/aarch64/proofs/
|
|
166
|
+
* in proofs/hol_light/aarch64/proofs/poly_caddq_aarch64_asm.ml */
|
|
96
167
|
__contract__(
|
|
97
168
|
requires(memory_no_alias(a, sizeof(int32_t) * MLDSA_N))
|
|
98
169
|
requires(array_abs_bound(a, 0, MLDSA_N, MLDSA_Q))
|
|
@@ -100,17 +171,41 @@ __contract__(
|
|
|
100
171
|
ensures(array_bound(a, 0, MLDSA_N, 0, MLDSA_Q))
|
|
101
172
|
);
|
|
102
173
|
|
|
103
|
-
#
|
|
104
|
-
|
|
174
|
+
#if !defined(MLD_CONFIG_NO_VERIFY_API)
|
|
175
|
+
#define mld_poly_use_hint_32_aarch64_asm \
|
|
176
|
+
MLD_NAMESPACE(poly_use_hint_32_aarch64_asm)
|
|
177
|
+
void mld_poly_use_hint_32_aarch64_asm(int32_t *a, const int32_t *h)
|
|
178
|
+
/* This must be kept in sync with the HOL-Light specification
|
|
179
|
+
* in proofs/hol_light/aarch64/proofs/poly_use_hint_32_aarch64_asm.ml */
|
|
180
|
+
__contract__(
|
|
181
|
+
requires(memory_no_alias(a, sizeof(int32_t) * MLDSA_N))
|
|
182
|
+
requires(memory_no_alias(h, sizeof(int32_t) * MLDSA_N))
|
|
183
|
+
requires(array_bound(a, 0, MLDSA_N, 0, MLDSA_Q))
|
|
184
|
+
requires(array_bound(h, 0, MLDSA_N, 0, 2))
|
|
185
|
+
assigns(memory_slice(a, sizeof(int32_t) * MLDSA_N))
|
|
186
|
+
ensures(array_bound(a, 0, MLDSA_N, 0, 16))
|
|
187
|
+
);
|
|
105
188
|
|
|
106
|
-
#define
|
|
107
|
-
|
|
189
|
+
#define mld_poly_use_hint_88_aarch64_asm \
|
|
190
|
+
MLD_NAMESPACE(poly_use_hint_88_aarch64_asm)
|
|
191
|
+
void mld_poly_use_hint_88_aarch64_asm(int32_t *a, const int32_t *h)
|
|
192
|
+
/* This must be kept in sync with the HOL-Light specification
|
|
193
|
+
* in proofs/hol_light/aarch64/proofs/poly_use_hint_88_aarch64_asm.ml */
|
|
194
|
+
__contract__(
|
|
195
|
+
requires(memory_no_alias(a, sizeof(int32_t) * MLDSA_N))
|
|
196
|
+
requires(memory_no_alias(h, sizeof(int32_t) * MLDSA_N))
|
|
197
|
+
requires(array_bound(a, 0, MLDSA_N, 0, MLDSA_Q))
|
|
198
|
+
requires(array_bound(h, 0, MLDSA_N, 0, 2))
|
|
199
|
+
assigns(memory_slice(a, sizeof(int32_t) * MLDSA_N))
|
|
200
|
+
ensures(array_bound(a, 0, MLDSA_N, 0, 44))
|
|
201
|
+
);
|
|
202
|
+
#endif /* !MLD_CONFIG_NO_VERIFY_API */
|
|
108
203
|
|
|
109
|
-
#define
|
|
204
|
+
#define mld_poly_chknorm_aarch64_asm MLD_NAMESPACE(poly_chknorm_aarch64_asm)
|
|
110
205
|
MLD_MUST_CHECK_RETURN_VALUE
|
|
111
|
-
int
|
|
206
|
+
int mld_poly_chknorm_aarch64_asm(const int32_t *a, int32_t B)
|
|
112
207
|
/* This must be kept in sync with the HOL-Light specification
|
|
113
|
-
* in proofs/hol_light/aarch64/proofs/
|
|
208
|
+
* in proofs/hol_light/aarch64/proofs/poly_chknorm_aarch64_asm.ml */
|
|
114
209
|
__contract__(
|
|
115
210
|
requires(memory_no_alias(a, sizeof(int32_t) * MLDSA_N))
|
|
116
211
|
/* HOL Light precondition: abs(ival(x i)) < 2^31, i.e., a[i] != INT32_MIN */
|
|
@@ -119,32 +214,121 @@ __contract__(
|
|
|
119
214
|
ensures((return_value == 0) == array_abs_bound(a, 0, MLDSA_N, B))
|
|
120
215
|
);
|
|
121
216
|
|
|
122
|
-
#
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
#
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
217
|
+
#if !defined(MLD_CONFIG_NO_SIGN_API) || !defined(MLD_CONFIG_NO_VERIFY_API)
|
|
218
|
+
#if defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || MLD_CONFIG_PARAMETER_SET == 44
|
|
219
|
+
#define mld_polyz_unpack_17_aarch64_asm \
|
|
220
|
+
MLD_NAMESPACE(polyz_unpack_17_aarch64_asm)
|
|
221
|
+
void mld_polyz_unpack_17_aarch64_asm(int32_t *r, const uint8_t *buf,
|
|
222
|
+
const uint8_t *indices)
|
|
223
|
+
/* This must be kept in sync with the HOL-Light specification
|
|
224
|
+
* in proofs/hol_light/aarch64/proofs/polyz_unpack_17_aarch64_asm.ml */
|
|
225
|
+
__contract__(
|
|
226
|
+
requires(memory_no_alias(r, sizeof(int32_t) * MLDSA_N))
|
|
227
|
+
requires(memory_no_alias(buf, 576))
|
|
228
|
+
requires(indices == mld_polyz_unpack_17_indices)
|
|
229
|
+
assigns(memory_slice(r, sizeof(int32_t) * MLDSA_N))
|
|
230
|
+
ensures(array_bound(r, 0, MLDSA_N, -((1 << 17) - 1), (1 << 17) + 1))
|
|
231
|
+
);
|
|
232
|
+
#endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLD_CONFIG_PARAMETER_SET == 44 \
|
|
233
|
+
*/
|
|
234
|
+
|
|
235
|
+
#if defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || \
|
|
236
|
+
(MLD_CONFIG_PARAMETER_SET == 65 || MLD_CONFIG_PARAMETER_SET == 87)
|
|
237
|
+
#define mld_polyz_unpack_19_aarch64_asm \
|
|
238
|
+
MLD_NAMESPACE(polyz_unpack_19_aarch64_asm)
|
|
239
|
+
void mld_polyz_unpack_19_aarch64_asm(int32_t *r, const uint8_t *buf,
|
|
240
|
+
const uint8_t *indices)
|
|
241
|
+
/* This must be kept in sync with the HOL-Light specification
|
|
242
|
+
* in proofs/hol_light/aarch64/proofs/polyz_unpack_19_aarch64_asm.ml */
|
|
243
|
+
__contract__(
|
|
244
|
+
requires(memory_no_alias(r, sizeof(int32_t) * MLDSA_N))
|
|
245
|
+
requires(memory_no_alias(buf, 640))
|
|
246
|
+
requires(indices == mld_polyz_unpack_19_indices)
|
|
247
|
+
assigns(memory_slice(r, sizeof(int32_t) * MLDSA_N))
|
|
248
|
+
ensures(array_bound(r, 0, MLDSA_N, -((1 << 19) - 1), (1 << 19) + 1))
|
|
249
|
+
);
|
|
250
|
+
#endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLD_CONFIG_PARAMETER_SET == 65 \
|
|
251
|
+
|| MLD_CONFIG_PARAMETER_SET == 87 */
|
|
252
|
+
#endif /* !MLD_CONFIG_NO_SIGN_API || !MLD_CONFIG_NO_VERIFY_API */
|
|
253
|
+
|
|
254
|
+
#if !defined(MLD_CONFIG_NO_SIGN_API) || !defined(MLD_CONFIG_NO_VERIFY_API) || \
|
|
255
|
+
defined(MLD_CONFIG_REDUCE_RAM) || defined(MLD_UNIT_TEST)
|
|
256
|
+
#define mld_poly_pointwise_montgomery_aarch64_asm \
|
|
257
|
+
MLD_NAMESPACE(poly_pointwise_montgomery_aarch64_asm)
|
|
258
|
+
void mld_poly_pointwise_montgomery_aarch64_asm(int32_t *a, const int32_t *b)
|
|
259
|
+
/* This must be kept in sync with the HOL-Light specification
|
|
260
|
+
* in proofs/hol_light/aarch64/proofs/pointwise_montgomery_aarch64_asm.ml */
|
|
261
|
+
__contract__(
|
|
262
|
+
requires(memory_no_alias(a, sizeof(int32_t) * MLDSA_N))
|
|
263
|
+
requires(memory_no_alias(b, sizeof(int32_t) * MLDSA_N))
|
|
264
|
+
/* check-magic: off */
|
|
265
|
+
requires(array_abs_bound(a, 0, MLDSA_N, 75423753))
|
|
266
|
+
requires(array_abs_bound(b, 0, MLDSA_N, 75423753))
|
|
267
|
+
assigns(memory_slice(a, sizeof(int32_t) * MLDSA_N))
|
|
268
|
+
ensures(array_abs_bound(a, 0, MLDSA_N, 8380417))
|
|
269
|
+
/* check-magic: on */
|
|
270
|
+
);
|
|
271
|
+
#endif /* !MLD_CONFIG_NO_SIGN_API || !MLD_CONFIG_NO_VERIFY_API || \
|
|
272
|
+
MLD_CONFIG_REDUCE_RAM || MLD_UNIT_TEST */
|
|
273
|
+
|
|
274
|
+
#define mld_polyvecl_pointwise_acc_montgomery_l4_aarch64_asm \
|
|
275
|
+
MLD_NAMESPACE(polyvecl_pointwise_acc_montgomery_l4_aarch64_asm)
|
|
276
|
+
void mld_polyvecl_pointwise_acc_montgomery_l4_aarch64_asm(
|
|
277
|
+
int32_t *r, const int32_t a[4][MLDSA_N], const int32_t b[4][MLDSA_N])
|
|
278
|
+
/* This must be kept in sync with the HOL-Light specification
|
|
279
|
+
* in
|
|
280
|
+
* proofs/hol_light/aarch64/proofs/mld_polyvecl_pointwise_acc_montgomery_l4_aarch64_asm.ml
|
|
281
|
+
*/
|
|
282
|
+
__contract__(
|
|
283
|
+
requires(memory_no_alias(r, sizeof(int32_t) * MLDSA_N))
|
|
284
|
+
requires(memory_no_alias(a, sizeof(int32_t) * 4 * MLDSA_N))
|
|
285
|
+
requires(memory_no_alias(b, sizeof(int32_t) * 4 * MLDSA_N))
|
|
286
|
+
/* check-magic: off */
|
|
287
|
+
requires(forall(l0, 0, 4, array_abs_bound(a[l0], 0, MLDSA_N, 8380417)))
|
|
288
|
+
requires(forall(l1, 0, 4, array_abs_bound(b[l1], 0, MLDSA_N, 75423753)))
|
|
289
|
+
assigns(memory_slice(r, sizeof(int32_t) * MLDSA_N))
|
|
290
|
+
ensures(array_abs_bound(r, 0, MLDSA_N, 8380417))
|
|
291
|
+
/* check-magic: on */
|
|
292
|
+
);
|
|
293
|
+
|
|
294
|
+
#define mld_polyvecl_pointwise_acc_montgomery_l5_aarch64_asm \
|
|
295
|
+
MLD_NAMESPACE(polyvecl_pointwise_acc_montgomery_l5_aarch64_asm)
|
|
296
|
+
void mld_polyvecl_pointwise_acc_montgomery_l5_aarch64_asm(
|
|
297
|
+
int32_t *r, const int32_t a[5][MLDSA_N], const int32_t b[5][MLDSA_N])
|
|
298
|
+
/* This must be kept in sync with the HOL-Light specification
|
|
299
|
+
* in
|
|
300
|
+
* proofs/hol_light/aarch64/proofs/mld_polyvecl_pointwise_acc_montgomery_l5_aarch64_asm.ml
|
|
301
|
+
*/
|
|
302
|
+
__contract__(
|
|
303
|
+
requires(memory_no_alias(r, sizeof(int32_t) * MLDSA_N))
|
|
304
|
+
requires(memory_no_alias(a, sizeof(int32_t) * 5 * MLDSA_N))
|
|
305
|
+
requires(memory_no_alias(b, sizeof(int32_t) * 5 * MLDSA_N))
|
|
306
|
+
/* check-magic: off */
|
|
307
|
+
requires(forall(l0, 0, 5, array_abs_bound(a[l0], 0, MLDSA_N, 8380417)))
|
|
308
|
+
requires(forall(l1, 0, 5, array_abs_bound(b[l1], 0, MLDSA_N, 75423753)))
|
|
309
|
+
assigns(memory_slice(r, sizeof(int32_t) * MLDSA_N))
|
|
310
|
+
ensures(array_abs_bound(r, 0, MLDSA_N, 8380417))
|
|
311
|
+
/* check-magic: on */
|
|
312
|
+
);
|
|
313
|
+
|
|
314
|
+
#define mld_polyvecl_pointwise_acc_montgomery_l7_aarch64_asm \
|
|
315
|
+
MLD_NAMESPACE(polyvecl_pointwise_acc_montgomery_l7_aarch64_asm)
|
|
316
|
+
void mld_polyvecl_pointwise_acc_montgomery_l7_aarch64_asm(
|
|
317
|
+
int32_t *r, const int32_t a[7][MLDSA_N], const int32_t b[7][MLDSA_N])
|
|
318
|
+
/* This must be kept in sync with the HOL-Light specification
|
|
319
|
+
* in
|
|
320
|
+
* proofs/hol_light/aarch64/proofs/mld_polyvecl_pointwise_acc_montgomery_l7_aarch64_asm.ml
|
|
321
|
+
*/
|
|
322
|
+
__contract__(
|
|
323
|
+
requires(memory_no_alias(r, sizeof(int32_t) * MLDSA_N))
|
|
324
|
+
requires(memory_no_alias(a, sizeof(int32_t) * 7 * MLDSA_N))
|
|
325
|
+
requires(memory_no_alias(b, sizeof(int32_t) * 7 * MLDSA_N))
|
|
326
|
+
/* check-magic: off */
|
|
327
|
+
requires(forall(l0, 0, 7, array_abs_bound(a[l0], 0, MLDSA_N, 8380417)))
|
|
328
|
+
requires(forall(l1, 0, 7, array_abs_bound(b[l1], 0, MLDSA_N, 75423753)))
|
|
329
|
+
assigns(memory_slice(r, sizeof(int32_t) * MLDSA_N))
|
|
330
|
+
ensures(array_abs_bound(r, 0, MLDSA_N, 8380417))
|
|
331
|
+
/* check-magic: on */
|
|
332
|
+
);
|
|
149
333
|
|
|
150
334
|
#endif /* !MLD_NATIVE_AARCH64_SRC_ARITH_NATIVE_AARCH64_H */
|