Skip to content

Commit a6d9f2e

Browse files
committed
Rename Dilithium implementation file/symbols to ML-DSA, add backwards-compat shims
The post-quantum signature algorithm originally implemented as Dilithium was standardized by NIST as ML-DSA in FIPS 204. This commit renames the implementation file pair, the public API surface, and every internal helper to the canonical ML-DSA names, mirroring the earlier Kyber -> ML-KEM migration in wc_mlkem.{h,c}. This commit deliberately scopes the change to the rename + compatibility surface only. **No in-tree consumer call sites are converted.** Existing in-tree consumers (TLS layer, ASN.1 / EVP / cryptocb wrappers, tests, benchmark, examples, Rust wrapper) keep using the legacy spelling and compile through the dilithium.h symbol-alias shim and the bi-directional settings.h gate shim. New consumer code can include <wolfssl/wolfcrypt/wc_mldsa.h> directly and use the canonical names. Rebased onto current master (50da0c0) so that PR wolfSSL#10399's ML-DSA Wconversion fixes (commit 2833a4b, ~220 (sword32)/(byte)/(word32) casts in dilithium.c plus three cast hunks in asn.c) are inherited into the new wc_mldsa.c via the file rename. The asn.c cast hunks land separately on master and aren't part of this commit. File layout ----------- wolfcrypt/src/dilithium.c -> wolfcrypt/src/wc_mldsa.c wolfssl/wolfcrypt/dilithium.h -> wolfssl/wolfcrypt/wc_mldsa.h The legacy <wolfssl/wolfcrypt/dilithium.h> path is reborn as a thin compatibility shim that #include's wc_mldsa.h and provides macro aliases for every legacy linkage symbol. Build-gate rename ----------------- HAVE_DILITHIUM -> WOLFSSL_HAVE_MLDSA WOLFSSL_DILITHIUM_* -> WOLFSSL_MLDSA_* (~25 sub-config gates) WC_DILITHIUM_CACHE_* -> WC_MLDSA_CACHE_* WC_DILITHIUM_FIXED_ARRAY -> WC_MLDSA_FIXED_ARRAY WC_DILITHIUMKEY_TYPE_DEFINED -> WC_MLDSAKEY_TYPE_DEFINED The configure summary echoes "ML-DSA: yes" rather than "DILITHIUM: yes". The --enable-dilithium configure switch is preserved as a convenience alias for --enable-mldsa. A new wolfssl/wolfcrypt/settings_legacy_mldsa.h is included from settings.h after user_settings.h. It is bi-directional: defining the legacy gate (e.g. -DHAVE_DILITHIUM) implies the canonical gate, and defining the canonical gate (e.g. via --enable-mldsa) implies the legacy gate. The whole shim can be globally suppressed by defining WOLFSSL_NO_DILITHIUM_LEGACY_GATES. Public API rename ----------------- Type: dilithium_key -> MlDsaKey Init / lifecycle (wolfSSL idiom: 1-arg simple form, 3-arg _ex form): wc_dilithium_init -> wc_MlDsaKey_Init wc_dilithium_init_ex -> wc_MlDsaKey_Init_ex wc_dilithium_init_id -> wc_MlDsaKey_InitId wc_dilithium_init_label -> wc_MlDsaKey_InitLabel wc_dilithium_new -> wc_MlDsaKey_New wc_dilithium_delete -> wc_MlDsaKey_Delete wc_dilithium_free -> wc_MlDsaKey_Free Parameters / sizing: wc_dilithium_set_level -> wc_MlDsaKey_SetParams wc_dilithium_get_level -> wc_MlDsaKey_GetParams wc_dilithium_size -> wc_MlDsaKey_Size wc_dilithium_priv_size -> wc_MlDsaKey_PrivSize wc_dilithium_pub_size -> wc_MlDsaKey_PubSize wc_dilithium_sig_size -> wc_MlDsaKey_SigSize wc_dilithium_check_key -> wc_MlDsaKey_CheckKey Key generation: wc_dilithium_make_key -> wc_MlDsaKey_MakeKey wc_dilithium_make_key_from_seed -> wc_MlDsaKey_MakeKeyFromSeed Raw export (no argument reorder): wc_dilithium_export_public -> wc_MlDsaKey_ExportPubRaw wc_dilithium_export_private[_only] -> wc_MlDsaKey_ExportPrivRaw wc_dilithium_export_key -> wc_MlDsaKey_ExportKey Raw import / sign / verify / DER decode (FIPS 204 / ML-KEM convention puts the key first; legacy form put it last): wc_dilithium_import_public(in, inLen, key) -> wc_MlDsaKey_ImportPubRaw(key, in, inLen) wc_dilithium_import_private[_only](priv, privSz, key) -> wc_MlDsaKey_ImportPrivRaw(key, priv, privSz) wc_dilithium_import_key(priv, privSz, pub, pubSz, key) -> wc_MlDsaKey_ImportKey(key, priv, privSz, pub, pubSz) wc_dilithium_sign_msg / sign_ctx_msg / sign_ctx_hash / *_with_seed -> wc_MlDsaKey_Sign / SignCtx / SignCtxHash / *WithSeed wc_dilithium_verify_msg / verify_ctx_msg / verify_ctx_hash / verify_mu -> wc_MlDsaKey_Verify / VerifyCtx / VerifyCtxHash / VerifyMu wc_Dilithium_PrivateKeyDecode(in, idx, key, sz) -> wc_MlDsaKey_PrivateKeyDecode(key, in, sz, idx) wc_Dilithium_PublicKeyDecode(in, idx, key, sz) -> wc_MlDsaKey_PublicKeyDecode(key, in, sz, idx) ASN.1 encode (no reorder): wc_Dilithium_PublicKeyToDer -> wc_MlDsaKey_PublicKeyToDer wc_Dilithium_PrivateKeyToDer -> wc_MlDsaKey_PrivateKeyToDer wc_Dilithium_KeyToDer -> wc_MlDsaKey_KeyToDer OpenSSL-compat enum: Adds WC_EVP_PKEY_MLDSA / EVP_PKEY_MLDSA. The legacy WC_EVP_PKEY_DILITHIUM / EVP_PKEY_DILITHIUM remain as enum aliases to the same value (no ABI change for the enum itself). Type forward declaration in wolfssl/wolfcrypt/asn_public.h: The 6-line forward declaration `typedef struct dilithium_key dilithium_key;` (guarded by WC_DILITHIUMKEY_TYPE_DEFINED) is flipped to `typedef struct MlDsaKey MlDsaKey;` (guarded by WC_MLDSAKEY_TYPE_DEFINED). Struct field type in wolfssl/wolfcrypt/asn.h: The two `struct dilithium_key` references inside SignatureCtx's ML-DSA union arm reference `struct MlDsaKey` directly. The field name (`dilithium`) is unchanged so legacy-spelled consumer code keeps working. Internal helper rename ---------------------- All ~80 lower-case static / file-scope helpers in wc_mldsa.{h,c} and wc_mldsa_asm.S are renamed dilithium_* -> mldsa_* for consistency with ML-KEM's mlkem_* convention. The two WOLFSSL_TEST_VIS encoders wc_dilithium_encode_w1_88/32 become wc_mldsa_encode_w1_88/32. The struct typedef wc_dilithium_params becomes wc_mldsa_params. The FIPS 204 spec-derived constants (DILITHIUM_Q, DILITHIUM_N, DILITHIUM_LEVEL{2,3,5}_*, DILITHIUM_ML_DSA_{44,65,87}_*) are kept under their existing names. Compatibility surface --------------------- Two independent shims, each suppressible via its own opt-out: - The wolfssl/wolfcrypt/dilithium.h compatibility shim provides macro aliases for every legacy linkage symbol. Direct one-to-one #defines for the no-reorder APIs and function-like macros that swap arguments back for the 16 arg-reorder APIs. Suppressed by defining WOLFSSL_NO_DILITHIUM_LEGACY_NAMES. - The wolfssl/wolfcrypt/settings_legacy_mldsa.h shim is bi-directional: defining either spelling of any of the 32 build gates implies the other. Suppressed by defining WOLFSSL_NO_DILITHIUM_LEGACY_GATES. A small block of internal-helper aliases at the bottom of dilithium.h covers WOLFSSL_LOCAL `dilithium_get_oid_sum` and the WOLFSSL_TEST_VIS `wc_dilithium_encode_w1_*` encoders that this branch's unmigrated in-tree consumers (src/ssl_load.c and tests/api/test_mldsa.c) still call. Tests / verification -------------------- A compile-time validation block at the bottom of wc_mldsa.c (under WOLFSSL_NO_DILITHIUM_LEGACY_NAMES suppression) exercises every legacy macro alias. The bodies sit inside `if (0)` so the compiler parses and type-checks the expansions without emitting any runtime call. A missing or misordered alias produces an immediate compile error. Wconversion preservation: master's PR wolfSSL#10399 added 220 `(sword32)` casts (and several `(byte)` / `(word32)` casts) inside dilithium.c. After the file rename, the new wc_mldsa.c has all 220 `(sword32)` casts intact (count verified equal between master's dilithium.c and our new wc_mldsa.c). Builds clean with --enable-mldsa and --enable-dilithium (legacy alias). make check passes; testwolfcrypt DILITHIUM test passes. https://claude.ai/code/session_01N9vLeZw4Gsfb11N4BU1Mbe
1 parent 50da0c0 commit a6d9f2e

