formosa-crypto / formosa-mlkem

Other
11 stars 7 forks source link

improved gen_matrix + SCT protections #8

Closed tfaoliveira closed 8 months ago

tfaoliveira commented 9 months ago

Currently, branch "fgmsct" (reads final gen matrix + sct) contains an updated version for MLKEM-768.

The changes for MLKEM reference implementation are the following:

1) improved keccakf1600:

2) improved gen_matrix (useful for AVX2 implementation [wip])

3) remove -lea as default (most additions were performed using LEA instruction instead of add)

4) jkem.jazz checks with -checkSCT (spectre v1 protected)

For the moment, I'm done with the reference implementation, and soon, I will start pushing into this branch the avx2 patch.

note: this work requires this commit from Jasmin https://github.com/jasmin-lang/jasmin/commit/f071a81bf24f9f514b35d304b525f9266296951f (so, I'm using latest Jasmin from main)

tfaoliveira commented 9 months ago
  1. mlkem_avx2: update to keccakf1600_4x and gen_matrix:
    • 334271d0a87421359f7751deeddbc9da1c7154b8
    • cycles before: (113,109,111)
    • cycles after: (55,51,53)
    • object size: before: 194KB; after: 103KB;
tfaoliveira commented 9 months ago
  1. mlkem_avx2 is now SCT; will be updated when keccakf1600 avx2
tfaoliveira-sb commented 8 months ago

I will close as https://github.com/formosa-crypto/hakyber/pull/32 supersedes this work. I will not delete the branch for the time being (I can use it as reference to adjust the mlkem ref implementation)