HOL-Light: Add HOL Light proof and CBMC contracts for x86 poly_caddq#1068
Draft
HOL-Light: Add HOL Light proof and CBMC contracts for x86 poly_caddq#1068
Conversation
Port the x86 AVX2 poly_caddq formal verification from s2n-bignum (awslabs/s2n-bignum#398) to mldsa-native. The proof verifies that for inputs with |ival(x)| < Q, the output satisfies ival(output) = ival(x) rem Q. Adapted for mldsa-native's looped assembly (8 iterations of 4 vectors) vs s2n-bignum's fully unrolled version, using MAP_UNTIL_TARGET_PC for loop handling. Also adds CBMC contract for mld_poly_caddq_avx2 and a new x86_64 CBMC proof (poly_caddq_native_x86_64), plus a fix for MAP_UNTIL_TARGET_PC in x86_64 mldsa_utils.ml (was matching `eventually arm` instead of `eventually x86`). Depends on s2n-bignum PR #397 (VPCMPGTD instruction model). Signed-off-by: Jake Massimo <jakemas@amazon.com>
Point s2n-bignum at awslabs/s2n-bignum#398 branch which includes the VPCMPGTD/VPCMPGTW instruction models needed for the x86 poly_caddq HOL Light proof. Signed-off-by: Jake Massimo <jakemas@amazon.com>
Signed-off-by: Jake Massimo <jakemas@amazon.com>
Contributor
CBMC Results (ML-DSA-65, REDUCE-RAM)Full Results (195 proofs)
|
Contributor
CBMC Results (ML-DSA-44, REDUCE-RAM)Full Results (195 proofs)
|
Contributor
CBMC Results (ML-DSA-65)Full Results (195 proofs)
|
Contributor
CBMC Results (ML-DSA-87)Full Results (195 proofs)
|
Contributor
CBMC Results (ML-DSA-87, REDUCE-RAM)Full Results (195 proofs)
|
Contributor
CBMC Results (ML-DSA-44)Full Results (195 proofs)
|
Update instruction comments to match autogen output from the s2n-bignum VPCMPGTD decoder, and include the RET byte in the machine code definition. Signed-off-by: Jake Massimo <jakemas@amazon.com>
Wrap REWRITE_CONV in CONV_TAC — REWRITE_CONV is a conv, not a tactic. Signed-off-by: Jake Massimo <jakemas@amazon.com>
Port the TMC (trimmed machine code) handling from the s2n-bignum proof to use define_trimmed and X86_MK_CORE_EXEC_RULE instead of a broken BUTLAST_CLAUSES SPEC approach. The NOIBT subroutine proof now correctly uses mldsa_poly_caddq_tmc. Signed-off-by: Jake Massimo <jakemas@amazon.com>
2953562 to
dcc44a1
Compare
Replace TOP_DEPTH_CONV WORD_SIMPLE_SUBWORD_CONV with SIMD_SIMPLIFY_TAC and use bytes256 (AVX2 YMM) memory merging instead of bytes128. The old approach caused exponential assumption growth leading to stack overflow after ~97 minutes in CI. Signed-off-by: Jake Massimo <jakemas@amazon.com>
dcc44a1 to
297acb1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #492
Summary
poly_caddqHOL Light formal proof from s2n-bignum (awslabs/s2n-bignum#398)mld_poly_caddq_avx2and newpoly_caddq_native_x86_64CBMC proofMAP_UNTIL_TARGET_PCin x86_64mldsa_utils.ml(was matchingeventually arminstead ofeventually x86)Details
The HOL Light proof verifies that for each coefficient with
|ival(x)| < Q, the output satisfiesival(output) = ival(x) rem Q. The proof is adapted for mldsa-native's looped assembly (8 iterations of 4 AVX2 vectors) vs s2n-bignum's fully unrolled version, usingMAP_UNTIL_TARGET_PCfor loop handling.Depends on: s2n-bignum #397 (VPCMPGTD instruction model)