31 files changed

Lines changed: 3425 additions & 2455 deletions

CMakeLists.txt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -673,18 +673,22 @@ if (WOLFSSL_PQC_HYBRIDS)
673673
list(APPEND WOLFSSL_DEFINITIONS "-DWOLFSSL_PQC_HYBRIDS")
674674
endif()
675675

676-
# Dilithium
676+
# ML-DSA (FIPS 204; legacy name: Dilithium)
677+
add_option(WOLFSSL_MLDSA
678+
"Enable the wolfSSL PQ ML-DSA (FIPS 204) implementation (default: disabled)"
679+
"no" "yes;no")
680+
# Legacy alias: WOLFSSL_DILITHIUM. Kept for backward compatibility.
677681
add_option(WOLFSSL_DILITHIUM
678-
"Enable the wolfSSL PQ Dilithium (ML-DSA) implementation (default: disabled)"
682+
"Legacy alias for WOLFSSL_MLDSA (default: disabled)"
679683
"no" "yes;no")
680684

681-
if (WOLFSSL_DILITHIUM)
682-
list(APPEND WOLFSSL_DEFINITIONS "-DHAVE_DILITHIUM")
685+
if (WOLFSSL_MLDSA OR WOLFSSL_DILITHIUM)
686+
list(APPEND WOLFSSL_DEFINITIONS "-DWOLFSSL_HAVE_MLDSA")
683687
list(APPEND WOLFSSL_DEFINITIONS "-DWOLFSSL_SHA3")
684688
list(APPEND WOLFSSL_DEFINITIONS "-DWOLFSSL_SHAKE128")
685689
list(APPEND WOLFSSL_DEFINITIONS "-DWOLFSSL_SHAKE256")
686690

