Add HOL Light rej_uniform_eta proofs for AArch64#1040
Conversation
a3673e9 to
0213d92
Compare
CBMC Results (ML-DSA-44)Full Results (201 proofs)
|
0213d92 to
4558665
Compare
CBMC Results (ML-DSA-65)Full Results (201 proofs)
|
4558665 to
73d8d61
Compare
CBMC Results (ML-DSA-87)Full Results (201 proofs)
|
73d8d61 to
a7cc582
Compare
77cb935 to
f986df8
Compare
37dfafd to
ddd97de
Compare
CBMC Results (ML-DSA-44, REDUCE-RAM)Full Results (201 proofs)
|
7429b71 to
0c8ed0a
Compare
…ty proofs Add functional correctness, subroutine correctness, memory-safety and subroutine-safety proofs for the AArch64 assembly implementations of rej_uniform_eta for both eta variants: - rej_uniform_eta2 (eta=2, used in ML-DSA-44) - rej_uniform_eta4 (eta=4, used in ML-DSA-65/87) Memory safety follows the mlkem_rej_uniform_VARIABLE_TIME pattern in s2n-bignum because the loop count is data-dependent (which nibbles pass the < 9 / < 15 filter). Written with the assistance of Claude Opus 4.7. Signed-off-by: Jake Massimo <jakemas@amazon.com>
0c8ed0a to
63f752b
Compare
|
@mkannwischer @hanno-becker Ready for review |
mkannwischer
left a comment
There was a problem hiding this comment.
Thanks @jakemas for finishing the last AArch64 proof - exciting!!
I found a couple of mistakes.
| requires(buflen >= 8) | ||
| requires(memory_no_alias(r, sizeof(int32_t) * MLDSA_N)) | ||
| requires(memory_no_alias(buf, buflen)) | ||
| requires(memory_no_alias(table, 4096)) /* check-magic: 4096 == 256 * 16 */ |
There was a problem hiding this comment.
This can be a stronger pre-condition table == mld_rej_uniform_eta_table
| requires(buflen >= 8) | ||
| requires(memory_no_alias(r, sizeof(int32_t) * MLDSA_N)) | ||
| requires(memory_no_alias(buf, buflen)) | ||
| requires(memory_no_alias(table, 4096)) /* check-magic: 4096 == 256 * 16 */ |
There was a problem hiding this comment.
same changes need to be made to the aarch64_clean files
There was a problem hiding this comment.
These files should be autogenerated via autogen
| (* Memory safety of the core (non-subroutine) form, mirroring the structure *) | ||
| (* of MLDSA_REJ_UNIFORM_ETA2_CORRECT but augmented with an event accumulator *) | ||
| (* and memaccess_inbounds invariant. Pattern from mlkem-native *) | ||
| (* (mlkem_rej_uniform_VARIABLE_TIME.ml:1744). *) |
There was a problem hiding this comment.
This file has a different name in mlkem-native. Replace by a link and remove the line number as that may change.
| const uint8_t *table); | ||
| unsigned buflen, const uint8_t *table) | ||
| /* This must be kept in sync with the HOL-Light specification | ||
| * in proofs/hol_light/aarch64/proofs/mldsa_rej_uniform_eta2.ml */ |
There was a problem hiding this comment.
mldsa_rej_uniform_eta2 -> rej_uniform_eta2_aarch64_asm.ml
| (* The subroutine memory safety theorem. *) | ||
| (* ------------------------------------------------------------------------- *) | ||
|
|
||
| let MLDSA_REJ_UNIFORM_ETA2_SUBROUTINE_SAFE = time prove |
There was a problem hiding this comment.
Should this be called _MEMSAFE?
| (* ensures(array_abs_bound(r, 0, return_value, MLDSA_ETA + 1)) for eta = 2. *) | ||
| (* ------------------------------------------------------------------------- *) | ||
|
|
||
| let MLDSA_REJ_UNIFORM_ETA2_SUBROUTINE_CORRECT = prove |
There was a problem hiding this comment.
Add comment here to keep in sync with the CBMC spec.
Resolves #924
Some (development) notes:
I've moved the theorems that may be shared with future x86 proof to
mldsa_specs.ml. Should it occur that more could be shared during the development of the x86 proof, then we can pull what we need at that point.The CI gives a nice break down on how long each of the CORRECT and MEMSAFE proofs take. I was able to optimize the full eta2 proof quite a bit from 1h7m to just 31m, which is great considering the CORRECT takes ~24min.
CORRECT proof:
HOL-Light / AArch64 HOL Light proof for rej_uniform_eta4_aarch64_asm.S (pull_request) Successful in 11m
HOL-Light / AArch64 HOL Light proof for rej_uniform_eta2_aarch64_asm.S (pull_request) Successful in 24m
CORRECT + MEMSAFE proof:
HOL-Light / AArch64 HOL Light proof for rej_uniform_eta4_aarch64_asm.S (pull_request) Successful in 21m
HOL-Light / AArch64 HOL Light proof for rej_uniform_eta2_aarch64_asm.S (pull_request) Successful in 1h7m
Optimizations CORRECT + MEMSAFE proof:
HOL-Light / AArch64 HOL Light proof for rej_uniform_eta4_aarch64_asm.S succeeded in 18m 40s
HOL-Light / AArch64 HOL Light proof for rej_uniform_eta2_aarch64_asm.S succeeded in 31m 29s
Built with Claude Opus 4.7 1m. Using the Hol-Light MCP. About 4 weeks of effort.