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
|
@@ -16,29 +16,27 @@
|
|
|
16
16
|
* within a single compilation unit. */
|
|
17
17
|
#define mld_polyvecl MLD_ADD_PARAM_SET(mld_polyvecl)
|
|
18
18
|
#define mld_polyveck MLD_ADD_PARAM_SET(mld_polyveck)
|
|
19
|
-
#define mld_polymat MLD_ADD_PARAM_SET(mld_polymat)
|
|
20
19
|
/* End of parameter set namespacing */
|
|
21
20
|
|
|
22
|
-
|
|
21
|
+
/** Vector of MLDSA_L polynomials. */
|
|
23
22
|
typedef struct
|
|
24
23
|
{
|
|
25
|
-
mld_poly vec[MLDSA_L];
|
|
24
|
+
mld_poly vec[MLDSA_L]; /**< Component polynomials. */
|
|
26
25
|
} mld_polyvecl;
|
|
27
26
|
|
|
28
27
|
|
|
28
|
+
#if !defined(MLD_CONFIG_NO_SIGN_API) && \
|
|
29
|
+
(!defined(MLD_CONFIG_REDUCE_RAM) || defined(MLD_UNIT_TEST))
|
|
29
30
|
#define mld_polyvecl_uniform_gamma1 MLD_NAMESPACE_KL(polyvecl_uniform_gamma1)
|
|
30
|
-
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
|
|
39
|
-
* MLDSA_CRHBYTES
|
|
40
|
-
* - uint16_t nonce: 16-bit nonce
|
|
41
|
-
*************************************************/
|
|
31
|
+
/**
|
|
32
|
+
* Sample vector of polynomials with uniformly random coefficients in
|
|
33
|
+
* [-(MLDSA_GAMMA1 - 1), MLDSA_GAMMA1] by unpacking output stream of
|
|
34
|
+
* SHAKE256(seed|nonce).
|
|
35
|
+
*
|
|
36
|
+
* @param[out] v Pointer to output vector.
|
|
37
|
+
* @param[in] seed Byte array with seed of length MLDSA_CRHBYTES.
|
|
38
|
+
* @param nonce 16-bit nonce.
|
|
39
|
+
*/
|
|
42
40
|
MLD_INTERNAL_API
|
|
43
41
|
void mld_polyvecl_uniform_gamma1(mld_polyvecl *v,
|
|
44
42
|
const uint8_t seed[MLDSA_CRHBYTES],
|
|
@@ -51,16 +49,20 @@ __contract__(
|
|
|
51
49
|
ensures(forall(k0, 0, MLDSA_L,
|
|
52
50
|
array_bound(v->vec[k0].coeffs, 0, MLDSA_N, -(MLDSA_GAMMA1 - 1), MLDSA_GAMMA1 + 1)))
|
|
53
51
|
);
|
|
52
|
+
#endif /* !MLD_CONFIG_NO_SIGN_API && (!MLD_CONFIG_REDUCE_RAM || MLD_UNIT_TEST) \
|
|
53
|
+
*/
|
|
54
54
|
|
|
55
|
+
#if !defined(MLD_CONFIG_NO_KEYPAIR_API) || \
|
|
56
|
+
!defined(MLD_CONFIG_NO_VERIFY_API) || \
|
|
57
|
+
(!defined(MLD_CONFIG_NO_SIGN_API) && \
|
|
58
|
+
(!defined(MLD_CONFIG_REDUCE_RAM) || defined(MLD_UNIT_TEST)))
|
|
55
59
|
#define mld_polyvecl_ntt MLD_NAMESPACE_KL(polyvecl_ntt)
|
|
56
|
-
|
|
57
|
-
*
|
|
60
|
+
/**
|
|
61
|
+
* Forward NTT of all polynomials in vector of length MLDSA_L. Coefficients
|
|
62
|
+
* can grow by 8*MLDSA_Q in absolute value.
|
|
58
63
|
*
|
|
59
|
-
*
|
|
60
|
-
|
|
61
|
-
*
|
|
62
|
-
* Arguments: - mld_polyvecl *v: pointer to input/output vector
|
|
63
|
-
**************************************************/
|
|
64
|
+
* @param[in,out] v Pointer to input/output vector.
|
|
65
|
+
*/
|
|
64
66
|
MLD_INTERNAL_API
|
|
65
67
|
void mld_polyvecl_ntt(mld_polyvecl *v)
|
|
66
68
|
__contract__(
|
|
@@ -69,30 +71,28 @@ __contract__(
|
|
|
69
71
|
assigns(memory_slice(v, sizeof(mld_polyvecl)))
|
|
70
72
|
ensures(forall(k1, 0, MLDSA_L, array_abs_bound(v->vec[k1].coeffs, 0, MLDSA_N, MLD_NTT_BOUND)))
|
|
71
73
|
);
|
|
74
|
+
#endif /* !MLD_CONFIG_NO_KEYPAIR_API || !MLD_CONFIG_NO_VERIFY_API || \
|
|
75
|
+
(!MLD_CONFIG_NO_SIGN_API && (!MLD_CONFIG_REDUCE_RAM || \
|
|
76
|
+
MLD_UNIT_TEST)) */
|
|
72
77
|
|
|
78
|
+
#if !defined(MLD_CONFIG_REDUCE_RAM) || defined(MLD_UNIT_TEST)
|
|
73
79
|
#define mld_polyvecl_pointwise_acc_montgomery \
|
|
74
80
|
MLD_NAMESPACE_KL(polyvecl_pointwise_acc_montgomery)
|
|
75
|
-
|
|
76
|
-
*
|
|
81
|
+
/**
|
|
82
|
+
* Pointwise multiply vectors of polynomials of length MLDSA_L, multiply
|
|
83
|
+
* resulting vector by 2^{-32} and add (accumulate) polynomials in it.
|
|
84
|
+
* Input/output vectors are in NTT domain representation.
|
|
77
85
|
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
* polynomials in it.
|
|
81
|
-
* Input/output vectors are in NTT domain representation.
|
|
86
|
+
* The first input "u" must be the output of polyvec_matrix_expand() and so
|
|
87
|
+
* have coefficients in [0, MLDSA_Q-1] inclusive.
|
|
82
88
|
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* inclusive.
|
|
89
|
+
* The second input "v" is assumed to be output of an NTT, and hence must have
|
|
90
|
+
* coefficients bounded by [-(9*MLDSA_Q-1), 9*MLDSA_Q-1] inclusive.
|
|
86
91
|
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
|
|
91
|
-
*
|
|
92
|
-
* Arguments: - mld_poly *w: output polynomial
|
|
93
|
-
* - const mld_polyvecl *u: pointer to first input vector
|
|
94
|
-
* - const mld_polyvecl *v: pointer to second input vector
|
|
95
|
-
**************************************************/
|
|
92
|
+
* @param[out] w Output polynomial.
|
|
93
|
+
* @param[in] u Pointer to first input vector.
|
|
94
|
+
* @param[in] v Pointer to second input vector.
|
|
95
|
+
*/
|
|
96
96
|
MLD_INTERNAL_API
|
|
97
97
|
void mld_polyvecl_pointwise_acc_montgomery(mld_poly *w, const mld_polyvecl *u,
|
|
98
98
|
const mld_polyvecl *v)
|
|
@@ -107,21 +107,20 @@ __contract__(
|
|
|
107
107
|
assigns(memory_slice(w, sizeof(mld_poly)))
|
|
108
108
|
ensures(array_abs_bound(w->coeffs, 0, MLDSA_N, MLDSA_Q))
|
|
109
109
|
);
|
|
110
|
+
#endif /* !MLD_CONFIG_REDUCE_RAM || MLD_UNIT_TEST */
|
|
110
111
|
|
|
111
|
-
|
|
112
|
+
#if !defined(MLD_CONFIG_NO_KEYPAIR_API) || !defined(MLD_CONFIG_NO_VERIFY_API)
|
|
112
113
|
#define mld_polyvecl_chknorm MLD_NAMESPACE_KL(polyvecl_chknorm)
|
|
113
|
-
|
|
114
|
-
*
|
|
114
|
+
/**
|
|
115
|
+
* Check infinity norm of polynomials in vector of length MLDSA_L. Assumes
|
|
116
|
+
* input mld_polyvecl to be reduced by polyvecl_reduce().
|
|
115
117
|
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
+
* @param[in] v Pointer to vector.
|
|
119
|
+
* @param B Norm bound.
|
|
118
120
|
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
|
|
122
|
-
* Returns 0 if norm of all polynomials is strictly smaller than B <=
|
|
123
|
-
* (MLDSA_Q-1)/8 and 0xFFFFFFFF otherwise.
|
|
124
|
-
**************************************************/
|
|
121
|
+
* @return 0 if norm of all polynomials is strictly smaller than
|
|
122
|
+
* B <= (MLDSA_Q-1)/8 and 0xFFFFFFFF otherwise.
|
|
123
|
+
*/
|
|
125
124
|
MLD_INTERNAL_API
|
|
126
125
|
MLD_MUST_CHECK_RETURN_VALUE
|
|
127
126
|
uint32_t mld_polyvecl_chknorm(const mld_polyvecl *v, int32_t B)
|
|
@@ -133,34 +132,23 @@ __contract__(
|
|
|
133
132
|
ensures(return_value == 0 || return_value == 0xFFFFFFFF)
|
|
134
133
|
ensures((return_value == 0) == forall(k1, 0, MLDSA_L, array_abs_bound(v->vec[k1].coeffs, 0, MLDSA_N, B)))
|
|
135
134
|
);
|
|
135
|
+
#endif /* !MLD_CONFIG_NO_KEYPAIR_API || !MLD_CONFIG_NO_VERIFY_API */
|
|
136
136
|
|
|
137
|
-
|
|
137
|
+
/** Vector of MLDSA_K polynomials. */
|
|
138
138
|
typedef struct
|
|
139
139
|
{
|
|
140
|
-
mld_poly vec[MLDSA_K];
|
|
140
|
+
mld_poly vec[MLDSA_K]; /**< Component polynomials. */
|
|
141
141
|
} mld_polyveck;
|
|
142
142
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
{
|
|
146
|
-
#if defined(MLD_CONFIG_REDUCE_RAM)
|
|
147
|
-
mld_polyvecl row_buffer;
|
|
148
|
-
uint8_t rho[MLDSA_SEEDBYTES];
|
|
149
|
-
#else
|
|
150
|
-
mld_polyvecl vec[MLDSA_K];
|
|
151
|
-
#endif
|
|
152
|
-
} mld_polymat;
|
|
153
|
-
|
|
143
|
+
#if (!defined(MLD_CONFIG_NO_SIGN_API) && defined(MLD_CONFIG_REDUCE_RAM)) || \
|
|
144
|
+
defined(MLD_UNIT_TEST)
|
|
154
145
|
#define mld_polyveck_reduce MLD_NAMESPACE_KL(polyveck_reduce)
|
|
155
|
-
|
|
156
|
-
*
|
|
146
|
+
/**
|
|
147
|
+
* Reduce coefficients of polynomials in vector of length MLDSA_K to
|
|
148
|
+
* representatives in [-MLD_REDUCE32_RANGE_MAX, MLD_REDUCE32_RANGE_MAX].
|
|
157
149
|
*
|
|
158
|
-
*
|
|
159
|
-
|
|
160
|
-
*[-MLD_REDUCE32_RANGE_MAX,MLD_REDUCE32_RANGE_MAX].
|
|
161
|
-
*
|
|
162
|
-
* Arguments: - mld_polyveck *v: pointer to input/output vector
|
|
163
|
-
**************************************************/
|
|
150
|
+
* @param[in,out] v Pointer to input/output vector.
|
|
151
|
+
*/
|
|
164
152
|
MLD_INTERNAL_API
|
|
165
153
|
void mld_polyveck_reduce(mld_polyveck *v)
|
|
166
154
|
__contract__(
|
|
@@ -171,16 +159,17 @@ __contract__(
|
|
|
171
159
|
ensures(forall(k1, 0, MLDSA_K,
|
|
172
160
|
array_bound(v->vec[k1].coeffs, 0, MLDSA_N, -MLD_REDUCE32_RANGE_MAX, MLD_REDUCE32_RANGE_MAX)))
|
|
173
161
|
);
|
|
162
|
+
#endif /* (!MLD_CONFIG_NO_SIGN_API && MLD_CONFIG_REDUCE_RAM) || MLD_UNIT_TEST \
|
|
163
|
+
*/
|
|
174
164
|
|
|
165
|
+
#if !defined(MLD_CONFIG_NO_SIGN_API) || defined(MLD_UNIT_TEST)
|
|
175
166
|
#define mld_polyveck_caddq MLD_NAMESPACE_KL(polyveck_caddq)
|
|
176
|
-
|
|
177
|
-
*
|
|
167
|
+
/**
|
|
168
|
+
* For all coefficients of polynomials in vector of length MLDSA_K add MLDSA_Q
|
|
169
|
+
* if coefficient is negative.
|
|
178
170
|
*
|
|
179
|
-
*
|
|
180
|
-
|
|
181
|
-
*
|
|
182
|
-
* Arguments: - mld_polyveck *v: pointer to input/output vector
|
|
183
|
-
**************************************************/
|
|
171
|
+
* @param[in,out] v Pointer to input/output vector.
|
|
172
|
+
*/
|
|
184
173
|
MLD_INTERNAL_API
|
|
185
174
|
void mld_polyveck_caddq(mld_polyveck *v)
|
|
186
175
|
__contract__(
|
|
@@ -191,83 +180,17 @@ __contract__(
|
|
|
191
180
|
ensures(forall(k1, 0, MLDSA_K,
|
|
192
181
|
array_bound(v->vec[k1].coeffs, 0, MLDSA_N, 0, MLDSA_Q)))
|
|
193
182
|
);
|
|
183
|
+
#endif /* !MLD_CONFIG_NO_SIGN_API || MLD_UNIT_TEST */
|
|
194
184
|
|
|
195
|
-
#
|
|
196
|
-
|
|
197
|
-
* Name: mld_polyveck_add
|
|
198
|
-
*
|
|
199
|
-
* Description: Add vectors of polynomials of length MLDSA_K.
|
|
200
|
-
* No modular reduction is performed.
|
|
201
|
-
*
|
|
202
|
-
* Arguments: - mld_polyveck *u: pointer to input-output vector of polynomials
|
|
203
|
-
* to be added to
|
|
204
|
-
* - const mld_polyveck *v: pointer to second input vector of
|
|
205
|
-
* polynomials
|
|
206
|
-
**************************************************/
|
|
207
|
-
MLD_INTERNAL_API
|
|
208
|
-
void mld_polyveck_add(mld_polyveck *u, const mld_polyveck *v)
|
|
209
|
-
__contract__(
|
|
210
|
-
requires(memory_no_alias(u, sizeof(mld_polyveck)))
|
|
211
|
-
requires(memory_no_alias(v, sizeof(mld_polyveck)))
|
|
212
|
-
requires(forall(p0, 0, MLDSA_K, array_abs_bound(u->vec[p0].coeffs, 0, MLDSA_N, MLD_INTT_BOUND)))
|
|
213
|
-
requires(forall(p1, 0, MLDSA_K,
|
|
214
|
-
array_bound(v->vec[p1].coeffs, 0, MLDSA_N, -MLD_REDUCE32_RANGE_MAX, MLD_REDUCE32_RANGE_MAX)))
|
|
215
|
-
assigns(memory_slice(u, sizeof(mld_polyveck)))
|
|
216
|
-
ensures(forall(q2, 0, MLDSA_K,
|
|
217
|
-
array_bound(u->vec[q2].coeffs, 0, MLDSA_N, INT32_MIN, MLD_REDUCE32_DOMAIN_MAX)))
|
|
218
|
-
);
|
|
219
|
-
|
|
220
|
-
#define mld_polyveck_sub MLD_NAMESPACE_KL(polyveck_sub)
|
|
221
|
-
/*************************************************
|
|
222
|
-
* Name: mld_polyveck_sub
|
|
223
|
-
*
|
|
224
|
-
* Description: Subtract vectors of polynomials of length MLDSA_K.
|
|
225
|
-
* No modular reduction is performed.
|
|
226
|
-
*
|
|
227
|
-
* Arguments: - mld_polyveck *u: pointer to first input vector
|
|
228
|
-
* - const mld_polyveck *v: pointer to second input vector to be
|
|
229
|
-
* subtracted from first input vector
|
|
230
|
-
**************************************************/
|
|
231
|
-
MLD_INTERNAL_API
|
|
232
|
-
void mld_polyveck_sub(mld_polyveck *u, const mld_polyveck *v)
|
|
233
|
-
__contract__(
|
|
234
|
-
requires(memory_no_alias(u, sizeof(mld_polyveck)))
|
|
235
|
-
requires(memory_no_alias(v, sizeof(mld_polyveck)))
|
|
236
|
-
requires(forall(k0, 0, MLDSA_K, array_abs_bound(u->vec[k0].coeffs, 0, MLDSA_N, MLDSA_Q)))
|
|
237
|
-
requires(forall(k1, 0, MLDSA_K, array_abs_bound(v->vec[k1].coeffs, 0, MLDSA_N, MLDSA_Q)))
|
|
238
|
-
assigns(memory_slice(u, sizeof(mld_polyveck)))
|
|
239
|
-
ensures(forall(k0, 0, MLDSA_K,
|
|
240
|
-
array_bound(u->vec[k0].coeffs, 0, MLDSA_N, INT32_MIN, MLD_REDUCE32_DOMAIN_MAX)))
|
|
241
|
-
);
|
|
242
|
-
|
|
243
|
-
#define mld_polyveck_shiftl MLD_NAMESPACE_KL(polyveck_shiftl)
|
|
244
|
-
/*************************************************
|
|
245
|
-
* Name: mld_polyveck_shiftl
|
|
246
|
-
*
|
|
247
|
-
* Description: Multiply vector of polynomials of Length MLDSA_K by 2^MLDSA_D
|
|
248
|
-
*without modular reduction. Assumes input coefficients to be less than
|
|
249
|
-
*2^{31-MLDSA_D}.
|
|
250
|
-
*
|
|
251
|
-
* Arguments: - mld_polyveck *v: pointer to input/output vector
|
|
252
|
-
**************************************************/
|
|
253
|
-
MLD_INTERNAL_API
|
|
254
|
-
void mld_polyveck_shiftl(mld_polyveck *v)
|
|
255
|
-
__contract__(
|
|
256
|
-
requires(memory_no_alias(v, sizeof(mld_polyveck)))
|
|
257
|
-
requires(forall(k0, 0, MLDSA_K, array_bound(v->vec[k0].coeffs, 0, MLDSA_N, 0, 1 << 10)))
|
|
258
|
-
assigns(memory_slice(v, sizeof(mld_polyveck)))
|
|
259
|
-
ensures(forall(k1, 0, MLDSA_K, array_bound(v->vec[k1].coeffs, 0, MLDSA_N, 0, MLDSA_Q)))
|
|
260
|
-
);
|
|
261
|
-
|
|
185
|
+
#if (!defined(MLD_CONFIG_NO_SIGN_API) || defined(MLD_UNIT_TEST)) && \
|
|
186
|
+
(!defined(MLD_CONFIG_REDUCE_RAM) || defined(MLD_UNIT_TEST))
|
|
262
187
|
#define mld_polyveck_ntt MLD_NAMESPACE_KL(polyveck_ntt)
|
|
263
|
-
|
|
264
|
-
*
|
|
188
|
+
/**
|
|
189
|
+
* Forward NTT of all polynomials in vector of length MLDSA_K. Coefficients
|
|
190
|
+
* can grow by 8*MLDSA_Q in absolute value.
|
|
265
191
|
*
|
|
266
|
-
*
|
|
267
|
-
|
|
268
|
-
*
|
|
269
|
-
* Arguments: - mld_polyveck *v: pointer to input/output vector
|
|
270
|
-
**************************************************/
|
|
192
|
+
* @param[in,out] v Pointer to input/output vector.
|
|
193
|
+
*/
|
|
271
194
|
MLD_INTERNAL_API
|
|
272
195
|
void mld_polyveck_ntt(mld_polyveck *v)
|
|
273
196
|
__contract__(
|
|
@@ -276,17 +199,20 @@ __contract__(
|
|
|
276
199
|
assigns(memory_slice(v, sizeof(mld_polyveck)))
|
|
277
200
|
ensures(forall(k1, 0, MLDSA_K, array_abs_bound(v->vec[k1].coeffs, 0, MLDSA_N, MLD_NTT_BOUND)))
|
|
278
201
|
);
|
|
202
|
+
#endif /* (!MLD_CONFIG_NO_SIGN_API || MLD_UNIT_TEST) && \
|
|
203
|
+
(!MLD_CONFIG_REDUCE_RAM || MLD_UNIT_TEST) */
|
|
279
204
|
|
|
205
|
+
#if !defined(MLD_CONFIG_NO_SIGN_API) || defined(MLD_UNIT_TEST)
|
|
280
206
|
#define mld_polyveck_invntt_tomont MLD_NAMESPACE_KL(polyveck_invntt_tomont)
|
|
281
|
-
|
|
282
|
-
*
|
|
207
|
+
/**
|
|
208
|
+
* Inverse NTT and multiplication by 2^{32} of polynomials in vector of
|
|
209
|
+
* length MLDSA_K.
|
|
283
210
|
*
|
|
284
|
-
*
|
|
285
|
-
*
|
|
286
|
-
*
|
|
287
|
-
*
|
|
288
|
-
|
|
289
|
-
**************************************************/
|
|
211
|
+
* Input coefficients need to be less than MLDSA_Q, and output coefficients
|
|
212
|
+
* are bounded by MLD_INTT_BOUND.
|
|
213
|
+
*
|
|
214
|
+
* @param[in,out] v Pointer to input/output vector.
|
|
215
|
+
*/
|
|
290
216
|
MLD_INTERNAL_API
|
|
291
217
|
void mld_polyveck_invntt_tomont(mld_polyveck *v)
|
|
292
218
|
__contract__(
|
|
@@ -295,46 +221,20 @@ __contract__(
|
|
|
295
221
|
assigns(memory_slice(v, sizeof(mld_polyveck)))
|
|
296
222
|
ensures(forall(k1, 0, MLDSA_K, array_abs_bound(v->vec[k1].coeffs, 0, MLDSA_N, MLD_INTT_BOUND)))
|
|
297
223
|
);
|
|
224
|
+
#endif /* !MLD_CONFIG_NO_SIGN_API || MLD_UNIT_TEST */
|
|
298
225
|
|
|
299
|
-
#
|
|
300
|
-
MLD_NAMESPACE_KL(polyveck_pointwise_poly_montgomery)
|
|
301
|
-
/*************************************************
|
|
302
|
-
* Name: mld_polyveck_pointwise_poly_montgomery
|
|
303
|
-
*
|
|
304
|
-
* Description: Pointwise multiplication of a polynomial vector of length
|
|
305
|
-
* MLDSA_K by a single polynomial in NTT domain and multiplication
|
|
306
|
-
* of the resulting polynomial vector by 2^{-32}.
|
|
307
|
-
*
|
|
308
|
-
* Arguments: - mld_polyveck *r: pointer to output vector
|
|
309
|
-
* - mld_poly *a: pointer to input polynomial
|
|
310
|
-
* - mld_polyveck *v: pointer to input vector
|
|
311
|
-
**************************************************/
|
|
312
|
-
MLD_INTERNAL_API
|
|
313
|
-
void mld_polyveck_pointwise_poly_montgomery(mld_polyveck *r, const mld_poly *a,
|
|
314
|
-
const mld_polyveck *v)
|
|
315
|
-
__contract__(
|
|
316
|
-
requires(memory_no_alias(r, sizeof(mld_polyveck)))
|
|
317
|
-
requires(memory_no_alias(a, sizeof(mld_poly)))
|
|
318
|
-
requires(memory_no_alias(v, sizeof(mld_polyveck)))
|
|
319
|
-
requires(array_abs_bound(a->coeffs, 0, MLDSA_N, MLD_NTT_BOUND))
|
|
320
|
-
requires(forall(k0, 0, MLDSA_K, array_abs_bound(v->vec[k0].coeffs, 0, MLDSA_N, MLD_NTT_BOUND)))
|
|
321
|
-
assigns(memory_slice(r, sizeof(mld_polyveck)))
|
|
322
|
-
ensures(forall(k1, 0, MLDSA_K, array_abs_bound(r->vec[k1].coeffs, 0, MLDSA_N, MLDSA_Q)))
|
|
323
|
-
);
|
|
324
|
-
|
|
226
|
+
#if !defined(MLD_CONFIG_NO_KEYPAIR_API)
|
|
325
227
|
#define mld_polyveck_chknorm MLD_NAMESPACE_KL(polyveck_chknorm)
|
|
326
|
-
|
|
327
|
-
*
|
|
328
|
-
*
|
|
329
|
-
* Description: Check infinity norm of polynomials in vector of length MLDSA_K.
|
|
330
|
-
* Assumes input mld_polyveck to be reduced by polyveck_reduce().
|
|
228
|
+
/**
|
|
229
|
+
* Check infinity norm of polynomials in vector of length MLDSA_K. Assumes
|
|
230
|
+
* input mld_polyveck to be reduced by polyveck_reduce().
|
|
331
231
|
*
|
|
332
|
-
*
|
|
333
|
-
*
|
|
232
|
+
* @param[in] v Pointer to vector.
|
|
233
|
+
* @param B Norm bound.
|
|
334
234
|
*
|
|
335
|
-
*
|
|
336
|
-
*(MLDSA_Q-1)/8 and 0xFFFFFFFF otherwise.
|
|
337
|
-
|
|
235
|
+
* @return 0 if norm of all polynomials are strictly smaller than
|
|
236
|
+
* B <= (MLDSA_Q-1)/8 and 0xFFFFFFFF otherwise.
|
|
237
|
+
*/
|
|
338
238
|
MLD_INTERNAL_API
|
|
339
239
|
MLD_MUST_CHECK_RETURN_VALUE
|
|
340
240
|
uint32_t mld_polyveck_chknorm(const mld_polyveck *v, int32_t B)
|
|
@@ -348,56 +248,26 @@ __contract__(
|
|
|
348
248
|
ensures((return_value == 0) == forall(k1, 0, MLDSA_K, array_abs_bound(v->vec[k1].coeffs, 0, MLDSA_N, B)))
|
|
349
249
|
);
|
|
350
250
|
|
|
351
|
-
#
|
|
352
|
-
/*************************************************
|
|
353
|
-
* Name: mld_polyveck_power2round
|
|
354
|
-
*
|
|
355
|
-
* Description: For all coefficients a of polynomials in vector of length
|
|
356
|
-
*MLDSA_K, compute a0, a1 such that a mod^+ MLDSA_Q = a1*2^MLDSA_D + a0 with
|
|
357
|
-
*-2^{MLDSA_D-1} < a0 <= 2^{MLDSA_D-1}. Assumes coefficients to be standard
|
|
358
|
-
*representatives.
|
|
359
|
-
*
|
|
360
|
-
* Arguments: - mld_polyveck *v1: pointer to output vector of polynomials with
|
|
361
|
-
* coefficients a1
|
|
362
|
-
* - mld_polyveck *v0: pointer to output vector of polynomials with
|
|
363
|
-
* coefficients a0
|
|
364
|
-
* - const mld_polyveck *v: pointer to input vector
|
|
365
|
-
**************************************************/
|
|
366
|
-
MLD_INTERNAL_API
|
|
367
|
-
void mld_polyveck_power2round(mld_polyveck *v1, mld_polyveck *v0,
|
|
368
|
-
const mld_polyveck *v)
|
|
369
|
-
__contract__(
|
|
370
|
-
requires(memory_no_alias(v1, sizeof(mld_polyveck)))
|
|
371
|
-
requires(memory_no_alias(v0, sizeof(mld_polyveck)))
|
|
372
|
-
requires(memory_no_alias(v, sizeof(mld_polyveck)))
|
|
373
|
-
requires(forall(k0, 0, MLDSA_K, array_bound(v->vec[k0].coeffs, 0, MLDSA_N, 0, MLDSA_Q)))
|
|
374
|
-
assigns(memory_slice(v1, sizeof(mld_polyveck)))
|
|
375
|
-
assigns(memory_slice(v0, sizeof(mld_polyveck)))
|
|
376
|
-
ensures(forall(k1, 0, MLDSA_K, array_bound(v0->vec[k1].coeffs, 0, MLDSA_N, -(MLD_2_POW_D/2)+1, (MLD_2_POW_D/2)+1)))
|
|
377
|
-
ensures(forall(k2, 0, MLDSA_K, array_bound(v1->vec[k2].coeffs, 0, MLDSA_N, 0, ((MLDSA_Q - 1) / MLD_2_POW_D) + 1)))
|
|
378
|
-
);
|
|
251
|
+
#endif /* !MLD_CONFIG_NO_KEYPAIR_API */
|
|
379
252
|
|
|
253
|
+
#if !defined(MLD_CONFIG_NO_SIGN_API)
|
|
380
254
|
#define mld_polyveck_decompose MLD_NAMESPACE_KL(polyveck_decompose)
|
|
381
|
-
|
|
382
|
-
*
|
|
383
|
-
*
|
|
384
|
-
*
|
|
385
|
-
*
|
|
386
|
-
*
|
|
387
|
-
*
|
|
388
|
-
*
|
|
389
|
-
*
|
|
390
|
-
*
|
|
391
|
-
*
|
|
392
|
-
*
|
|
393
|
-
*
|
|
394
|
-
*
|
|
395
|
-
*
|
|
396
|
-
|
|
397
|
-
* separate argument that may be aliased with either of the outputs.
|
|
398
|
-
* Removing the aliasing eases CBMC proofs.
|
|
399
|
-
*
|
|
400
|
-
**************************************************/
|
|
255
|
+
/**
|
|
256
|
+
* For all coefficients a of polynomials in vector of length MLDSA_K, compute
|
|
257
|
+
* high and low bits a0, a1 such a mod^+ MLDSA_Q = a1*ALPHA + a0 with
|
|
258
|
+
* -ALPHA/2 < a0 <= ALPHA/2 except a1 = (MLDSA_Q-1)/ALPHA where we set
|
|
259
|
+
* a1 = 0 and -ALPHA/2 <= a0 = a mod MLDSA_Q - MLDSA_Q < 0. Assumes
|
|
260
|
+
* coefficients to be standard representatives.
|
|
261
|
+
*
|
|
262
|
+
* @reference{The reference implementation has the input polynomial as a
|
|
263
|
+
* separate argument that may be aliased with either of the outputs. Removing
|
|
264
|
+
* the aliasing eases CBMC proofs.}
|
|
265
|
+
*
|
|
266
|
+
* @param[out] v1 Pointer to output vector of polynomials with
|
|
267
|
+
* coefficients a1.
|
|
268
|
+
* @param[in,out] v0 Pointer to input/output vector of polynomials. Output
|
|
269
|
+
* polynomial has coefficients a0.
|
|
270
|
+
*/
|
|
401
271
|
MLD_INTERNAL_API
|
|
402
272
|
void mld_polyveck_decompose(mld_polyveck *v1, mld_polyveck *v0)
|
|
403
273
|
__contract__(
|
|
@@ -412,71 +282,18 @@ __contract__(
|
|
|
412
282
|
ensures(forall(k2, 0, MLDSA_K,
|
|
413
283
|
array_abs_bound(v0->vec[k2].coeffs, 0, MLDSA_N, MLDSA_GAMMA2+1)))
|
|
414
284
|
);
|
|
285
|
+
#endif /* !MLD_CONFIG_NO_SIGN_API */
|
|
415
286
|
|
|
416
|
-
#
|
|
417
|
-
/*************************************************
|
|
418
|
-
* Name: mld_polyveck_make_hint
|
|
419
|
-
*
|
|
420
|
-
* Description: Compute hint vector.
|
|
421
|
-
*
|
|
422
|
-
* Arguments: - mld_polyveck *h: pointer to output vector
|
|
423
|
-
* - const mld_polyveck *v0: pointer to low part of input vector
|
|
424
|
-
* - const mld_polyveck *v1: pointer to high part of input vector
|
|
425
|
-
*
|
|
426
|
-
* Returns number of 1 bits.
|
|
427
|
-
**************************************************/
|
|
428
|
-
MLD_INTERNAL_API
|
|
429
|
-
MLD_MUST_CHECK_RETURN_VALUE
|
|
430
|
-
unsigned int mld_polyveck_make_hint(mld_polyveck *h, const mld_polyveck *v0,
|
|
431
|
-
const mld_polyveck *v1)
|
|
432
|
-
__contract__(
|
|
433
|
-
requires(memory_no_alias(h, sizeof(mld_polyveck)))
|
|
434
|
-
requires(memory_no_alias(v0, sizeof(mld_polyveck)))
|
|
435
|
-
requires(memory_no_alias(v1, sizeof(mld_polyveck)))
|
|
436
|
-
assigns(memory_slice(h, sizeof(mld_polyveck)))
|
|
437
|
-
ensures(return_value <= MLDSA_N * MLDSA_K)
|
|
438
|
-
ensures(forall(k1, 0, MLDSA_K, array_bound(h->vec[k1].coeffs, 0, MLDSA_N, 0, 2)))
|
|
439
|
-
);
|
|
440
|
-
|
|
441
|
-
#define mld_polyveck_use_hint MLD_NAMESPACE_KL(polyveck_use_hint)
|
|
442
|
-
/*************************************************
|
|
443
|
-
* Name: mld_polyveck_use_hint
|
|
444
|
-
*
|
|
445
|
-
* Description: Use hint vector to correct the high bits of input vector.
|
|
446
|
-
*
|
|
447
|
-
* Arguments: - mld_polyveck *w: pointer to output vector of polynomials with
|
|
448
|
-
* corrected high bits
|
|
449
|
-
* - const mld_polyveck *u: pointer to input vector
|
|
450
|
-
* - const mld_polyveck *h: pointer to input hint vector
|
|
451
|
-
**************************************************/
|
|
452
|
-
MLD_INTERNAL_API
|
|
453
|
-
void mld_polyveck_use_hint(mld_polyveck *w, const mld_polyveck *v,
|
|
454
|
-
const mld_polyveck *h)
|
|
455
|
-
__contract__(
|
|
456
|
-
requires(memory_no_alias(w, sizeof(mld_polyveck)))
|
|
457
|
-
requires(memory_no_alias(v, sizeof(mld_polyveck)))
|
|
458
|
-
requires(memory_no_alias(h, sizeof(mld_polyveck)))
|
|
459
|
-
requires(forall(k0, 0, MLDSA_K,
|
|
460
|
-
array_bound(v->vec[k0].coeffs, 0, MLDSA_N, 0, MLDSA_Q)))
|
|
461
|
-
requires(forall(k1, 0, MLDSA_K,
|
|
462
|
-
array_bound(h->vec[k1].coeffs, 0, MLDSA_N, 0, 2)))
|
|
463
|
-
assigns(memory_slice(w, sizeof(mld_polyveck)))
|
|
464
|
-
ensures(forall(k2, 0, MLDSA_K,
|
|
465
|
-
array_bound(w->vec[k2].coeffs, 0, MLDSA_N, 0, (MLDSA_Q-1)/(2*MLDSA_GAMMA2))))
|
|
466
|
-
);
|
|
467
|
-
|
|
287
|
+
#if !defined(MLD_CONFIG_NO_SIGN_API)
|
|
468
288
|
#define mld_polyveck_pack_w1 MLD_NAMESPACE_KL(polyveck_pack_w1)
|
|
469
|
-
|
|
470
|
-
*
|
|
471
|
-
*
|
|
472
|
-
* Description: Bit-pack polynomial vector w1 with coefficients in [0,15] or
|
|
473
|
-
* [0,43].
|
|
474
|
-
* Input coefficients are assumed to be standard representatives.
|
|
289
|
+
/**
|
|
290
|
+
* Bit-pack polynomial vector w1 with coefficients in [0, 15] or [0, 43]. Input
|
|
291
|
+
* coefficients are assumed to be standard representatives.
|
|
475
292
|
*
|
|
476
|
-
*
|
|
477
|
-
*
|
|
478
|
-
*
|
|
479
|
-
|
|
293
|
+
* @param[out] r Pointer to output byte array with at least
|
|
294
|
+
* MLDSA_K * MLDSA_POLYW1_PACKEDBYTES bytes.
|
|
295
|
+
* @param[in] w1 Pointer to input polynomial vector.
|
|
296
|
+
*/
|
|
480
297
|
MLD_INTERNAL_API
|
|
481
298
|
void mld_polyveck_pack_w1(uint8_t r[MLDSA_K * MLDSA_POLYW1_PACKEDBYTES],
|
|
482
299
|
const mld_polyveck *w1)
|
|
@@ -487,18 +304,17 @@ __contract__(
|
|
|
487
304
|
array_bound(w1->vec[k1].coeffs, 0, MLDSA_N, 0, (MLDSA_Q-1)/(2*MLDSA_GAMMA2))))
|
|
488
305
|
assigns(memory_slice(r, MLDSA_K * MLDSA_POLYW1_PACKEDBYTES))
|
|
489
306
|
);
|
|
307
|
+
#endif /* !MLD_CONFIG_NO_SIGN_API */
|
|
490
308
|
|
|
309
|
+
#if !defined(MLD_CONFIG_NO_KEYPAIR_API)
|
|
491
310
|
#define mld_polyveck_pack_eta MLD_NAMESPACE_KL(polyveck_pack_eta)
|
|
492
|
-
|
|
493
|
-
*
|
|
494
|
-
*
|
|
495
|
-
* Description: Bit-pack polynomial vector with coefficients
|
|
496
|
-
* in [-MLDSA_ETA,MLDSA_ETA].
|
|
311
|
+
/**
|
|
312
|
+
* Bit-pack polynomial vector with coefficients in [-MLDSA_ETA, MLDSA_ETA].
|
|
497
313
|
*
|
|
498
|
-
*
|
|
499
|
-
*
|
|
500
|
-
*
|
|
501
|
-
|
|
314
|
+
* @param[out] r Pointer to output byte array with
|
|
315
|
+
* MLDSA_K * MLDSA_POLYETA_PACKEDBYTES bytes.
|
|
316
|
+
* @param[in] p Pointer to input polynomial vector.
|
|
317
|
+
*/
|
|
502
318
|
MLD_INTERNAL_API
|
|
503
319
|
void mld_polyveck_pack_eta(uint8_t r[MLDSA_K * MLDSA_POLYETA_PACKEDBYTES],
|
|
504
320
|
const mld_polyveck *p)
|
|
@@ -511,16 +327,13 @@ __contract__(
|
|
|
511
327
|
);
|
|
512
328
|
|
|
513
329
|
#define mld_polyvecl_pack_eta MLD_NAMESPACE_KL(polyvecl_pack_eta)
|
|
514
|
-
|
|
515
|
-
*
|
|
330
|
+
/**
|
|
331
|
+
* Bit-pack polynomial vector with coefficients in [-MLDSA_ETA, MLDSA_ETA].
|
|
516
332
|
*
|
|
517
|
-
*
|
|
518
|
-
*
|
|
519
|
-
*
|
|
520
|
-
|
|
521
|
-
* MLDSA_L * MLDSA_POLYETA_PACKEDBYTES bytes
|
|
522
|
-
* - const polyveck *p: pointer to input polynomial vector
|
|
523
|
-
**************************************************/
|
|
333
|
+
* @param[out] r Pointer to output byte array with
|
|
334
|
+
* MLDSA_L * MLDSA_POLYETA_PACKEDBYTES bytes.
|
|
335
|
+
* @param[in] p Pointer to input polynomial vector.
|
|
336
|
+
*/
|
|
524
337
|
MLD_INTERNAL_API
|
|
525
338
|
void mld_polyvecl_pack_eta(uint8_t r[MLDSA_L * MLDSA_POLYETA_PACKEDBYTES],
|
|
526
339
|
const mld_polyvecl *p)
|
|
@@ -532,39 +345,18 @@ __contract__(
|
|
|
532
345
|
assigns(memory_slice(r, MLDSA_L * MLDSA_POLYETA_PACKEDBYTES))
|
|
533
346
|
);
|
|
534
347
|
|
|
535
|
-
#
|
|
536
|
-
/*************************************************
|
|
537
|
-
* Name: mld_polyveck_pack_t0
|
|
538
|
-
*
|
|
539
|
-
* Description: Bit-pack polynomial vector to with coefficients in
|
|
540
|
-
* ]-2^{MLDSA_D-1}, 2^{MLDSA_D-1}].
|
|
541
|
-
*
|
|
542
|
-
* Arguments: - uint8_t *r: pointer to output byte array with
|
|
543
|
-
* MLDSA_K * MLDSA_POLYT0_PACKEDBYTES bytes
|
|
544
|
-
* - const mld_poly *p: pointer to input polynomial vector
|
|
545
|
-
**************************************************/
|
|
546
|
-
MLD_INTERNAL_API
|
|
547
|
-
void mld_polyveck_pack_t0(uint8_t r[MLDSA_K * MLDSA_POLYT0_PACKEDBYTES],
|
|
548
|
-
const mld_polyveck *p)
|
|
549
|
-
__contract__(
|
|
550
|
-
requires(memory_no_alias(r, MLDSA_K * MLDSA_POLYT0_PACKEDBYTES))
|
|
551
|
-
requires(memory_no_alias(p, sizeof(mld_polyveck)))
|
|
552
|
-
requires(forall(k0, 0, MLDSA_K,
|
|
553
|
-
array_bound(p->vec[k0].coeffs, 0, MLDSA_N, -(1<<(MLDSA_D-1)) + 1, (1<<(MLDSA_D-1)) + 1)))
|
|
554
|
-
assigns(memory_slice(r, MLDSA_K * MLDSA_POLYT0_PACKEDBYTES))
|
|
555
|
-
);
|
|
348
|
+
#endif /* !MLD_CONFIG_NO_KEYPAIR_API */
|
|
556
349
|
|
|
350
|
+
#if !defined(MLD_CONFIG_NO_KEYPAIR_API) || \
|
|
351
|
+
(!defined(MLD_CONFIG_NO_SIGN_API) && \
|
|
352
|
+
(!defined(MLD_CONFIG_REDUCE_RAM) || defined(MLD_UNIT_TEST)))
|
|
557
353
|
#define mld_polyvecl_unpack_eta MLD_NAMESPACE_KL(polyvecl_unpack_eta)
|
|
558
|
-
|
|
559
|
-
*
|
|
560
|
-
*
|
|
561
|
-
* Description: Unpack polynomial vector with coefficients in
|
|
562
|
-
* [-MLDSA_ETA,MLDSA_ETA].
|
|
354
|
+
/**
|
|
355
|
+
* Unpack polynomial vector with coefficients in [-MLDSA_ETA, MLDSA_ETA].
|
|
563
356
|
*
|
|
564
|
-
*
|
|
565
|
-
*
|
|
566
|
-
|
|
567
|
-
**************************************************/
|
|
357
|
+
* @param[out] p Pointer to output polynomial vector.
|
|
358
|
+
* @param[in] r Input byte array with bit-packed polynomial vector.
|
|
359
|
+
*/
|
|
568
360
|
MLD_INTERNAL_API
|
|
569
361
|
void mld_polyvecl_unpack_eta(
|
|
570
362
|
mld_polyvecl *p, const uint8_t r[MLDSA_L * MLDSA_POLYETA_PACKEDBYTES])
|
|
@@ -575,18 +367,18 @@ __contract__(
|
|
|
575
367
|
ensures(forall(k1, 0, MLDSA_L,
|
|
576
368
|
array_bound(p->vec[k1].coeffs, 0, MLDSA_N, MLD_POLYETA_UNPACK_LOWER_BOUND, MLDSA_ETA + 1)))
|
|
577
369
|
);
|
|
370
|
+
#endif /* !MLD_CONFIG_NO_KEYPAIR_API || (!MLD_CONFIG_NO_SIGN_API && \
|
|
371
|
+
(!MLD_CONFIG_REDUCE_RAM || MLD_UNIT_TEST)) */
|
|
578
372
|
|
|
373
|
+
#if !defined(MLD_CONFIG_NO_VERIFY_API)
|
|
579
374
|
#define mld_polyvecl_unpack_z MLD_NAMESPACE_KL(polyvecl_unpack_z)
|
|
580
|
-
|
|
581
|
-
*
|
|
582
|
-
*
|
|
583
|
-
* Description: Unpack polynomial vector with coefficients in
|
|
584
|
-
* [-(MLDSA_GAMMA1 - 1), MLDSA_GAMMA1].
|
|
375
|
+
/**
|
|
376
|
+
* Unpack polynomial vector with coefficients in
|
|
377
|
+
* [-(MLDSA_GAMMA1 - 1), MLDSA_GAMMA1].
|
|
585
378
|
*
|
|
586
|
-
*
|
|
587
|
-
*
|
|
588
|
-
|
|
589
|
-
**************************************************/
|
|
379
|
+
* @param[out] z Pointer to output polynomial vector.
|
|
380
|
+
* @param[in] r Input byte array with bit-packed polynomial vector.
|
|
381
|
+
*/
|
|
590
382
|
MLD_INTERNAL_API
|
|
591
383
|
void mld_polyvecl_unpack_z(mld_polyvecl *z,
|
|
592
384
|
const uint8_t r[MLDSA_L * MLDSA_POLYZ_PACKEDBYTES])
|
|
@@ -597,18 +389,18 @@ __contract__(
|
|
|
597
389
|
ensures(forall(k1, 0, MLDSA_L,
|
|
598
390
|
array_bound(z->vec[k1].coeffs, 0, MLDSA_N, -(MLDSA_GAMMA1 - 1), MLDSA_GAMMA1 + 1)))
|
|
599
391
|
);
|
|
392
|
+
#endif /* !MLD_CONFIG_NO_VERIFY_API */
|
|
600
393
|
|
|
394
|
+
#if !defined(MLD_CONFIG_NO_KEYPAIR_API) || \
|
|
395
|
+
(!defined(MLD_CONFIG_NO_SIGN_API) && \
|
|
396
|
+
(!defined(MLD_CONFIG_REDUCE_RAM) || defined(MLD_UNIT_TEST)))
|
|
601
397
|
#define mld_polyveck_unpack_eta MLD_NAMESPACE_KL(polyveck_unpack_eta)
|
|
602
|
-
|
|
603
|
-
*
|
|
604
|
-
*
|
|
605
|
-
* Description: Unpack polynomial vector with coefficients in
|
|
606
|
-
* [-MLDSA_ETA,MLDSA_ETA].
|
|
398
|
+
/**
|
|
399
|
+
* Unpack polynomial vector with coefficients in [-MLDSA_ETA, MLDSA_ETA].
|
|
607
400
|
*
|
|
608
|
-
*
|
|
609
|
-
*
|
|
610
|
-
|
|
611
|
-
**************************************************/
|
|
401
|
+
* @param[out] p Pointer to output polynomial vector.
|
|
402
|
+
* @param[in] r Input byte array with bit-packed polynomial vector.
|
|
403
|
+
*/
|
|
612
404
|
MLD_INTERNAL_API
|
|
613
405
|
void mld_polyveck_unpack_eta(
|
|
614
406
|
mld_polyveck *p, const uint8_t r[MLDSA_K * MLDSA_POLYETA_PACKEDBYTES])
|
|
@@ -619,107 +411,8 @@ __contract__(
|
|
|
619
411
|
ensures(forall(k1, 0, MLDSA_K,
|
|
620
412
|
array_bound(p->vec[k1].coeffs, 0, MLDSA_N, MLD_POLYETA_UNPACK_LOWER_BOUND, MLDSA_ETA + 1)))
|
|
621
413
|
);
|
|
414
|
+
#endif /* !MLD_CONFIG_NO_KEYPAIR_API || (!MLD_CONFIG_NO_SIGN_API && \
|
|
415
|
+
(!MLD_CONFIG_REDUCE_RAM || MLD_UNIT_TEST)) */
|
|
622
416
|
|
|
623
|
-
#define mld_polyveck_unpack_t0 MLD_NAMESPACE_KL(polyveck_unpack_t0)
|
|
624
|
-
/*************************************************
|
|
625
|
-
* Name: mld_polyveck_unpack_t0
|
|
626
|
-
*
|
|
627
|
-
* Description: Unpack polynomial vector with coefficients in
|
|
628
|
-
* ]-2^{MLDSA_D-1}, 2^{MLDSA_D-1}].
|
|
629
|
-
*
|
|
630
|
-
* Arguments: - mld_polyveck *p: pointer to output polynomial vector
|
|
631
|
-
* - const uint8_t *r: input byte array with
|
|
632
|
-
* bit-packed polynomial vector
|
|
633
|
-
**************************************************/
|
|
634
|
-
MLD_INTERNAL_API
|
|
635
|
-
void mld_polyveck_unpack_t0(mld_polyveck *p,
|
|
636
|
-
const uint8_t r[MLDSA_K * MLDSA_POLYT0_PACKEDBYTES])
|
|
637
|
-
__contract__(
|
|
638
|
-
requires(memory_no_alias(r, MLDSA_K * MLDSA_POLYT0_PACKEDBYTES))
|
|
639
|
-
requires(memory_no_alias(p, sizeof(mld_polyveck)))
|
|
640
|
-
assigns(memory_slice(p, sizeof(mld_polyveck)))
|
|
641
|
-
ensures(forall(k1, 0, MLDSA_K,
|
|
642
|
-
array_bound(p->vec[k1].coeffs, 0, MLDSA_N, -(1<<(MLDSA_D-1)) + 1, (1<<(MLDSA_D-1)) + 1)))
|
|
643
|
-
);
|
|
644
|
-
|
|
645
|
-
#define mld_polymat_get_row MLD_NAMESPACE_KL(polymat_get_row)
|
|
646
|
-
/*************************************************
|
|
647
|
-
* Name: mld_polymat_get_row
|
|
648
|
-
*
|
|
649
|
-
* Description: Retrieve a pointer to a specific row of the matrix.
|
|
650
|
-
* In MLD_CONFIG_REDUCE_RAM mode, generates the row on-demand.
|
|
651
|
-
*
|
|
652
|
-
* Arguments: - mld_polymat *mat: pointer to matrix
|
|
653
|
-
* - unsigned int row: row index (must be < MLDSA_K)
|
|
654
|
-
*
|
|
655
|
-
* Returns pointer to the row (mld_polyvecl)
|
|
656
|
-
**************************************************/
|
|
657
|
-
MLD_INTERNAL_API
|
|
658
|
-
MLD_MUST_CHECK_RETURN_VALUE
|
|
659
|
-
const mld_polyvecl *mld_polymat_get_row(mld_polymat *mat, unsigned int row);
|
|
660
|
-
|
|
661
|
-
#define mld_polyvec_matrix_expand MLD_NAMESPACE_KL(polyvec_matrix_expand)
|
|
662
|
-
/*************************************************
|
|
663
|
-
* Name: mld_polyvec_matrix_expand
|
|
664
|
-
*
|
|
665
|
-
* Description: Implementation of ExpandA. Generates matrix A with uniformly
|
|
666
|
-
* random coefficients a_{i,j} by performing rejection
|
|
667
|
-
* sampling on the output stream of SHAKE128(rho|j|i)
|
|
668
|
-
*
|
|
669
|
-
* Arguments: - mld_polymat *mat: pointer to output matrix
|
|
670
|
-
* - const uint8_t rho[]: byte array containing seed rho
|
|
671
|
-
**************************************************/
|
|
672
|
-
MLD_INTERNAL_API
|
|
673
|
-
void mld_polyvec_matrix_expand(mld_polymat *mat,
|
|
674
|
-
const uint8_t rho[MLDSA_SEEDBYTES])
|
|
675
|
-
__contract__(
|
|
676
|
-
requires(memory_no_alias(mat, sizeof(mld_polymat)))
|
|
677
|
-
requires(memory_no_alias(rho, MLDSA_SEEDBYTES))
|
|
678
|
-
assigns(memory_slice(mat, sizeof(mld_polymat)))
|
|
679
|
-
ensures(forall(k1, 0, MLDSA_K, forall(l1, 0, MLDSA_L,
|
|
680
|
-
array_bound(mat->vec[k1].vec[l1].coeffs, 0, MLDSA_N, 0, MLDSA_Q))))
|
|
681
|
-
);
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
#define mld_polyvec_matrix_pointwise_montgomery \
|
|
686
|
-
MLD_NAMESPACE_KL(polyvec_matrix_pointwise_montgomery)
|
|
687
|
-
/*************************************************
|
|
688
|
-
* Name: mld_polyvec_matrix_pointwise_montgomery
|
|
689
|
-
*
|
|
690
|
-
* Description: Compute matrix-vector multiplication in NTT domain with
|
|
691
|
-
* pointwise multiplication and multiplication by 2^{-32}.
|
|
692
|
-
* Input matrix and vector must be in NTT domain representation.
|
|
693
|
-
*
|
|
694
|
-
* The first input "mat" must be the output of
|
|
695
|
-
* polyvec_matrix_expand() and so have coefficients in [0, Q-1]
|
|
696
|
-
* inclusive.
|
|
697
|
-
*
|
|
698
|
-
* The second input "v" is assumed to be output of an NTT, and
|
|
699
|
-
* hence must have coefficients bounded by [-9q+1, +9q-1]
|
|
700
|
-
* inclusive.
|
|
701
|
-
*
|
|
702
|
-
* Note: In MLD_CONFIG_REDUCE_RAM mode, mat cannot be const
|
|
703
|
-
* as rows are generated on-demand.
|
|
704
|
-
*
|
|
705
|
-
* Arguments: - mld_polyveck *t: pointer to output vector t
|
|
706
|
-
* - mld_polymat *mat: pointer to input matrix
|
|
707
|
-
* - const mld_polyvecl *v: pointer to input vector v
|
|
708
|
-
**************************************************/
|
|
709
|
-
MLD_INTERNAL_API
|
|
710
|
-
void mld_polyvec_matrix_pointwise_montgomery(mld_polyveck *t, mld_polymat *mat,
|
|
711
|
-
const mld_polyvecl *v)
|
|
712
|
-
__contract__(
|
|
713
|
-
requires(memory_no_alias(t, sizeof(mld_polyveck)))
|
|
714
|
-
requires(memory_no_alias(mat, sizeof(mld_polymat)))
|
|
715
|
-
requires(memory_no_alias(v, sizeof(mld_polyvecl)))
|
|
716
|
-
requires(forall(k1, 0, MLDSA_K, forall(l1, 0, MLDSA_L,
|
|
717
|
-
array_bound(mat->vec[k1].vec[l1].coeffs, 0, MLDSA_N, 0, MLDSA_Q))))
|
|
718
|
-
requires(forall(l1, 0, MLDSA_L,
|
|
719
|
-
array_abs_bound(v->vec[l1].coeffs, 0, MLDSA_N, MLD_NTT_BOUND)))
|
|
720
|
-
assigns(memory_slice(t, sizeof(mld_polyveck)))
|
|
721
|
-
ensures(forall(k0, 0, MLDSA_K,
|
|
722
|
-
array_abs_bound(t->vec[k0].coeffs, 0, MLDSA_N, MLDSA_Q)))
|
|
723
|
-
);
|
|
724
417
|
|
|
725
418
|
#endif /* !MLD_POLYVEC_H */
|