687-
set_wolfssl_definitions("HAVE_DILITHIUM" RESULT)
691+
set_wolfssl_definitions("WOLFSSL_HAVE_MLDSA" RESULT)
688692
set_wolfssl_definitions("WOLFSSL_SHA3" RESULT)
689693
set_wolfssl_definitions("WOLFSSL_SHAKE128" RESULT)
690694
set_wolfssl_definitions("WOLFSSL_SHAKE256" RESULT)

ChangeLog.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@
22

33
## Enhancements
44

5+
* Renamed the post-quantum signature implementation from its
6+
pre-standardization name *Dilithium* to its NIST-standardized name
7+
**ML-DSA** (FIPS 204), mirroring the earlier Kyber → ML-KEM rename
8+
in `wc_mlkem.{h,c}`. The legacy `<wolfssl/wolfcrypt/dilithium.h>`
9+
header, `dilithium_key` type, `wc_dilithium_*` / `wc_Dilithium_*`
10+
functions, and `HAVE_DILITHIUM` / `WOLFSSL_DILITHIUM_*` /
11+
`WC_DILITHIUM_*` build gates remain available through a temporary
12+
compatibility shim, so application code keeps compiling unchanged.
13+
See [doc/dilithium-to-mldsa-migration.md](doc/dilithium-to-mldsa-migration.md)
14+
for the full list of renamed symbols, the new `WOLFSSL_MLDSA` cmake
15+
option / `--enable-mldsa` configure switch, the OpenSSL-aligned
16+
`WC_EVP_PKEY_ML_DSA_44/65/87` NIDs, and the migration steps for
17+
moving consumer code to the canonical API.
18+
519
* TLS 1.3: zero traffic key staging buffers in `SetKeysSide()` once a
620
CryptoCB callback has imported the AES key into a Secure Element
721
(`aes->devCtx != NULL`). Clears `keys->{client,server}_write_key`

IDE/INTIME-RTOS/libwolfssl.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<ClCompile Include="..\..\wolfcrypt\src\cpuid.c" />
4343
<ClCompile Include="..\..\wolfcrypt\src\cryptocb.c" />
4444
<ClCompile Include="..\..\wolfcrypt\src\des3.c" />
45-
<ClCompile Include="..\..\wolfcrypt\src\dilithium.c" />
45+
<ClCompile Include="..\..\wolfcrypt\src\wc_mldsa.c" />
4646
<ClCompile Include="..\..\wolfcrypt\src\dh.c" />
4747
<ClCompile Include="..\..\wolfcrypt\src\dsa.c" />
4848
<ClCompile Include="..\..\wolfcrypt\src\ecc.c" />

