-
Couldn't load subscription status.
- Fork 901
Add _new/_delete API for ML-KEM/ML-DSA #9039
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
Conversation
|
🛟 Devin Lifeguard found 1 likely issues in this PR
@tamasan238 |
|
Add ML-KEM/ML-DSA support for C# wrapper Add C# examples using ML-KEM/ML-DSA |
|
@tamasan238 update the "assignees" to be wolfssl-bot when ready for re-review / merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds memory allocation and deallocation functions for ML-KEM and ML-DSA (Dilithium) key structures to support C# bindings where the structure size depends on build options.
- Adds
wc_MlKemKey_New()andwc_MlKemKey_Delete()functions for ML-KEM - Adds
wc_dilithium_new()andwc_dilithium_delete()functions for ML-DSA - Includes test coverage for the new allocation/deallocation functions
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| wolfssl/wolfcrypt/mlkem.h | Adds function declarations for ML-KEM key allocation/deallocation |
| wolfssl/wolfcrypt/dilithium.h | Adds function declarations for Dilithium key allocation/deallocation |
| wolfcrypt/src/wc_mlkem.c | Implements ML-KEM key allocation and deallocation functions |
| wolfcrypt/src/dilithium.c | Implements Dilithium key allocation and deallocation functions |
| wolfcrypt/test/test.c | Adds basic tests for the new allocation/deallocation functions |
|
Thank you for your review! |
e07d591 to
14b40ec
Compare
I have confirmed that some tests have failed. If you have any information, I would appreciate your help. |
|
Retest this please |
|
Retry tests removed most errors, but still one is left. Log: |
|
@kojiws Thank you so much!! |
|
retest this please |
|
The error was “These APIs cannot be found when using liboqs.” |
|
retest this please |
|
I finally passed all the tests. @kojiws Thank you!! |

Description
Added below to solve trouble allocating memory for the MlKemKey structure in C#.
Since the size of the MlKemKey structure depends on the build options, these are needed.
wolfCrypt/wc_mlkem.c:wc_MlKemKey_New(),wc_MlKemKey_Delete()wolfCrypt/wc_dilithium.c:wc_dilithium_new(),wc_dilithium_delete()This PR is related to another PR I'll add in the comments.
I'm not familiar with adding code to wolfCrypt.
Please feel free to point out any inappropriate parts.
Testing
Tested.
Checklist