x86_64 + HOL-Light: Replace rej_uniform_eta2/eta4 intrinsics with hand-written assembly and HOL-Light proofs#1188
x86_64 + HOL-Light: Replace rej_uniform_eta2/eta4 intrinsics with hand-written assembly and HOL-Light proofs#1188jakemas wants to merge 1 commit into
Conversation
f789e8d to
1e78719
Compare
CBMC Results (ML-DSA-87, REDUCE-RAM)Full Results (207 proofs)
|
CBMC Results (ML-DSA-65, REDUCE-RAM)Full Results (207 proofs)
|
CBMC Results (ML-DSA-44, REDUCE-RAM)Full Results (207 proofs)
|
CBMC Results (ML-DSA-65)Full Results (207 proofs)
|
CBMC Results (ML-DSA-44)Full Results (207 proofs)
|
CBMC Results (ML-DSA-87)Full Results (207 proofs)
|
1e78719 to
7c13c63
Compare
There was a problem hiding this comment.
@hanno-becker / @mkannwischer would it be possible to get review on dev/x86_64/src/rej_uniform_eta{2/4}_avx2_asm.S as a preliminary pass, before I start the hol-light proofs. This should help prevent too much proof churn, should any large changes be requested in review. Ideally, the asm would be finalized in review first, and then I'll mark the PR ready once the proofs are complete.
There was a problem hiding this comment.
Good idea. Thanks! Will look later today.
There was a problem hiding this comment.
Thank you very much!
There was a problem hiding this comment.
Mac Mini (M1, 2020) benchmarks (opt)
Details
| Benchmark suite | Current: 237e387 | Previous: 31300ad | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
46524 cycles |
46501 cycles |
1.00 |
ML-DSA-44 sign |
131156 cycles |
131159 cycles |
1.00 |
ML-DSA-44 verify |
47325 cycles |
47327 cycles |
1.00 |
ML-DSA-65 keypair |
81696 cycles |
81682 cycles |
1.00 |
ML-DSA-65 sign |
215403 cycles |
215381 cycles |
1.00 |
ML-DSA-65 verify |
79311 cycles |
79309 cycles |
1.00 |
ML-DSA-87 keypair |
132415 cycles |
132436 cycles |
1.00 |
ML-DSA-87 sign |
277406 cycles |
277663 cycles |
1.00 |
ML-DSA-87 verify |
134055 cycles |
134051 cycles |
1.00 |
This comment was automatically generated by workflow using github-action-benchmark.
There was a problem hiding this comment.
Mac Mini (M1, 2020) benchmarks (no-opt)
Details
| Benchmark suite | Current: 237e387 | Previous: 31300ad | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
113028 cycles |
112820 cycles |
1.00 |
ML-DSA-44 sign |
402081 cycles |
401084 cycles |
1.00 |
ML-DSA-44 verify |
119691 cycles |
119458 cycles |
1.00 |
ML-DSA-65 keypair |
192981 cycles |
192907 cycles |
1.00 |
ML-DSA-65 sign |
650273 cycles |
649936 cycles |
1.00 |
ML-DSA-65 verify |
192931 cycles |
192844 cycles |
1.00 |
ML-DSA-87 keypair |
318799 cycles |
318799 cycles |
1 |
ML-DSA-87 sign |
828743 cycles |
828921 cycles |
1.00 |
ML-DSA-87 verify |
326813 cycles |
326734 cycles |
1.00 |
This comment was automatically generated by workflow using github-action-benchmark.
There was a problem hiding this comment.
Arm Cortex-A72 (Raspberry Pi 4) benchmarks (opt)
Details
| Benchmark suite | Current: 237e387 | Previous: 31300ad | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
222141 cycles |
223446 cycles |
0.99 |
ML-DSA-44 sign |
614240 cycles |
634283 cycles |
0.97 |
ML-DSA-44 verify |
226725 cycles |
223226 cycles |
1.02 |
ML-DSA-65 keypair |
385352 cycles |
393894 cycles |
0.98 |
ML-DSA-65 sign |
1003734 cycles |
1022240 cycles |
0.98 |
ML-DSA-65 verify |
372158 cycles |
378918 cycles |
0.98 |
ML-DSA-87 keypair |
650198 cycles |
644349 cycles |
1.01 |
ML-DSA-87 sign |
1362778 cycles |
1332260 cycles |
1.02 |
ML-DSA-87 verify |
638012 cycles |
627970 cycles |
1.02 |
This comment was automatically generated by workflow using github-action-benchmark.
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Arm Cortex-A72 (Raspberry Pi 4) benchmarks (opt)'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.03.
| Benchmark suite | Current: 7c13c63 | Previous: 70fdba0 | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
227496 cycles |
219616 cycles |
1.04 |
ML-DSA-44 verify |
235419 cycles |
214195 cycles |
1.10 |
ML-DSA-87 keypair |
661599 cycles |
635525 cycles |
1.04 |
ML-DSA-87 sign |
1369715 cycles |
1306530 cycles |
1.05 |
ML-DSA-87 verify |
645122 cycles |
616298 cycles |
1.05 |
This comment was automatically generated by workflow using github-action-benchmark.
There was a problem hiding this comment.
Intel Xeon 4th gen (c7i)
Details
| Benchmark suite | Current: 237e387 | Previous: 31300ad | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
43323 cycles |
43311 cycles |
1.00 |
ML-DSA-44 sign |
129973 cycles |
130234 cycles |
1.00 |
ML-DSA-44 verify |
45201 cycles |
45328 cycles |
1.00 |
ML-DSA-65 keypair |
75758 cycles |
75678 cycles |
1.00 |
ML-DSA-65 sign |
213832 cycles |
214141 cycles |
1.00 |
ML-DSA-65 verify |
74325 cycles |
74551 cycles |
1.00 |
ML-DSA-87 keypair |
123264 cycles |
122951 cycles |
1.00 |
ML-DSA-87 sign |
270347 cycles |
270036 cycles |
1.00 |
ML-DSA-87 verify |
120938 cycles |
120608 cycles |
1.00 |
This comment was automatically generated by workflow using github-action-benchmark.
There was a problem hiding this comment.
Intel Xeon 4th gen (c7i) (no-opt)
Details
| Benchmark suite | Current: 237e387 | Previous: 31300ad | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
91475 cycles |
91650 cycles |
1.00 |
ML-DSA-44 sign |
352301 cycles |
353391 cycles |
1.00 |
ML-DSA-44 verify |
99818 cycles |
100249 cycles |
1.00 |
ML-DSA-65 keypair |
153858 cycles |
153883 cycles |
1.00 |
ML-DSA-65 sign |
572079 cycles |
571341 cycles |
1.00 |
ML-DSA-65 verify |
159979 cycles |
159780 cycles |
1.00 |
ML-DSA-87 keypair |
255344 cycles |
255804 cycles |
1.00 |
ML-DSA-87 sign |
726579 cycles |
726454 cycles |
1.00 |
ML-DSA-87 verify |
264184 cycles |
264128 cycles |
1.00 |
This comment was automatically generated by workflow using github-action-benchmark.
There was a problem hiding this comment.
AMD EPYC 3rd gen (c6a)
Details
| Benchmark suite | Current: 237e387 | Previous: 31300ad | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
55494 cycles |
55575 cycles |
1.00 |
ML-DSA-44 sign |
158449 cycles |
159176 cycles |
1.00 |
ML-DSA-44 verify |
57633 cycles |
58038 cycles |
0.99 |
ML-DSA-65 keypair |
96318 cycles |
95925 cycles |
1.00 |
ML-DSA-65 sign |
258646 cycles |
259688 cycles |
1.00 |
ML-DSA-65 verify |
95634 cycles |
96324 cycles |
0.99 |
ML-DSA-87 keypair |
155356 cycles |
154620 cycles |
1.00 |
ML-DSA-87 sign |
323135 cycles |
323315 cycles |
1.00 |
ML-DSA-87 verify |
151250 cycles |
151152 cycles |
1.00 |
This comment was automatically generated by workflow using github-action-benchmark.
There was a problem hiding this comment.
Arm Cortex-A72 (Raspberry Pi 4) benchmarks (no-opt)
Details
| Benchmark suite | Current: 237e387 | Previous: 31300ad | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
298957 cycles |
309045 cycles |
0.97 |
ML-DSA-44 sign |
1130396 cycles |
1181040 cycles |
0.96 |
ML-DSA-44 verify |
327888 cycles |
338438 cycles |
0.97 |
ML-DSA-65 keypair |
557436 cycles |
569427 cycles |
0.98 |
ML-DSA-65 sign |
1888548 cycles |
1984198 cycles |
0.95 |
ML-DSA-65 verify |
538964 cycles |
570461 cycles |
0.94 |
ML-DSA-87 keypair |
861727 cycles |
894629 cycles |
0.96 |
ML-DSA-87 sign |
2454019 cycles |
2499364 cycles |
0.98 |
ML-DSA-87 verify |
907684 cycles |
918394 cycles |
0.99 |
This comment was automatically generated by workflow using github-action-benchmark.
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Arm Cortex-A72 (Raspberry Pi 4) benchmarks (no-opt)'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.03.
| Benchmark suite | Current: 7c13c63 | Previous: 70fdba0 | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
312772 cycles |
294913 cycles |
1.06 |
ML-DSA-44 sign |
1193382 cycles |
1147432 cycles |
1.04 |
ML-DSA-87 keypair |
904673 cycles |
847930 cycles |
1.07 |
ML-DSA-87 sign |
2468732 cycles |
2393137 cycles |
1.03 |
ML-DSA-87 verify |
906571 cycles |
874118 cycles |
1.04 |
This comment was automatically generated by workflow using github-action-benchmark.
There was a problem hiding this comment.
AMD EPYC 3rd gen (c6a) (no-opt)
Details
| Benchmark suite | Current: 237e387 | Previous: 31300ad | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
133692 cycles |
133431 cycles |
1.00 |
ML-DSA-44 sign |
520225 cycles |
519219 cycles |
1.00 |
ML-DSA-44 verify |
146942 cycles |
146686 cycles |
1.00 |
ML-DSA-65 keypair |
223592 cycles |
224467 cycles |
1.00 |
ML-DSA-65 sign |
841919 cycles |
843782 cycles |
1.00 |
ML-DSA-65 verify |
233762 cycles |
234011 cycles |
1.00 |
ML-DSA-87 keypair |
366674 cycles |
367264 cycles |
1.00 |
ML-DSA-87 sign |
1057851 cycles |
1060362 cycles |
1.00 |
ML-DSA-87 verify |
380118 cycles |
381078 cycles |
1.00 |
This comment was automatically generated by workflow using github-action-benchmark.
There was a problem hiding this comment.
Graviton2
Details
| Benchmark suite | Current: 237e387 | Previous: 31300ad | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
112327 cycles |
112432 cycles |
1.00 |
ML-DSA-44 sign |
354085 cycles |
353829 cycles |
1.00 |
ML-DSA-44 verify |
117505 cycles |
117251 cycles |
1.00 |
ML-DSA-65 keypair |
194501 cycles |
194915 cycles |
1.00 |
ML-DSA-65 sign |
584403 cycles |
584545 cycles |
1.00 |
ML-DSA-65 verify |
193506 cycles |
193060 cycles |
1.00 |
ML-DSA-87 keypair |
320982 cycles |
321247 cycles |
1.00 |
ML-DSA-87 sign |
747665 cycles |
747767 cycles |
1.00 |
ML-DSA-87 verify |
318354 cycles |
318871 cycles |
1.00 |
This comment was automatically generated by workflow using github-action-benchmark.
There was a problem hiding this comment.
Graviton4
Details
| Benchmark suite | Current: 237e387 | Previous: 31300ad | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
67271 cycles |
67334 cycles |
1.00 |
ML-DSA-44 sign |
198182 cycles |
198212 cycles |
1.00 |
ML-DSA-44 verify |
70155 cycles |
70164 cycles |
1.00 |
ML-DSA-65 keypair |
119526 cycles |
119314 cycles |
1.00 |
ML-DSA-65 sign |
326414 cycles |
326337 cycles |
1.00 |
ML-DSA-65 verify |
116796 cycles |
116812 cycles |
1.00 |
ML-DSA-87 keypair |
196482 cycles |
196615 cycles |
1.00 |
ML-DSA-87 sign |
421379 cycles |
421442 cycles |
1.00 |
ML-DSA-87 verify |
193268 cycles |
192981 cycles |
1.00 |
This comment was automatically generated by workflow using github-action-benchmark.
There was a problem hiding this comment.
AMD EPYC 4th gen (c7a)
Details
| Benchmark suite | Current: 237e387 | Previous: 31300ad | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
48126 cycles |
46837 cycles |
1.03 |
ML-DSA-44 sign |
138997 cycles |
140005 cycles |
0.99 |
ML-DSA-44 verify |
49819 cycles |
49295 cycles |
1.01 |
ML-DSA-65 keypair |
82346 cycles |
85296 cycles |
0.97 |
ML-DSA-65 sign |
226618 cycles |
235771 cycles |
0.96 |
ML-DSA-65 verify |
82230 cycles |
83871 cycles |
0.98 |
ML-DSA-87 keypair |
130321 cycles |
132099 cycles |
0.99 |
ML-DSA-87 sign |
281743 cycles |
282238 cycles |
1.00 |
ML-DSA-87 verify |
129649 cycles |
129367 cycles |
1.00 |
This comment was automatically generated by workflow using github-action-benchmark.
There was a problem hiding this comment.
Graviton4 (no-opt)
Details
| Benchmark suite | Current: 237e387 | Previous: 31300ad | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
127610 cycles |
127745 cycles |
1.00 |
ML-DSA-44 sign |
441047 cycles |
440937 cycles |
1.00 |
ML-DSA-44 verify |
136381 cycles |
136447 cycles |
1.00 |
ML-DSA-65 keypair |
220529 cycles |
220468 cycles |
1.00 |
ML-DSA-65 sign |
714603 cycles |
714745 cycles |
1.00 |
ML-DSA-65 verify |
220923 cycles |
221459 cycles |
1.00 |
ML-DSA-87 keypair |
364675 cycles |
364373 cycles |
1.00 |
ML-DSA-87 sign |
915835 cycles |
915833 cycles |
1.00 |
ML-DSA-87 verify |
370946 cycles |
371331 cycles |
1.00 |
This comment was automatically generated by workflow using github-action-benchmark.
There was a problem hiding this comment.
Intel Xeon 3rd gen (c6i)
Details
| Benchmark suite | Current: 237e387 | Previous: 31300ad | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
61559 cycles |
61513 cycles |
1.00 |
ML-DSA-44 sign |
188176 cycles |
187961 cycles |
1.00 |
ML-DSA-44 verify |
66304 cycles |
66502 cycles |
1.00 |
ML-DSA-65 keypair |
110399 cycles |
108141 cycles |
1.02 |
ML-DSA-65 sign |
314455 cycles |
311311 cycles |
1.01 |
ML-DSA-65 verify |
111028 cycles |
108776 cycles |
1.02 |
ML-DSA-87 keypair |
173234 cycles |
171604 cycles |
1.01 |
ML-DSA-87 sign |
378684 cycles |
380707 cycles |
0.99 |
ML-DSA-87 verify |
171059 cycles |
172479 cycles |
0.99 |
This comment was automatically generated by workflow using github-action-benchmark.
There was a problem hiding this comment.
Graviton2 (no-opt)
Details
| Benchmark suite | Current: 237e387 | Previous: 31300ad | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
212157 cycles |
211410 cycles |
1.00 |
ML-DSA-44 sign |
761446 cycles |
758945 cycles |
1.00 |
ML-DSA-44 verify |
229897 cycles |
228936 cycles |
1.00 |
ML-DSA-65 keypair |
378864 cycles |
377838 cycles |
1.00 |
ML-DSA-65 sign |
1248060 cycles |
1248443 cycles |
1.00 |
ML-DSA-65 verify |
373372 cycles |
372800 cycles |
1.00 |
ML-DSA-87 keypair |
602524 cycles |
600578 cycles |
1.00 |
ML-DSA-87 sign |
1584621 cycles |
1583512 cycles |
1.00 |
ML-DSA-87 verify |
618342 cycles |
616106 cycles |
1.00 |
This comment was automatically generated by workflow using github-action-benchmark.
…out + s2n-bignum main) Align the x86_64 eta4 proof to PR pq-code-package#1188's single-endbr64 .S (symbol mld_rej_uniform_eta4_avx2_asm, mid-guard 248-threshold body) and make it build end-to-end under nix: - Adopt PR pq-code-package#1188's proof .S + dev source (the local dev source was a divergent 224-threshold no-mid-guard rewrite that did not match the proof). - Shift every trimmed pc+N offset by -4 (loop head 56->52, scalar tail 318->314, post 406->402), drop one endbr64 from the define_assert byte list (411->407 bytes), tmc length 407->403, and fix the entry-crossing prologue step count (1--12)->(1--11) in CORRECT_SCAFFOLD_TAC. - Bump nix s2n-bignum pin to main eb5843f: the previously-pinned rev (and PR#1188's 2f8b8d8) lack the x86 decoder support + r8w/r8b REX-register defs eta4 needs, causing X86_MK_CORE_EXEC_RULE to fail with inst_bitpat_numeral. eb5843f decodes everything and defines r8w..r15w / r8b..r15b, so the hand-added register-alias shim is removed. MLDSA_REJ_UNIFORM_ETA4_CORRECT, _CORRECT_BOUND and _NOIBT_SUBROUTINE_CORRECT all prove cheat-free; check_axioms() now flags only the two deferred MEMSAFE stubs (still CHEAT_TAC). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
7c13c63 to
92cc012
Compare
021d5f2 to
61ff92e
Compare
|
Okay, thanks for review. I'll address those nits in when the proof files are added. Proofs are complete now, so cleaning up and preparing for review. |
34a0032 to
5e9bd22
Compare
88a47fd to
237e387
Compare
|
Ok, ready for review now. The proof files are pretty large, I've thrown claude at them a few times over to try and reduce and streamline the proofs as much as possible, but they are large. This shares some of the sampling table infrastructure with the |
oqs-bot
left a comment
There was a problem hiding this comment.
Graviton5
Details
| Benchmark suite | Current: 237e387 | Previous: 31300ad | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
51441 cycles |
51442 cycles |
1.00 |
ML-DSA-44 sign |
162168 cycles |
162042 cycles |
1.00 |
ML-DSA-44 verify |
54673 cycles |
54768 cycles |
1.00 |
ML-DSA-65 keypair |
90292 cycles |
90183 cycles |
1.00 |
ML-DSA-65 sign |
267938 cycles |
268062 cycles |
1.00 |
ML-DSA-65 verify |
89970 cycles |
89941 cycles |
1.00 |
ML-DSA-87 keypair |
146017 cycles |
145852 cycles |
1.00 |
ML-DSA-87 sign |
335274 cycles |
335524 cycles |
1.00 |
ML-DSA-87 verify |
145278 cycles |
144915 cycles |
1.00 |
This comment was automatically generated by workflow using github-action-benchmark.
oqs-bot
left a comment
There was a problem hiding this comment.
Graviton5 (no-opt)
Details
| Benchmark suite | Current: 237e387 | Previous: 31300ad | Ratio |
|---|---|---|---|
ML-DSA-44 keypair |
100037 cycles |
100026 cycles |
1.00 |
ML-DSA-44 sign |
368981 cycles |
369108 cycles |
1.00 |
ML-DSA-44 verify |
110162 cycles |
110142 cycles |
1.00 |
ML-DSA-65 keypair |
174279 cycles |
174573 cycles |
1.00 |
ML-DSA-65 sign |
599035 cycles |
599096 cycles |
1.00 |
ML-DSA-65 verify |
177906 cycles |
178198 cycles |
1.00 |
ML-DSA-87 keypair |
285478 cycles |
285839 cycles |
1.00 |
ML-DSA-87 sign |
760123 cycles |
759674 cycles |
1.00 |
ML-DSA-87 verify |
296766 cycles |
296320 cycles |
1.00 |
This comment was automatically generated by workflow using github-action-benchmark.
There was a problem hiding this comment.
Many thanks @jakemas for tackling the last two proofs. Looks like a massive amount of work.
The proven specifications are aligned with the aarch64 specs and look good to me!
There are a couple blocking issues:
- The CBMC specs are off by one.
- There are many dead lemmas that should be trimmed. Can you remove that is not needed here?
- There are many comments that don't help the reader understand the proof . Some read like status updates, some are an artifact of how you got there (search for
cheatand dates2026-xx-yy). Can you do a pass though the comments and keep only what is useful?
Could you tackle those please?
| version = "9061e8b76522beafa5ca020f3c8d99b23eba4fbc"; | ||
| # Temporarily pinned to the jakemas/s2n-bignum fork (PR awslabs/s2n-bignum#421, | ||
| # branch x86-add-vpbroadcastw) so CI picks up the VPBROADCASTW instruction model | ||
| # needed by the rej_uniform_eta2 AVX2 proof. Repoint to awslabs main once #421 merges. | ||
| version = "e714d36ddd97ee41cec043f0bc27b87d6f6efd68"; | ||
| src = fetchFromGitHub { | ||
| owner = "awslabs"; | ||
| owner = "jakemas"; | ||
| repo = "s2n-bignum"; | ||
| rev = "${version}"; | ||
| hash = "sha256-NvtrVfiz5yxfdNvD0P1wSQrn37znuWMbNWxys4jZlU4="; | ||
| hash = "sha256-hQ7Y+EHua2nMwF1uM/zyxwR3FWfSZCmq4RBwuHGeVGo="; |
There was a problem hiding this comment.
Marking this so we don't accidentally merge it like this.
| requires(table == mld_rej_uniform_table) | ||
| assigns(memory_slice(r, sizeof(int32_t) * MLDSA_N)) | ||
| ensures(return_value <= MLDSA_N) | ||
| ensures(array_bound(r, 0, return_value, -2, 2)) |
There was a problem hiding this comment.
The upper bound is exclusive, so this is wrong.
Use array_abs_bound( ..., 3)
| requires(table == mld_rej_uniform_table) | ||
| assigns(memory_slice(r, sizeof(int32_t) * MLDSA_N)) | ||
| ensures(return_value <= MLDSA_N) | ||
| ensures(array_bound(r, 0, return_value, -4, 4)) |
| yield idxs | ||
|
|
||
|
|
||
| def gen_avx2_rej_uniform_table_rows_c(): |
There was a problem hiding this comment.
This overlaps with the other PR. Please rebase it on top of that one.
There was a problem hiding this comment.
Yes, was going to fix this as part of the rebase once uniform_rej landed. fixed now and rebased on tip of main.
| MLD_CT_TESTING_DECLASSIFY(buf, buflen); | ||
| outlen = mld_rej_uniform_eta4_avx2(r, buf); | ||
| outlen = mld_rej_uniform_eta4_avx2_asm( | ||
| r, buf, (const uint8_t *)mld_rej_uniform_table); |
There was a problem hiding this comment.
Can we eliminate the cast here?
| ==> REJ_SAMPLE_ETA4_BYTES [b] = | ||
| [word_sx(word_sub (word 4:int16) (word(val b MOD 16))):int32; | ||
| word_sx(word_sub (word 4:int16) (word(val b DIV 16))):int32]`, | ||
| REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[REJ_SAM |
| ==> REJ_SAMPLE_ETA4_BYTES [b] = | ||
| [word_sx(word_sub (word 4:int16) (word(val b MOD 16))):int32; | ||
| word_sx(word_sub (word 4:int16) (word(val b DIV 16))):int32]`, | ||
| REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[REJ_SAM |
There was a problem hiding this comment.
CAn we eliminate this extra theorem? it's okay to prove the bound only for the subroutine form.
| ==> REJ_SAMPLE_ETA4_BYTES [b] = | ||
| [word_sx(word_sub (word 4:int16) (word(val b MOD 16))):int32; | ||
| word_sx(word_sub (word 4:int16) (word(val b DIV 16))):int32]`, | ||
| REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[REJ_SAM |
| ==> REJ_SAMPLE_ETA4_BYTES [b] = | ||
| [word_sx(word_sub (word 4:int16) (word(val b MOD 16))):int32; | ||
| word_sx(word_sub (word 4:int16) (word(val b DIV 16))):int32]`, | ||
| REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[REJ_SAM |
| SUBGOAL_THEN `a MOD 2 EXP 32 = a` (fun th -> REWRITE_TAC[th]) THENL | ||
| [MATCH_MP_TAC MOD_LT THEN ASM_ARITH_TAC; ASM_ARITH_TAC]);; | ||
|
|
||
| let VAL_WORD_GE_9 = prove |
There was a problem hiding this comment.
This lemma is not used anywhere.
According to Claude, there are a total of 98 dead helpers in this file (plus another 24 in the eta2 file). Could you please do a pass eliminating all lemmas that are unused.
There was a problem hiding this comment.
Thank you, I thought I'd already done a pass on this, but you're right. Removed ~114 unused.
129c72a to
afe6b75
Compare
…d-written assembly and HOL-Light proofs Replaces the rej_uniform_eta2 and rej_uniform_eta4 AVX2 intrinsics with hand-written assembly, and adds HOL-Light functional-correctness and memory-safety proofs for both x86_64 routines, plus the CBMC proof for the native wrapper. Both routines are variable-time, so — as for the AArch64 eta proofs — only functional correctness and memory safety are proven, not constant time. The table is passed as a parameter and all constants are built from immediates (no .rodata), following the rej_uniform approach in #1014. The proofs use the VPBROADCASTW instruction, so the s2n-bignum nix pin is temporarily moved to the fork branch of awslabs/s2n-bignum#421 until it lands on main. Signed-off-by: Jake Massimo <jakemas@amazon.com>
afe6b75 to
908d880
Compare
rej_uniform_etawith assembly #419rej_uniform_eta#917Summary
Replaces the AVX2 intrinsics implementations of
rej_uniform_eta2andrej_uniform_eta4with hand-written x86_64 assembly, and adds HOL-Light functional-correctness and memory-safety proofs for both routines. Follows the same approach as #1014:.rodata), enabling HOL-Light formal verification.__contract__annotations on the asm entry points (CBMC), kept in sync with the HOL-Light specs.meta.hwires both eta2 and eta4 to the new asm, so the functional test suite exercises both paths.Makefileanddump_bytecode.mlregister the eta2/eta4 bytecode dump targets; ABI-checker tests added for both.poly_uniform_eta_4xcomponent benchmark.s2n-bignum dependency
The proofs use the
VPBROADCASTWinstruction, added in awslabs/s2n-bignum#421. Until that merges, the nix pin (nix/s2n_bignum/default.nix) is temporarily pointed at thejakemas/s2n-bignumfork branch so CI can decode the instruction; it will be repointed toawslabsmain once #421 lands.