IDE/INTIME-RTOS/wolfssl-lib.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
<ClCompile Include="..\..\wolfcrypt\src\cpuid.c" />
8080
<ClCompile Include="..\..\wolfcrypt\src\cryptocb.c" />
8181
<ClCompile Include="..\..\wolfcrypt\src\curve448.c" />
82-
<ClCompile Include="..\..\wolfcrypt\src\dilithium.c" />
82+
<ClCompile Include="..\..\wolfcrypt\src\wc_mldsa.c" />
8383
<ClCompile Include="..\..\wolfcrypt\src\eccsi.c" />
8484
<ClCompile Include="..\..\wolfcrypt\src\ed448.c" />
8585
<ClCompile Include="..\..\wolfcrypt\src\evp.c">

IDE/WIN10/wolfssl-fips.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@
318318
<ClCompile Include="..\..\wolfcrypt\src\wolfmath.c" />
319319
<ClCompile Include="..\..\wolfcrypt\src\wolfevent.c" />
320320
<ClCompile Include="..\..\wolfcrypt\src\pkcs12.c" />
321-
<ClCompile Include="..\..\wolfcrypt\src\dilithium.c" />
321+
<ClCompile Include="..\..\wolfcrypt\src\wc_mldsa.c" />
322322
<ClCompile Include="..\..\wolfcrypt\src\wc_lms.c" />
323323
<ClCompile Include="..\..\wolfcrypt\src\wc_lms_impl.c" />
324324
<ClCompile Include="..\..\wolfcrypt\src\wc_xmss.c" />

IDE/XCODE/wolfssl-FIPS.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
700F0CF22A2FC11300755BA7 /* curve448.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 700F0CD32A2FC0D500755BA7 /* curve448.h */; };
123123
700F0CF32A2FC11300755BA7 /* curve25519.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 700F0CC82A2FC0D500755BA7 /* curve25519.h */; };
124124
700F0CF42A2FC11300755BA7 /* dilithium.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 700F0CE52A2FC0D500755BA7 /* dilithium.h */; };
125+
700F0CE52A2FC0D500755BC0 /* wc_mldsa.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 700F0CE52A2FC0D500755BC1 /* wc_mldsa.h */; };
125126
700F0CF52A2FC11300755BA7 /* eccsi.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 700F0CDB2A2FC0D500755BA7 /* eccsi.h */; };
126127
700F0CF62A2FC11300755BA7 /* ed448.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 700F0CD22A2FC0D500755BA7 /* ed448.h */; };
127128
700F0CF72A2FC11300755BA7 /* ed25519.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 700F0CE12A2FC0D500755BA7 /* ed25519.h */; };
@@ -280,6 +281,7 @@
280281
700F0CF22A2FC11300755BA7 /* curve448.h in CopyFiles */,
281282
700F0CF32A2FC11300755BA7 /* curve25519.h in CopyFiles */,
282283
700F0CF42A2FC11300755BA7 /* dilithium.h in CopyFiles */,
284+
700F0CE52A2FC0D500755BC0 /* wc_mldsa.h in CopyFiles */,
283285
700F0CF52A2FC11300755BA7 /* eccsi.h in CopyFiles */,
284286
700F0CF62A2FC11300755BA7 /* ed448.h in CopyFiles */,
285287
700F0CF72A2FC11300755BA7 /* ed25519.h in CopyFiles */,
@@ -583,6 +585,7 @@
583585
700F0CE22A2FC0D500755BA7 /* ge_448.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ge_448.h; path = ../../wolfssl/wolfcrypt/ge_448.h; sourceTree = "<group>"; };
584586
700F0CE42A2FC0D500755BA7 /* pkcs12.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pkcs12.h; path = ../../wolfssl/wolfcrypt/pkcs12.h; sourceTree = "<group>"; };
585587
700F0CE52A2FC0D500755BA7 /* dilithium.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dilithium.h; path = ../../wolfssl/wolfcrypt/dilithium.h; sourceTree = "<group>"; };
588+
700F0CE52A2FC0D500755BC1 /* wc_mldsa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = wc_mldsa.h; path = ../../wolfssl/wolfcrypt/wc_mldsa.h; sourceTree = "<group>"; };
586589
700F0CE62A2FC0D500755BA7 /* sakke.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sakke.h; path = ../../wolfssl/wolfcrypt/sakke.h; sourceTree = "<group>"; };
587590
700F0CE72A2FC0D500755BA7 /* signature.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = signature.h; path = ../../wolfssl/wolfcrypt/signature.h; sourceTree = "<group>"; };
588591
700F0CE82A2FC0D500755BA7 /* wc_pkcs11.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = wc_pkcs11.h; path = ../../wolfssl/wolfcrypt/wc_pkcs11.h; sourceTree = "<group>"; };
@@ -634,6 +637,7 @@
634637
700F0CD32A2FC0D500755BA7 /* curve448.h */,
635638
700F0CC82A2FC0D500755BA7 /* curve25519.h */,
636639
700F0CE52A2FC0D500755BA7 /* dilithium.h */,
640+
700F0CE52A2FC0D500755BC1 /* wc_mldsa.h */,
637641
700F0CDB2A2FC0D500755BA7 /* eccsi.h */,
638642
700F0CD22A2FC0D500755BA7 /* ed448.h */,
639643
700F0CE12A2FC0D500755BA7 /* ed25519.h */,

