@@ -98,10 +98,36 @@ uint64_t mld_rej_uniform_eta4_asm(int32_t *r, const uint8_t *buf,
9898
9999#if !defined(MLD_CONFIG_NO_SIGN_API )
100100#define mld_poly_decompose_32_asm MLD_NAMESPACE(poly_decompose_32_asm)
101- void mld_poly_decompose_32_asm (int32_t * a1 , int32_t * a0 );
101+ void mld_poly_decompose_32_asm (int32_t * a1 , int32_t * a0 )
102+ /* This must be kept in sync with the HOL-Light specification
103+ * in proofs/hol_light/aarch64/proofs/poly_decompose_32_aarch64_asm.ml */
104+ __contract__ (
105+ requires (memory_no_alias (a1 , sizeof (int32_t ) * MLDSA_N ))
106+ requires (memory_no_alias (a0 , sizeof (int32_t ) * MLDSA_N ))
107+ requires (array_bound (a0 , 0 , MLDSA_N , 0 , MLDSA_Q ))
108+ assigns (memory_slice (a1 , sizeof (int32_t ) * MLDSA_N ))
109+ assigns (memory_slice (a0 , sizeof (int32_t ) * MLDSA_N ))
110+ /* check-magic: 16 == (MLDSA_Q - 1) / (2 * ((MLDSA_Q - 1) / 32)) */
111+ ensures (array_bound (a1 , 0 , MLDSA_N , 0 , 16 ))
112+ /* check-magic: 261889 == (MLDSA_Q - 1) / 32 + 1 */
113+ ensures (array_abs_bound (a0 , 0 , MLDSA_N , 261889 ))
114+ );
102115
103116#define mld_poly_decompose_88_asm MLD_NAMESPACE(poly_decompose_88_asm)
104- void mld_poly_decompose_88_asm (int32_t * a1 , int32_t * a0 );
117+ void mld_poly_decompose_88_asm (int32_t * a1 , int32_t * a0 )
118+ /* This must be kept in sync with the HOL-Light specification
119+ * in proofs/hol_light/aarch64/proofs/poly_decompose_88_aarch64_asm.ml */
120+ __contract__ (
121+ requires (memory_no_alias (a1 , sizeof (int32_t ) * MLDSA_N ))
122+ requires (memory_no_alias (a0 , sizeof (int32_t ) * MLDSA_N ))
123+ requires (array_bound (a0 , 0 , MLDSA_N , 0 , MLDSA_Q ))
124+ assigns (memory_slice (a1 , sizeof (int32_t ) * MLDSA_N ))
125+ assigns (memory_slice (a0 , sizeof (int32_t ) * MLDSA_N ))
126+ /* check-magic: 44 == (MLDSA_Q - 1) / (2 * ((MLDSA_Q - 1) / 88)) */
127+ ensures (array_bound (a1 , 0 , MLDSA_N , 0 , 44 ))
128+ /* check-magic: 95233 == (MLDSA_Q - 1) / 88 + 1 */
129+ ensures (array_abs_bound (a0 , 0 , MLDSA_N , 95233 ))
130+ );
105131#endif /* !MLD_CONFIG_NO_SIGN_API */
106132
107133#define mld_poly_caddq_asm MLD_NAMESPACE(poly_caddq_asm)
0 commit comments