Add HOL Light pointwise-acc multiplication proofs for AArch64 and x86_64#1010
Add HOL Light pointwise-acc multiplication proofs for AArch64 and x86_64#1010
Conversation
c96a621 to
b9b5908
Compare
CBMC Results (ML-DSA-44)Full Results (181 proofs)
|
CBMC Results (ML-DSA-65)Full Results (181 proofs)
|
CBMC Results (ML-DSA-87)Full Results (181 proofs)
|
mkannwischer
left a comment
There was a problem hiding this comment.
Thanks @jakemas - the HOL-Light proofs look good to me. I checked the spec and everything makes sense to me.
The CBMC contracts, however, do not match that - please update.
Do you have an intuition why the proof for 44 is much slower than the one for 65? That does not seem to make sense to me. Would be good to improve this, but that could also be done in a follow-up PR.
| requires(array_abs_bound(a, 0, 4 * MLDSA_N, 75423753)) | ||
| requires(array_abs_bound(b, 0, 4 * MLDSA_N, 75423753)) |
There was a problem hiding this comment.
This does not match the HOL-Light pre-conditions:
(!i. i < 1024 ==> abs(ival(x i)) <= &8380416) /\
(!i. i < 1024 ==> abs(ival(y i)) <= &75423752) /\
| requires(array_abs_bound(a, 0, 4 * MLDSA_N, 75423753)) | ||
| requires(array_abs_bound(b, 0, 4 * MLDSA_N, 75423753)) |
There was a problem hiding this comment.
same in the x86 backend
ba6edd2 to
87d0267
Compare
Good catch. The bounds phase (proving congruence + boundedness for each of the 256 output coefficients) was using a slow approach for l4 that repeatedly calls I found this when developing the l7 proofs and optimized the approach there (as they were too slow without it), pre-computing all the Times improved 3-4x for L4:
|
| /* check-magic: off */ | ||
| requires(array_abs_bound(a, 0, 4 * MLDSA_N, 8380417)) | ||
| requires(array_abs_bound(b, 0, 4 * MLDSA_N, 75423753)) | ||
| /* check-magic: on */ | ||
| assigns(memory_slice(r, sizeof(int32_t) * MLDSA_N)) | ||
| /* check-magic: off */ | ||
| ensures(array_abs_bound(r, 0, MLDSA_N, 8380417)) | ||
| /* check-magic: on */ |
There was a problem hiding this comment.
nit: turning off check-magic once instead of twice would be less distracting.
There was a problem hiding this comment.
This is also present in #1006. Maybe you can still change that in both before we merge.
mkannwischer
left a comment
There was a problem hiding this comment.
Thanks @jakemas - this looks great to me. Thank you for the speed improvements for the L4 proof - that is greatly appreciated.
I think this is ready to be merged.
@hanno-becker, could you please double check the HOL-Light specs?
87d0267 to
21c0cbc
Compare
Port the ML-DSA pointwise polynomial multiplication (Montgomery form) and its HOL Light proofs of correctness from s2n-bignum to mldsa-native, for both AArch64 (NEON) and x86_64 (AVX2). The proofs verify the assembly implementations at the object-code level, showing that output coefficients are congruent to the pointwise product of the inputs modulo Q=8380417, with bounded output coefficients (|output| <= Q-1). For AArch64, a constant-time and memory safety proof is also included. Ported from s2n-bignum commit ca6ec31a225a. Signed-off-by: Jake Massimo <jakemas@amazon.com>
Port the ML-DSA pointwise multiplication-accumulation (l=4,5,7) and their HOL Light proofs of correctness from s2n-bignum to mldsa-native, for both AArch64 (NEON) and x86_64 (AVX2). Includes constant-time and memory safety proofs for both architectures. Ported from s2n-bignum PR #373. Signed-off-by: Jake Massimo <jakemas@amazon.com>
21c0cbc to
554a957
Compare
hanno-becker
left a comment
There was a problem hiding this comment.
Thanks a lot @jakemas, this is great work 🎉
Unless I'm missing something, we still need CBMC proofs for the native versions of pointwise_acc_montgomery?
Hanno is right: The CBMC proofs still need to be added.
Resolves:
polyvecl_pointwise_acc_montgomery#549polyvecl_pointwise_acc_montgomery#551Summary
Dependencies