IDE/XCODE/wolfssl.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@
253253
700F0C0A2A2FBC5100755BA7 /* curve448.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 700F0BE32A2FBC1500755BA7 /* curve448.h */; };
254254
700F0C0B2A2FBC5100755BA7 /* curve25519.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 700F0BE52A2FBC1500755BA7 /* curve25519.h */; };
255255
700F0C0C2A2FBC5100755BA7 /* dilithium.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 700F0BEF2A2FBC1500755BA7 /* dilithium.h */; };
256+
700F0BEF2A2FBC1500755BC0 /* wc_mldsa.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 700F0BEF2A2FBC1500755BC1 /* wc_mldsa.h */; };
256257
700F0C0D2A2FBC5100755BA7 /* eccsi.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 700F0BF72A2FBC1600755BA7 /* eccsi.h */; };
257258
700F0C0E2A2FBC5100755BA7 /* ed448.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 700F0BF82A2FBC1600755BA7 /* ed448.h */; };
258259
700F0C0F2A2FBC5100755BA7 /* ed25519.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 700F0BF42A2FBC1600755BA7 /* ed25519.h */; };
@@ -617,6 +618,7 @@
617618
700F0C0A2A2FBC5100755BA7 /* curve448.h in CopyFiles */,
618619
700F0C0B2A2FBC5100755BA7 /* curve25519.h in CopyFiles */,
619620
700F0C0C2A2FBC5100755BA7 /* dilithium.h in CopyFiles */,
621+
700F0BEF2A2FBC1500755BC0 /* wc_mldsa.h in CopyFiles */,
620622
700F0C0D2A2FBC5100755BA7 /* eccsi.h in CopyFiles */,
621623
700F0C0E2A2FBC5100755BA7 /* ed448.h in CopyFiles */,
622624
700F0C0F2A2FBC5100755BA7 /* ed25519.h in CopyFiles */,
@@ -983,6 +985,7 @@
983985
700F0BED2A2FBC1500755BA7 /* chacha20_poly1305.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = chacha20_poly1305.h; path = ../../wolfssl/wolfcrypt/chacha20_poly1305.h; sourceTree = "<group>"; };
984986
700F0BEE2A2FBC1500755BA7 /* cryptocb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cryptocb.h; path = ../../wolfssl/wolfcrypt/cryptocb.h; sourceTree = "<group>"; };
985987
700F0BEF2A2FBC1500755BA7 /* dilithium.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dilithium.h; path = ../../wolfssl/wolfcrypt/dilithium.h; sourceTree = "<group>"; };
988+
700F0BEF2A2FBC1500755BC1 /* wc_mldsa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = wc_mldsa.h; path = ../../wolfssl/wolfcrypt/wc_mldsa.h; sourceTree = "<group>"; };
986989
700F0BF02A2FBC1500755BA7 /* sakke.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sakke.h; path = ../../wolfssl/wolfcrypt/sakke.h; sourceTree = "<group>"; };
987990
700F0BF12A2FBC1600755BA7 /* cpuid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cpuid.h; path = ../../wolfssl/wolfcrypt/cpuid.h; sourceTree = "<group>"; };
988991
700F0BF22A2FBC1600755BA7 /* selftest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = selftest.h; path = ../../wolfssl/wolfcrypt/selftest.h; sourceTree = "<group>"; };
@@ -1144,6 +1147,7 @@
11441147
700F0BE32A2FBC1500755BA7 /* curve448.h */,
11451148
700F0BE52A2FBC1500755BA7 /* curve25519.h */,
11461149
700F0BEF2A2FBC1500755BA7 /* dilithium.h */,
1150+
700F0BEF2A2FBC1500755BC1 /* wc_mldsa.h */,
11471151
700F0BF72A2FBC1600755BA7 /* eccsi.h */,
11481152
700F0BF82A2FBC1600755BA7 /* ed448.h */,
11491153
700F0BF42A2FBC1600755BA7 /* ed25519.h */,

