Skip to content

Commit b5b7dc8

Browse files
Merge pull request #9819 from holtrop-wolfssl/rust-ml-dsa
Rust wrapper: add dilithium module
2 parents b63f878 + 7af0fa4 commit b5b7dc8

7 files changed

Lines changed: 1770 additions & 0 deletions

File tree

.github/workflows/rust-wrapper.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ jobs:
3838
# Add new configs here
3939
'',
4040
'--enable-all',
41+
'--enable-all --enable-dilithium',
4142
'--enable-cryptonly --disable-examples',
4243
'--enable-cryptonly --disable-examples --disable-aes --disable-aesgcm',
4344
'--enable-cryptonly --disable-examples --disable-aescbc',

wrapper/rust/wolfssl-wolfcrypt/build.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,22 @@ fn scan_cfg() -> Result<()> {
312312
println!("cargo:rustc-cfg=rsa_const_api");
313313
}
314314

315+
/* dilithium / ML-DSA */
316+
check_cfg(&binding, "wc_dilithium_init", "dilithium");
317+
check_cfg(&binding, "wc_dilithium_make_key", "dilithium_make_key");
318+
check_cfg(&binding, "wc_dilithium_make_key_from_seed", "dilithium_make_key_from_seed");
319+
check_cfg(&binding, "wc_dilithium_sign_msg", "dilithium_sign");
320+
check_cfg(&binding, "wc_dilithium_sign_msg_with_seed", "dilithium_sign_with_seed");
321+
check_cfg(&binding, "wc_dilithium_verify_msg", "dilithium_verify");
322+
check_cfg(&binding, "wc_dilithium_import_public", "dilithium_import");
323+
check_cfg(&binding, "wc_dilithium_export_public", "dilithium_export");
324+
check_cfg(&binding, "wc_dilithium_check_key", "dilithium_check_key");
325+
check_cfg(&binding, "DILITHIUM_LEVEL2_KEY_SIZE", "dilithium_level2");
326+
check_cfg(&binding, "DILITHIUM_LEVEL3_KEY_SIZE", "dilithium_level3");
327+
check_cfg(&binding, "DILITHIUM_LEVEL5_KEY_SIZE", "dilithium_level5");
328+
check_cfg(&binding, "DILITHIUM_SEED_SZ", "dilithium_make_key_seed_sz");
329+
check_cfg(&binding, "DILITHIUM_RND_SZ", "dilithium_rnd_sz");
330+
315331
/* sha */
316332
check_cfg(&binding, "wc_InitSha", "sha");
317333
check_cfg(&binding, "wc_InitSha224", "sha224");

wrapper/rust/wolfssl-wolfcrypt/headers.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@
1919
#include "wolfssl/wolfcrypt/logging.h"
2020
#include "wolfssl/wolfcrypt/aes.h"
2121
#include "wolfssl/wolfcrypt/pwdbased.h"
22+
#include "wolfssl/wolfcrypt/dilithium.h"

0 commit comments

Comments
 (0)