-
Notifications
You must be signed in to change notification settings - Fork 811
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
Dilithium: add option to precalc with small sign #7744
Merged
dgarske
merged 9 commits into
wolfSSL:master
from
SparkiDev:dilithium_sign_small_precalc
Jul 26, 2024
Merged
Dilithium: add option to precalc with small sign #7744
dgarske
merged 9 commits into
wolfSSL:master
from
SparkiDev:dilithium_sign_small_precalc
Jul 26, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83fbfb2
to
0962ace
Compare
0962ace
to
2589e11
Compare
WOLFSSL_DILITHIUM_SIGN_SMALL_MEM_PRECALC added. It allocates memory for and pre-calculates s1, s2 and t0. This saves decoding the vectors repeatedly in each signature trial.
WOLFSSL_DILITHIUM_SIGN_SMALL_MEM_PRECALC_A added. It allocated memory for and pre-calculates matrix A. This saves recreating A in each signature trial.
Add implementation of make key that uses smaller amounts of memory: WOLFSSL_DILITHIUM_MAKE_KEY_SMALL_MEM. Add new compile option, WOLFSSL_DILITHIUM_SMALL_MEM_POLY64, that uses a 64-bit polynomial for multiplication results, saving many montgomery reductions.
Add API dilithium_sample_in_ball_ex() that takes the block to use. dilithium_sample_in_ball() allocates if small stack is defined or uses the stack and calls dilithium_sample_in_ball_ex().
Add API dilithium_rej_ntt_poly_ex() that takes the block to use. dilithium_rej_ntt_poly() allocates if small stack is defined or uses the stack and calls dilithium_rej_ntt_poly_ex().
2589e11
to
77f0159
Compare
Only allocate once when verifying with small mem.
Please squash before committing. |
dgarske
approved these changes
Jul 26, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
WOLFSSL_DILITHIUM_SIGN_SMALL_MEM_PRECALC added.
It allocates memory for and pre-calculates s1, s2 and t0.
This saves decoding the vectors repeatedly in each signature trial.
Testing
./configure 'CC=clang -fsanitize=address' '--disable-shared' '--enable-experimental' '--enable-intelasm' '--enable-dilithium' 'CFLAGS=-DWOLFSSL_DILITHIUM_SIGN_SMALL_MEM' '--enable-debug'
make test
Checklist