cmake/functions.cmake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ function(generate_build_flags)
210210
if(WOLFSSL_MLKEM OR WOLFSSL_USER_SETTINGS)
211211
set(BUILD_WC_MLKEM "yes" PARENT_SCOPE)
212212
endif()
213-
if(WOLFSSL_DILITHIUM OR WOLFSSL_USER_SETTINGS)
214-
set(BUILD_DILITHIUM "yes" PARENT_SCOPE)
213+
if(WOLFSSL_MLDSA OR WOLFSSL_DILITHIUM OR WOLFSSL_USER_SETTINGS)
214+
set(BUILD_MLDSA "yes" PARENT_SCOPE)
215215
endif()
216216
if(WOLFSSL_FALCON OR WOLFSSL_USER_SETTINGS)
217217
set(BUILD_FALCON "yes" PARENT_SCOPE)
@@ -1029,8 +1029,8 @@ function(generate_lib_src_list LIB_SOURCES)
10291029
list(APPEND LIB_SOURCES wolfcrypt/src/falcon.c)
10301030
endif()
10311031

1032-
if(BUILD_DILITHIUM)
1033-
list(APPEND LIB_SOURCES wolfcrypt/src/dilithium.c)
1032+
if(BUILD_MLDSA)
1033+
list(APPEND LIB_SOURCES wolfcrypt/src/wc_mldsa.c)
10341034

10351035
if(BUILD_INTELASM)
10361036
list(APPEND LIB_SOURCES wolfcrypt/src/wc_mldsa_asm.S)

