Skip to content

Commit 65200d7

Browse files
committed
Update master copies of AArch64 arithmetic back-end specs.
Signed-off-by: Rod Chapman <[email protected]>
1 parent 6d54ddb commit 65200d7

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

dev/aarch64_clean/src/arith_native_aarch64.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,17 @@ void mlk_polyvec_basemul_acc_montgomery_cached_asm_k2(
116116
/* This must be kept in sync with the HOL-Light specification in
117117
* proofs/hol_light/arm/proofs/mlkem_poly_basemul_acc_montgomery_cached_k2.ml.
118118
*/
119+
/* TODO - refine_bounds branch - Check HOL-Light specification has the
120+
* INT16_MAX/2 bound on post-condition and re-prove/
121+
*/
119122
__contract__(
120123
requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
121124
requires(memory_no_alias(a, sizeof(int16_t) * 2 * MLKEM_N))
122125
requires(memory_no_alias(b, sizeof(int16_t) * 2 * MLKEM_N))
123126
requires(memory_no_alias(b_cache, sizeof(int16_t) * 2 * (MLKEM_N / 2)))
124127
requires(array_abs_bound(a, 0, 2 * MLKEM_N, MLKEM_UINT12_LIMIT + 1))
125128
assigns(memory_slice(r, sizeof(int16_t) * MLKEM_N))
129+
ensures(array_abs_bound(r, 0, MLKEM_N, INT16_MAX/2))
126130
);
127131

128132
#define mlk_polyvec_basemul_acc_montgomery_cached_asm_k3 \
@@ -133,13 +137,17 @@ void mlk_polyvec_basemul_acc_montgomery_cached_asm_k3(
133137
/* This must be kept in sync with the HOL-Light specification in
134138
* proofs/hol_light/arm/proofs/mlkem_poly_basemul_acc_montgomery_cached_k3.ml.
135139
*/
140+
/* TODO - refine_bounds branch - Check HOL-Light specification has the
141+
* INT16_MAX/2 bound on post-condition and re-prove/
142+
*/
136143
__contract__(
137144
requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
138145
requires(memory_no_alias(a, sizeof(int16_t) * 3 * MLKEM_N))
139146
requires(memory_no_alias(b, sizeof(int16_t) * 3 * MLKEM_N))
140147
requires(memory_no_alias(b_cache, sizeof(int16_t) * 3 * (MLKEM_N / 2)))
141148
requires(array_abs_bound(a, 0, 3 * MLKEM_N, MLKEM_UINT12_LIMIT + 1))
142149
assigns(memory_slice(r, sizeof(int16_t) * MLKEM_N))
150+
ensures(array_abs_bound(r, 0, MLKEM_N, INT16_MAX/2))
143151
);
144152

145153
#define mlk_polyvec_basemul_acc_montgomery_cached_asm_k4 \
@@ -150,13 +158,17 @@ void mlk_polyvec_basemul_acc_montgomery_cached_asm_k4(
150158
/* This must be kept in sync with the HOL-Light specification in
151159
* proofs/hol_light/arm/proofs/mlkem_poly_basemul_acc_montgomery_cached_k4.ml.
152160
*/
161+
/* TODO - refine_bounds branch - Check HOL-Light specification has the
162+
* INT16_MAX/2 bound on post-condition and re-prove/
163+
*/
153164
__contract__(
154165
requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
155166
requires(memory_no_alias(a, sizeof(int16_t) * 4 * MLKEM_N))
156167
requires(memory_no_alias(b, sizeof(int16_t) * 4 * MLKEM_N))
157168
requires(memory_no_alias(b_cache, sizeof(int16_t) * 4 * (MLKEM_N / 2)))
158169
requires(array_abs_bound(a, 0, 4 * MLKEM_N, MLKEM_UINT12_LIMIT + 1))
159170
assigns(memory_slice(r, sizeof(int16_t) * MLKEM_N))
171+
ensures(array_abs_bound(r, 0, MLKEM_N, INT16_MAX/2))
160172
);
161173

162174
#define mlk_rej_uniform_asm MLK_NAMESPACE(rej_uniform_asm)

dev/aarch64_opt/src/arith_native_aarch64.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,17 @@ void mlk_polyvec_basemul_acc_montgomery_cached_asm_k2(
116116
/* This must be kept in sync with the HOL-Light specification in
117117
* proofs/hol_light/arm/proofs/mlkem_poly_basemul_acc_montgomery_cached_k2.ml.
118118
*/
119+
/* TODO - refine_bounds branch - Check HOL-Light specification has the
120+
* INT16_MAX/2 bound on post-condition and re-prove/
121+
*/
119122
__contract__(
120123
requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
121124
requires(memory_no_alias(a, sizeof(int16_t) * 2 * MLKEM_N))
122125
requires(memory_no_alias(b, sizeof(int16_t) * 2 * MLKEM_N))
123126
requires(memory_no_alias(b_cache, sizeof(int16_t) * 2 * (MLKEM_N / 2)))
124127
requires(array_abs_bound(a, 0, 2 * MLKEM_N, MLKEM_UINT12_LIMIT + 1))
125128
assigns(memory_slice(r, sizeof(int16_t) * MLKEM_N))
129+
ensures(array_abs_bound(r, 0, MLKEM_N, INT16_MAX/2))
126130
);
127131

128132
#define mlk_polyvec_basemul_acc_montgomery_cached_asm_k3 \
@@ -133,13 +137,17 @@ void mlk_polyvec_basemul_acc_montgomery_cached_asm_k3(
133137
/* This must be kept in sync with the HOL-Light specification in
134138
* proofs/hol_light/arm/proofs/mlkem_poly_basemul_acc_montgomery_cached_k3.ml.
135139
*/
140+
/* TODO - refine_bounds branch - Check HOL-Light specification has the
141+
* INT16_MAX/2 bound on post-condition and re-prove/
142+
*/
136143
__contract__(
137144
requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
138145
requires(memory_no_alias(a, sizeof(int16_t) * 3 * MLKEM_N))
139146
requires(memory_no_alias(b, sizeof(int16_t) * 3 * MLKEM_N))
140147
requires(memory_no_alias(b_cache, sizeof(int16_t) * 3 * (MLKEM_N / 2)))
141148
requires(array_abs_bound(a, 0, 3 * MLKEM_N, MLKEM_UINT12_LIMIT + 1))
142149
assigns(memory_slice(r, sizeof(int16_t) * MLKEM_N))
150+
ensures(array_abs_bound(r, 0, MLKEM_N, INT16_MAX/2))
143151
);
144152

145153
#define mlk_polyvec_basemul_acc_montgomery_cached_asm_k4 \
@@ -150,13 +158,17 @@ void mlk_polyvec_basemul_acc_montgomery_cached_asm_k4(
150158
/* This must be kept in sync with the HOL-Light specification in
151159
* proofs/hol_light/arm/proofs/mlkem_poly_basemul_acc_montgomery_cached_k4.ml.
152160
*/
161+
/* TODO - refine_bounds branch - Check HOL-Light specification has the
162+
* INT16_MAX/2 bound on post-condition and re-prove/
163+
*/
153164
__contract__(
154165
requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
155166
requires(memory_no_alias(a, sizeof(int16_t) * 4 * MLKEM_N))
156167
requires(memory_no_alias(b, sizeof(int16_t) * 4 * MLKEM_N))
157168
requires(memory_no_alias(b_cache, sizeof(int16_t) * 4 * (MLKEM_N / 2)))
158169
requires(array_abs_bound(a, 0, 4 * MLKEM_N, MLKEM_UINT12_LIMIT + 1))
159170
assigns(memory_slice(r, sizeof(int16_t) * MLKEM_N))
171+
ensures(array_abs_bound(r, 0, MLKEM_N, INT16_MAX/2))
160172
);
161173

162174
#define mlk_rej_uniform_asm MLK_NAMESPACE(rej_uniform_asm)

0 commit comments

Comments
 (0)