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

Falcon verification inside Miden VM #1000

Merged
merged 2 commits into from
Oct 5, 2023
Merged

Falcon verification inside Miden VM #1000

merged 2 commits into from
Oct 5, 2023

Conversation

Al-Kindi-0
Copy link
Collaborator

@Al-Kindi-0 Al-Kindi-0 commented Jul 10, 2023

Describe your changes

The following PR implements the Falcon DSA verification procedure inside Miden VM. The integration test is fully dynamic and relies on a naive C implementation of RPO, in order to do the hash-to-point with RPO instead of SHAKE256, and the reference C implementation for the rest.
The current cycle count is approximately 100k cycles. There are at least 3 optimization ideas that can hopefully half this number and these will be elaborated in a separate issue.

Edit: An improvement using the segment polynomial decomposition applied to the product polynomial in order to half the number of exponentiations of the random challenge $\tau$ as well as the number of memory addresses initialized to zero. This brings the cycle count to 89k cycles.

Checklist before requesting a review

  • Repo forked and branch created from next according to naming convention.
  • Commit messages and codestyle follow conventions.
  • Relevant issues are linked in the PR description.
  • Tests added for new functionality.
  • Documentation/comments updated according to changes.

Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thank you! I left a few comments inline. Most of them are about optimization ideas which we could do in the future. For these, we could create an issue summarizing these ideas and implement them in future PRs. Overall, with all optimizations applied, I think we might be able to reduce the cycle count to about 60K - 50K.

For this PR, let's:

  • Rebase from the latest next.
  • Add more tests (specifically for failure cases).
  • Address any other comments which are relatively simple to do.

Lastly, we should probably do the above after we merge 0xPolygonMiden/crypto#179.

stdlib/asm/crypto/dsa/falcon.masm Outdated Show resolved Hide resolved
stdlib/asm/crypto/dsa/falcon.masm Outdated Show resolved Hide resolved
stdlib/asm/crypto/dsa/falcon.masm Outdated Show resolved Hide resolved
stdlib/asm/crypto/dsa/falcon.masm Outdated Show resolved Hide resolved
stdlib/asm/crypto/dsa/falcon.masm Outdated Show resolved Hide resolved
stdlib/asm/crypto/dsa/falcon.masm Outdated Show resolved Hide resolved
stdlib/asm/crypto/dsa/falcon.masm Outdated Show resolved Hide resolved
stdlib/asm/crypto/dsa/falcon.masm Outdated Show resolved Hide resolved
stdlib/asm/crypto/dsa/falcon.masm Outdated Show resolved Hide resolved
stdlib/tests/crypto/falcon.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All looks good! Thank you! I left a couple of non-blocking comments inline.

core/src/lib.rs Outdated Show resolved Hide resolved
core/src/lib.rs Outdated Show resolved Hide resolved
stdlib/asm/crypto/dsa/rpo_falcon512.masm Outdated Show resolved Hide resolved
@bobbinth bobbinth merged commit 5c57495 into next Oct 5, 2023
15 checks passed
@bobbinth bobbinth deleted the al-falcon branch October 5, 2023 08:35
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

Successfully merging this pull request may close these issues.

2 participants