Skip to content

Commit b14e6f0

Browse files
committed
Remove output bound for poly_mulcache_compute
The higher level functions do not require a output bound for poly_mulcache_compute. However, all our backend (C/AVX2/Arm64) produce outputs in (-q,q) and hence the lower level functions did have according assertions or post-conditions. The HOL-Light proof for the AArch64 implementation of poly_mulcache_compute, however, does not prove a output bound for it. We are considering adding a post-condition, but that is some work: #1032 For the meantime, this commit removes the post-condition from the lower level functions such that it is consistent with the HOL-Light proof. Signed-off-by: Matthias J. Kannwischer <matthias@kannwischer.eu> the contracts of the lower level functions
1 parent 6bc95ba commit b14e6f0

File tree

5 files changed

+0
-10
lines changed

5 files changed

+0
-10
lines changed

dev/aarch64_clean/src/arith_native_aarch64.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ __contract__(
9393
requires(zetas == mlk_aarch64_zetas_mulcache_native)
9494
requires(zetas_twisted == mlk_aarch64_zetas_mulcache_twisted_native)
9595
assigns(object_whole(cache))
96-
ensures(array_abs_bound(cache, 0, MLKEM_N / 2, MLKEM_Q))
9796
);
9897

9998
#define mlk_poly_tobytes_asm MLK_NAMESPACE(poly_tobytes_asm)

dev/aarch64_opt/src/arith_native_aarch64.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ __contract__(
9393
requires(zetas == mlk_aarch64_zetas_mulcache_native)
9494
requires(zetas_twisted == mlk_aarch64_zetas_mulcache_twisted_native)
9595
assigns(object_whole(cache))
96-
ensures(array_abs_bound(cache, 0, MLKEM_N / 2, MLKEM_Q))
9796
);
9897

9998
#define mlk_poly_tobytes_asm MLK_NAMESPACE(poly_tobytes_asm)

mlkem/native/aarch64/src/arith_native_aarch64.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ __contract__(
9393
requires(zetas == mlk_aarch64_zetas_mulcache_native)
9494
requires(zetas_twisted == mlk_aarch64_zetas_mulcache_twisted_native)
9595
assigns(object_whole(cache))
96-
ensures(array_abs_bound(cache, 0, MLKEM_N / 2, MLKEM_Q))
9796
);
9897

9998
#define mlk_poly_tobytes_asm MLK_NAMESPACE(poly_tobytes_asm)

mlkem/native/api.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ __contract__(
209209
requires(memory_no_alias(cache, sizeof(int16_t) * (MLKEM_N / 2)))
210210
requires(memory_no_alias(mlk_poly, sizeof(int16_t) * MLKEM_N))
211211
assigns(object_whole(cache))
212-
ensures(array_abs_bound(cache, 0, MLKEM_N / 2, MLKEM_Q))
213212
);
214213
#endif /* MLK_USE_NATIVE_POLY_MULCACHE_COMPUTE */
215214

mlkem/poly.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -283,12 +283,6 @@ MLK_INTERNAL_API
283283
void mlk_poly_mulcache_compute(mlk_poly_mulcache *x, const mlk_poly *a)
284284
{
285285
mlk_poly_mulcache_compute_native(x->coeffs, a->coeffs);
286-
/*
287-
* This bound is true for the AArch64 and AVX2 implementations,
288-
* but not needed in the higher level bounds reasoning.
289-
* It is thus omitted from the spec but checked here nonetheless.
290-
*/
291-
mlk_assert_abs_bound(x, MLKEM_N / 2, MLKEM_Q);
292286
}
293287
#endif /* MLK_USE_NATIVE_POLY_MULCACHE_COMPUTE */
294288

0 commit comments

Comments
 (0)