Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
a-lve opened this issue Aug 12, 2024 · 5 comments

Comments

@a-lve
Copy link

a-lve commented Aug 12, 2024

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 e47864b, 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
Copy link
Contributor

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
Copy link
Contributor

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

@dop-amin
Copy link
Contributor

@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
Copy link
Contributor

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

@dop-amin
Copy link
Contributor

dop-amin commented Sep 26, 2024

@a-lve I removed the parts that had been written in assembly for M4. You can find my fork of the pq-crystals repo including memory optimization here https://github.com/dop-amin/dilithium/tree/lowram. It's also submitted as a PR to pq-crystals pq-crystals/dilithium#91.
Hope that helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants