mupq / pqm4

Post-quantum crypto library for the ARM Cortex-M4
280 stars 70 forks source link

How to get DiLithium's pure C code optimization, so that the stack usage can reach less than 3KB #352

Open a-lve opened 1 month ago

a-lve commented 1 month ago

As mentioned in the https://eprint.iacr.org/2022/323.pdf article, the paper uses pure c optimization, so that the stack usage reaches less than 3kb, and shows that We integrated our implementation into a local fork of the benchmarking framework pqm4(Commit hash e47864b3, forked on 8 Oct 2021), but I didn't find the relevant commit and its pure C code optimization, only commit#340, but there is specific optimization code for the m4 architecture in it, but I want to use the optimization code implemented in pure C, is there any way to get it

mkannwischer commented 1 month ago

Unfortunately, they did not publish their code - NXP never does.

If you need it to be pure C, best you can do it take our M4 optimized code and replace all assembly yourself. Should not be hard to do.

It would be useful if we could have such an implementation in pqm4/mupq. Please open a PR if you wrote one.

mkannwischer commented 1 month ago

@dop-amin do happen to have one lying around? This is probably something we could upstream to the reference implementation repo.

dop-amin commented 4 weeks ago

@dop-amin do happen to have one lying around? This is probably something we could upstream to the reference implementation repo.

Sorry, right now I don't have such code. Do you mean just any C code or C code implementing common optimizations?

mkannwischer commented 4 weeks ago

I think having anything with an optimized memory footprint would be good. Speed optimizations can be added later if needed.