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

ML-KEM/Kyber: small memory usage #8412

Merged
merged 1 commit into from
Feb 4, 2025

Conversation

SparkiDev
Copy link
Contributor

Description

Options to compile ML-KEM/Kyber to use less dynamic memory.
Only available with C code and has small performance trade-off.

Testing

Regression tested ML-KEM/Kyber.

Checklist

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

@SparkiDev SparkiDev self-assigned this Feb 3, 2025
@SparkiDev SparkiDev force-pushed the mlkem_kyber_small_mem branch 3 times, most recently from 208dd09 to 95c92cc Compare February 3, 2025 03:29
@SparkiDev
Copy link
Contributor Author

retest this please

Options to compile ML-KEM/Kyber to use less dynamic memory.
Only available with C code and has small performance trade-off.
@SparkiDev SparkiDev force-pushed the mlkem_kyber_small_mem branch from 95c92cc to 316177a Compare February 4, 2025 00:52
@SparkiDev SparkiDev assigned wolfSSL-Bot and unassigned SparkiDev Feb 4, 2025
@SparkiDev SparkiDev requested a review from wolfSSL-Bot February 4, 2025 01:33
Copy link
Contributor

@dgarske dgarske left a comment

Choose a reason for hiding this comment

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

All tests out and works great. The memory numbers I see are heap reduce from 17576 to 7848.

./configure --enable-all --enable-experimental --enable-dilithium --enable-kyber CFLAGS="-DWOLFSSL_MLKEM_ENCAPSULATE_SMALL_MEM -DWOLFSSL_MLKEM_MAKEKEY_SMALL_MEM" --enable-trackmemory=verbose --enable-stacksize=verbose --disable-asm && make

Before:

KYBER    test passed!
    relative stack peak usage = 36872 bytes
    relative heap peak usage: 3 allocs, 17576 bytes

After (with small):

KYBER    test passed!
    relative stack peak usage = 36936 bytes
    relative heap peak usage: 3 allocs, 7848 bytes

@dgarske dgarske merged commit f0b3c29 into wolfSSL:master Feb 4, 2025
163 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