Skip to content

Commit e5b3150

Browse files
tob-joecodex
andcommitted
Sync ML-KEM Keccak generated wipes
Regenerate the forced-cross Keccak outputs after adding stack clearing to the shared x4 source. The aarch64 host-local autogen path skipped the x86_64 generated files, but CI regenerates them on x86_64 and with forced cross toolchains. This expands the generated wipe-store blocks in the checked-in Armv8.1-M and x86_64 outputs so the native autogen and HOL-Light bytecode dry-run checks agree with the source. Co-authored-by: Codex <codex@openai.com> Signed-off-by: Joe Doyle <joseph.doyle@trailofbits.com>
1 parent 7c0acd0 commit e5b3150

3 files changed

Lines changed: 56 additions & 15 deletions

File tree

mlkem/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -683,11 +683,14 @@ Lkeccak_f1600_x4_mve_asm_roundend_pre:
683683
Lkeccak_f1600_x4_mve_asm_roundend:
684684
movs r0, #0x0
685685
vdup.32 q0, r0
686-
.set .Lkeccak_f1600_x4_mve_clear_stack_offset, 0
687-
.rept 8
688-
vstrw.32 q0, [sp, #.Lkeccak_f1600_x4_mve_clear_stack_offset]
689-
.set .Lkeccak_f1600_x4_mve_clear_stack_offset, .Lkeccak_f1600_x4_mve_clear_stack_offset + 16
690-
.endr
686+
vstrw.32 q0, [sp]
687+
vstrw.32 q0, [sp, #16]
688+
vstrw.32 q0, [sp, #32]
689+
vstrw.32 q0, [sp, #48]
690+
vstrw.32 q0, [sp, #64]
691+
vstrw.32 q0, [sp, #80]
692+
vstrw.32 q0, [sp, #96]
693+
vstrw.32 q0, [sp, #112]
691694
add sp, #0x80
692695
.cfi_adjust_cfa_offset -0x80
693696
vpop {d8, d9, d10, d11, d12, d13, d14, d15}

mlkem/src/fips202/native/x86_64/src/keccak_f1600_x4_avx2_asm.S

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -474,11 +474,30 @@ LLkeccak_f1600_x4_avx2:
474474
vmovq %xmm15, 0x250(%rdi)
475475
vmovhpd %xmm15, 0x318(%rdi)
476476
vpxor %ymm0, %ymm0, %ymm0
477-
.set .Lkeccak_f1600_x4_avx2_clear_stack_offset, 0
478-
.rept 24
479-
vmovdqu %ymm0, .Lkeccak_f1600_x4_avx2_clear_stack_offset(%rsp)
480-
.set .Lkeccak_f1600_x4_avx2_clear_stack_offset, .Lkeccak_f1600_x4_avx2_clear_stack_offset + 32
481-
.endr
477+
vmovdqu %ymm0, (%rsp)
478+
vmovdqu %ymm0, 0x20(%rsp)
479+
vmovdqu %ymm0, 0x40(%rsp)
480+
vmovdqu %ymm0, 0x60(%rsp)
481+
vmovdqu %ymm0, 0x80(%rsp)
482+
vmovdqu %ymm0, 0xa0(%rsp)
483+
vmovdqu %ymm0, 0xc0(%rsp)
484+
vmovdqu %ymm0, 0xe0(%rsp)
485+
vmovdqu %ymm0, 0x100(%rsp)
486+
vmovdqu %ymm0, 0x120(%rsp)
487+
vmovdqu %ymm0, 0x140(%rsp)
488+
vmovdqu %ymm0, 0x160(%rsp)
489+
vmovdqu %ymm0, 0x180(%rsp)
490+
vmovdqu %ymm0, 0x1a0(%rsp)
491+
vmovdqu %ymm0, 0x1c0(%rsp)
492+
vmovdqu %ymm0, 0x1e0(%rsp)
493+
vmovdqu %ymm0, 0x200(%rsp)
494+
vmovdqu %ymm0, 0x220(%rsp)
495+
vmovdqu %ymm0, 0x240(%rsp)
496+
vmovdqu %ymm0, 0x260(%rsp)
497+
vmovdqu %ymm0, 0x280(%rsp)
498+
vmovdqu %ymm0, 0x2a0(%rsp)
499+
vmovdqu %ymm0, 0x2c0(%rsp)
500+
vmovdqu %ymm0, 0x2e0(%rsp)
482501
movq %r11, %rsp
483502
.cfi_def_cfa_register %rsp
484503
retq

proofs/hol_light/x86_64/mlkem/keccak_f1600_x4_avx2_asm.S

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -477,11 +477,30 @@ LLkeccak_f1600_x4_avx2:
477477
vmovq %xmm15, 0x250(%rdi)
478478
vmovhpd %xmm15, 0x318(%rdi)
479479
vpxor %ymm0, %ymm0, %ymm0
480-
.set .Lkeccak_f1600_x4_avx2_clear_stack_offset, 0
481-
.rept 24
482-
vmovdqu %ymm0, .Lkeccak_f1600_x4_avx2_clear_stack_offset(%rsp)
483-
.set .Lkeccak_f1600_x4_avx2_clear_stack_offset, .Lkeccak_f1600_x4_avx2_clear_stack_offset + 32
484-
.endr
480+
vmovdqu %ymm0, (%rsp)
481+
vmovdqu %ymm0, 0x20(%rsp)
482+
vmovdqu %ymm0, 0x40(%rsp)
483+
vmovdqu %ymm0, 0x60(%rsp)
484+
vmovdqu %ymm0, 0x80(%rsp)
485+
vmovdqu %ymm0, 0xa0(%rsp)
486+
vmovdqu %ymm0, 0xc0(%rsp)
487+
vmovdqu %ymm0, 0xe0(%rsp)
488+
vmovdqu %ymm0, 0x100(%rsp)
489+
vmovdqu %ymm0, 0x120(%rsp)
490+
vmovdqu %ymm0, 0x140(%rsp)
491+
vmovdqu %ymm0, 0x160(%rsp)
492+
vmovdqu %ymm0, 0x180(%rsp)
493+
vmovdqu %ymm0, 0x1a0(%rsp)
494+
vmovdqu %ymm0, 0x1c0(%rsp)
495+
vmovdqu %ymm0, 0x1e0(%rsp)
496+
vmovdqu %ymm0, 0x200(%rsp)
497+
vmovdqu %ymm0, 0x220(%rsp)
498+
vmovdqu %ymm0, 0x240(%rsp)
499+
vmovdqu %ymm0, 0x260(%rsp)
500+
vmovdqu %ymm0, 0x280(%rsp)
501+
vmovdqu %ymm0, 0x2a0(%rsp)
502+
vmovdqu %ymm0, 0x2c0(%rsp)
503+
vmovdqu %ymm0, 0x2e0(%rsp)
485504
movq %r11, %rsp
486505
.cfi_def_cfa_register %rsp
487506
retq

0 commit comments

Comments
 (0)