Skip to content

Commit f24d38e

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 f24d38e

27 files changed

Lines changed: 2990 additions & 2393 deletions

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -679,12 +679,12 @@ add_option(WOLFSSL_DILITHIUM
679679
"no" "yes;no")
680680

681681
if (WOLFSSL_DILITHIUM)
682-
list(APPEND WOLFSSL_DEFINITIONS "-DHAVE_DILITHIUM")
682+
list(APPEND WOLFSSL_DEFINITIONS "-DWOLFSSL_HAVE_MLDSA")
683683
list(APPEND WOLFSSL_DEFINITIONS "-DWOLFSSL_SHA3")
684684
list(APPEND WOLFSSL_DEFINITIONS "-DWOLFSSL_SHAKE128")
685685
list(APPEND WOLFSSL_DEFINITIONS "-DWOLFSSL_SHAKE256")
686686

687-
set_wolfssl_definitions("HAVE_DILITHIUM" RESULT)
687+
set_wolfssl_definitions("WOLFSSL_HAVE_MLDSA" RESULT)
688688
set_wolfssl_definitions("WOLFSSL_SHA3" RESULT)
689689
set_wolfssl_definitions("WOLFSSL_SHAKE128" RESULT)
690690
set_wolfssl_definitions("WOLFSSL_SHAKE256" RESULT)

ChangeLog.md

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

33
## Enhancements
44