cmake/options.h.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ extern "C" {
9696
#cmakedefine HAVE_CURVE448
9797
#undef HAVE_DH_DEFAULT_PARAMS
9898
#cmakedefine HAVE_DH_DEFAULT_PARAMS
99-
#undef HAVE_DILITHIUM
100-
#cmakedefine HAVE_DILITHIUM
99+
#undef WOLFSSL_HAVE_MLDSA
100+
#cmakedefine WOLFSSL_HAVE_MLDSA
101101
#undef HAVE_ECC
102102
#cmakedefine HAVE_ECC
103103
#undef HAVE_ECH

configure.ac

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1810,54 +1810,54 @@ AC_ARG_ENABLE([extra-pqc-hybrids],
18101810
# - SHA3, Shake128 and Shake256
18111811
AC_ARG_ENABLE([mldsa],
18121812
[AS_HELP_STRING([--enable-mldsa],[Enable ML-DSA/Dilithium (default: disabled)])],
1813-
[ ENABLED_DILITHIUM=$enableval ],
1814-
[ ENABLED_DILITHIUM=no ]
1813+
[ ENABLED_MLDSA=$enableval ],
1814+
[ ENABLED_MLDSA=no ]
18151815
)
18161816
# note, inherits default from "mldsa" clause above.
18171817
AC_ARG_ENABLE([dilithium],
18181818
[AS_HELP_STRING([--enable-dilithium],[Alias for --enable-mldsa])],
1819-
[ ENABLED_DILITHIUM=$enableval ]
1819+
[ ENABLED_MLDSA=$enableval ]
18201820
)
18211821

1822-
ENABLED_DILITHIUM_OPTS=$ENABLED_DILITHIUM
1823-
ENABLED_DILITHIUM_MAKE_KEY=no
1824-
ENABLED_DILITHIUM_SIGN=no
1825-
ENABLED_DILITHIUM_VERIFY=no
1826-
for v in `echo $ENABLED_DILITHIUM_OPTS | tr "," " "`
1822+
ENABLED_MLDSA_OPTS=$ENABLED_MLDSA
1823+
ENABLED_MLDSA_MAKE_KEY=no
1824+
ENABLED_MLDSA_SIGN=no
1825+
ENABLED_MLDSA_VERIFY=no
1826+
for v in `echo $ENABLED_MLDSA_OPTS | tr "," " "`
18271827
do
18281828
case $v in
18291829
yes)
18301830
ENABLED_MLDSA44=yes
18311831
ENABLED_MLDSA65=yes
18321832
ENABLED_MLDSA87=yes
1833-
ENABLED_DILITHIUM_MAKE_KEY=yes
1834-
ENABLED_DILITHIUM_SIGN=yes
1835-
ENABLED_DILITHIUM_VERIFY=yes
1833+
ENABLED_MLDSA_MAKE_KEY=yes
1834+
ENABLED_MLDSA_SIGN=yes
1835+
ENABLED_MLDSA_VERIFY=yes
18361836
;;
18371837
no)
18381838
;;
18391839
all)
1840-
ENABLED_DILITHIUM_MAKE_KEY=yes
1841-
ENABLED_DILITHIUM_SIGN=yes
1842-
ENABLED_DILITHIUM_VERIFY=yes
1840+
ENABLED_MLDSA_MAKE_KEY=yes
1841+
ENABLED_MLDSA_SIGN=yes
1842+
ENABLED_MLDSA_VERIFY=yes
18431843
;;
18441844
make)
1845-
ENABLED_DILITHIUM_MAKE_KEY=yes
1845+
ENABLED_MLDSA_MAKE_KEY=yes
18461846
;;
18471847
sign)
1848-
ENABLED_DILITHIUM_SIGN=yes
1848+
ENABLED_MLDSA_SIGN=yes
18491849
;;
18501850
verify)
1851-
ENABLED_DILITHIUM_VERIFY=yes
1851+
ENABLED_MLDSA_VERIFY=yes
18521852
;;
18531853
verify-only)
1854-
ENABLED_DILITHIUM_MAKE_KEY=no
1855-
ENABLED_DILITHIUM_SIGN=no
1856-
ENABLED_DILITHIUM_VERIFY=yes
1857-
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DILITHIUM_VERIFY_ONLY"
1854+
ENABLED_MLDSA_MAKE_KEY=no
1855+
ENABLED_MLDSA_SIGN=no
1856+
ENABLED_MLDSA_VERIFY=yes
1857+
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_MLDSA_VERIFY_ONLY"
18581858
;;
18591859
small)
1860-
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DILITHIUM_SMALL"
1860+
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_MLDSA_SMALL"
18611861
;;
18621862
44)
18631863
ENABLED_MLDSA44=yes
@@ -1869,13 +1869,13 @@ do
18691869
ENABLED_MLDSA87=yes
18701870
;;
18711871
draft|fips204-draft)
1872-
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DILITHIUM_FIPS204_DRAFT"
1872+
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_MLDSA_FIPS204_DRAFT"
18731873
;;
18741874
no-ctx)
1875-
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DILITHIUM_NO_CTX"
1875+
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_MLDSA_NO_CTX"
18761876
;;
18771877
*)
1878-
AC_MSG_ERROR([Invalid choice for DILITHIUM [all,make,sign,verify,verify-only,small,44,65,87,no-ctx]: $ENABLED_DILITHIUM.])
1878+
AC_MSG_ERROR([Invalid choice for DILITHIUM [all,make,sign,verify,verify-only,small,44,65,87,no-ctx]: $ENABLED_MLDSA.])
18791879
break;;
18801880
esac
18811881
done
@@ -6265,15 +6265,15 @@ AS_CASE([$FIPS_VERSION],
62656265
ENABLED_MLKEM_ENCAPSULATE="yes"
62666266
ENABLED_MLKEM_DECAPSULATE="yes"])
62676267
6268-
AS_IF([test "$ENABLED_DILITHIUM" != "yes" &&
6268+
AS_IF([test "$ENABLED_MLDSA" != "yes" &&
62696269
(test "$FIPS_VERSION" != "dev" || test "$enable_dilithium" != "no")],
6270-
[ENABLED_DILITHIUM="yes"
6270+
[ENABLED_MLDSA="yes"
62716271
ENABLED_MLDSA44="yes"
62726272
ENABLED_MLDSA65="yes"
62736273
ENABLED_MLDSA87="yes"
6274-
ENABLED_DILITHIUM_MAKE_KEY="yes"
6275-
ENABLED_DILITHIUM_SIGN="yes"
6276-
ENABLED_DILITHIUM_VERIFY="yes"])
6274+
ENABLED_MLDSA_MAKE_KEY="yes"
6275+
ENABLED_MLDSA_SIGN="yes"
6276+
ENABLED_MLDSA_VERIFY="yes"])
62776277
62786278
AS_IF([test "$ENABLED_XMSS" != "yes" &&
62796279
(test "$FIPS_VERSION" != "dev" || test "$enable_xmss" != "no")],
@@ -7195,7 +7195,7 @@ then
71957195
ENABLED_SHAKE128=yes
71967196
ENABLED_SHAKE256=yes
71977197
fi
7198-
if test "$ENABLED_DILITHIUM" != "no"
7198+
if test "$ENABLED_MLDSA" != "no"
71997199
then
72007200
ENABLED_SHA3=yes
72017201
ENABLED_SHAKE128=yes
@@ -7362,10 +7362,10 @@ then
73627362
fi
73637363
73647364
# Dilithium CFLAG processing (after FIPS section for sandwich pattern)
7365-
if test "$ENABLED_DILITHIUM" != "no"
7365+
if test "$ENABLED_MLDSA" != "no"
73667366
then
7367-
AM_CFLAGS="$AM_CFLAGS -DHAVE_DILITHIUM"
7368-
AM_CCASFLAGS="$AM_CCASFLAGS -DHAVE_DILITHIUM"
7367+
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_MLDSA"
7368+
AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_HAVE_MLDSA"
73697369
73707370
if test "$ENABLED_MLDSA44" = ""; then
73717371
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NO_ML_DSA_44"
@@ -7376,14 +7376,14 @@ then
73767376
if test "$ENABLED_MLDSA87" = ""; then
73777377
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NO_ML_DSA_87"
73787378
fi
7379-
if test "$ENABLED_DILITHIUM_MAKE_KEY" = "no"; then
7380-
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DILITHIUM_NO_MAKE_KEY"
7379+
if test "$ENABLED_MLDSA_MAKE_KEY" = "no"; then
7380+
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_MLDSA_NO_MAKE_KEY"
73817381
fi
7382-
if test "$ENABLED_DILITHIUM_SIGN" = "no"; then
7383-
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DILITHIUM_NO_SIGN"
7382+
if test "$ENABLED_MLDSA_SIGN" = "no"; then
7383+
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_MLDSA_NO_SIGN"
73847384
fi
7385-
if test "$ENABLED_DILITHIUM_VERIFY" = "no"; then
7386-
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DILITHIUM_NO_VERIFY"
7385+
if test "$ENABLED_MLDSA_VERIFY" = "no"; then
7386+
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_MLDSA_NO_VERIFY"
73877387
fi
73887388
73897389
test "$enable_sha3" = "" && enable_sha3=yes
@@ -12037,7 +12037,7 @@ AM_CONDITIONAL([BUILD_WC_LMS],[test "x$ENABLED_LMS" != "xno" || test "x$ENABLED_
1203712037
AM_CONDITIONAL([BUILD_WC_XMSS],[test "x$ENABLED_XMSS" != "xno" || test "x$ENABLED_USERSETTINGS" = "xyes"])
1203812038
AM_CONDITIONAL([BUILD_WC_SLHDSA],[test "x$ENABLED_SLHDSA" != "xno" || test "x$ENABLED_USERSETTINGS" = "xyes"])
1203912039
AM_CONDITIONAL([BUILD_WC_MLKEM],[test "x$ENABLED_MLKEM" != "xno" || test "x$ENABLED_USERSETTINGS" = "xyes"])
12040-
AM_CONDITIONAL([BUILD_DILITHIUM],[test "x$ENABLED_DILITHIUM" != "xno" || test "x$ENABLED_USERSETTINGS" = "xyes"])
12040+
AM_CONDITIONAL([BUILD_MLDSA],[test "x$ENABLED_MLDSA" != "xno" || test "x$ENABLED_USERSETTINGS" = "xyes"])
1204112041
AM_CONDITIONAL([BUILD_ECCSI],[test "x$ENABLED_ECCSI" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
1204212042
AM_CONDITIONAL([BUILD_SAKKE],[test "x$ENABLED_SAKKE" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
1204312043
AM_CONDITIONAL([BUILD_MEMORY],[test "x$ENABLED_MEMORY" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
@@ -12590,7 +12590,7 @@ echo " * LMS: $ENABLED_LMS"
1259012590
echo " * XMSS: $ENABLED_XMSS"
1259112591
echo " * SLH-DSA $ENABLED_SLHDSA"
1259212592
echo " * MLKEM: $ENABLED_MLKEM"
12593-
echo " * DILITHIUM: $ENABLED_DILITHIUM"
12593+
echo " * ML-DSA: $ENABLED_MLDSA"
1259412594
echo " * ECCSI $ENABLED_ECCSI"
1259512595
echo " * SAKKE $ENABLED_SAKKE"
1259612596
echo " * ASN: $ENABLED_ASN"

0 commit comments

Comments
 (0)