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

Dilithium: add option to precalc with small sign #7744

Merged
merged 9 commits into from
Jul 26, 2024

Conversation

SparkiDev
Copy link
Contributor

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

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@SparkiDev SparkiDev self-assigned this Jul 11, 2024
@SparkiDev SparkiDev force-pushed the dilithium_sign_small_precalc branch 5 times, most recently from 83fbfb2 to 0962ace Compare July 22, 2024 00:59
@SparkiDev SparkiDev force-pushed the dilithium_sign_small_precalc branch from 0962ace to 2589e11 Compare July 24, 2024 10:21
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().
@SparkiDev SparkiDev force-pushed the dilithium_sign_small_precalc branch from 2589e11 to 77f0159 Compare July 25, 2024 01:26
Only allocate once when verifying with small mem.
@SparkiDev
Copy link
Contributor Author

Please squash before committing.

@dgarske dgarske merged commit f7094ff into wolfSSL:master Jul 26, 2024
121 checks passed
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.

3 participants