5+
* Renamed the ML-DSA implementation file pair from
6+
`wolfcrypt/src/dilithium.c` and `wolfssl/wolfcrypt/dilithium.h` to
7+
`wolfcrypt/src/wc_mldsa.c` and `wolfssl/wolfcrypt/wc_mldsa.h`,
8+
matching the existing ML-KEM (`wc_mlkem.{h,c}`) naming convention.
9+
Inside that pair, the public API surface and every internal helper
10+
is renamed to its FIPS 204 ML-DSA spelling: `dilithium_key` becomes
11+
`MlDsaKey`, every `wc_dilithium_*` / `wc_Dilithium_*` function
12+
becomes `wc_MlDsaKey_*` (with the FIPS 204 / ML-KEM key-first
13+
argument order for sign / verify / import / DER-decode entry
14+
points), `HAVE_DILITHIUM` becomes `WOLFSSL_HAVE_MLDSA`, every
15+
`WOLFSSL_DILITHIUM_*` / `WC_DILITHIUM_*` sub-config gate becomes
16+
`WOLFSSL_MLDSA_*` / `WC_MLDSA_*`, and the lower-case static
17+
helpers (`dilithium_get_params`, `dilithium_hash256`, etc.) become
18+
`mldsa_*`. The internal parameter-table struct keeps its wolfSSL
19+
MixedCase form: `wc_dilithium_params` becomes `MlDsaParams`. The
20+
`wc_MlDsaKey_Init` canonical entry point takes 3 arguments
21+
(`MlDsaKey*`, `void* heap`, `int devId`) to match the ML-KEM
22+
`wc_MlKemKey_Init` convention; the legacy 1-argument
23+
`wc_dilithium_init(key)` is mapped through the shim to
24+
`wc_MlDsaKey_Init(key, NULL, INVALID_DEVID)`.
25+
26+
Backwards compatibility is preserved through two TEMPORARY shims,
27+
each suppressible via its own opt-out. The shims exist solely to
28+
ease the migration window and will be removed in a future release;
29+
consumer code should be migrated to the canonical names before the
30+
shims are dropped.
31+
32+
- `<wolfssl/wolfcrypt/dilithium.h>` is now a compatibility shim
33+
that includes `wc_mldsa.h` and provides macro aliases for the
34+
legacy `dilithium_key` / `wc_dilithium_*` / `wc_Dilithium_*`
35+
names, including function-like macros that swap arguments back
36+
for the entry points where the new prototype reorders them.
37+
Define `WOLFSSL_NO_DILITHIUM_LEGACY_NAMES` before including the
38+
shim to suppress the aliases. The `dilithium_key` typedef alias
39+
is also exposed from `<wolfssl/wolfcrypt/asn_public.h>` so code
40+
that included only that header on master keeps compiling.
41+
42+
- `<wolfssl/wolfcrypt/settings_legacy_mldsa.h>` (auto-included
43+
from `settings.h` immediately after `user_settings.h`) keeps
44+
the legacy and canonical build-gate names in sync
45+
bi-directionally, so existing `user_settings.h` files and
46+
build flags using `HAVE_DILITHIUM` / `WOLFSSL_DILITHIUM_*` /
47+
`WC_DILITHIUM_*` keep working, and unmigrated consumer code
48+
can continue to gate on either name. Define
49+
`WOLFSSL_NO_DILITHIUM_LEGACY_GATES` to suppress the
50+
cross-define.
51+
52+
The OpenSSL-compat enum gains `WC_EVP_PKEY_MLDSA` /
53+
`EVP_PKEY_MLDSA`; the legacy `WC_EVP_PKEY_DILITHIUM` /
54+
`EVP_PKEY_DILITHIUM` names remain as aliases to the same numeric
55+
value. The `--enable-dilithium` configure switch is preserved as a
56+
convenience alias for `--enable-mldsa`.
57+
58+
**ABI note:** the library's exported linkage symbols are renamed
59+
(the `.so` now exports `wc_MlDsaKey_*` instead of
60+
`wc_dilithium_*`). Applications that linked dynamically against
61+
the legacy symbol names need to either recompile against the
62+
legacy header path (which provides macro aliases that resolve to
63+
the new symbols) or switch their sources to the canonical names.
64+
Existing in-tree consumer code keeps using the legacy spelling and
65+
compiles through the shim — new consumer code must include
66+
`wc_mldsa.h` directly and use the canonical names.
67+
568
* TLS 1.3: zero traffic key staging buffers in `SetKeysSide()` once a
669
CryptoCB callback has imported the AES key into a Secure Element
770
(`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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ function(generate_lib_src_list LIB_SOURCES)
10301030
endif()
10311031

10321032
if(BUILD_DILITHIUM)
1033-
list(APPEND LIB_SOURCES wolfcrypt/src/dilithium.c)
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: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1854,10 +1854,10 @@ do
18541854
ENABLED_DILITHIUM_MAKE_KEY=no
18551855
ENABLED_DILITHIUM_SIGN=no
18561856
ENABLED_DILITHIUM_VERIFY=yes
1857-
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DILITHIUM_VERIFY_ONLY"
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,10 +1869,10 @@ 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
*)
18781878
AC_MSG_ERROR([Invalid choice for DILITHIUM [all,make,sign,verify,verify-only,small,44,65,87,no-ctx]: $ENABLED_DILITHIUM.])
@@ -7364,8 +7364,8 @@ fi
73647364
# Dilithium CFLAG processing (after FIPS section for sandwich pattern)
73657365
if test "$ENABLED_DILITHIUM" != "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"
@@ -7377,13 +7377,13 @@ then
73777377
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NO_ML_DSA_87"
73787378
fi
73797379
if test "$ENABLED_DILITHIUM_MAKE_KEY" = "no"; then
7380-
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DILITHIUM_NO_MAKE_KEY"
7380+
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_MLDSA_NO_MAKE_KEY"
73817381
fi
73827382
if test "$ENABLED_DILITHIUM_SIGN" = "no"; then
7383-
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DILITHIUM_NO_SIGN"
7383+
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_MLDSA_NO_SIGN"
73847384
fi
73857385
if test "$ENABLED_DILITHIUM_VERIFY" = "no"; then
7386-
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DILITHIUM_NO_VERIFY"
7386+
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_MLDSA_NO_VERIFY"
73877387
fi
73887388
73897389
test "$enable_sha3" = "" && enable_sha3=yes
@@ -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_DILITHIUM"
1259412594
echo " * ECCSI $ENABLED_ECCSI"
1259512595
echo " * SAKKE $ENABLED_SAKKE"
1259612596
echo " * ASN: $ENABLED_ASN"

0 commit comments

Comments
 (0)