Skip to content

Commit be67bf8

Browse files
authored
Merge pull request #10436 from Frauschi/mldsa_rename
Rename Dilithium to canonical ML-DSA (FIPS 204) names
2 parents 1ccd462 + a5e79d3 commit be67bf8

35 files changed

Lines changed: 3506 additions & 2539 deletions

.wolfssl_known_macro_extras

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,6 @@ WC_ASYNC_NO_X25519
653653
WC_ASYNC_THREAD_BIND
654654
WC_BLINDING_NO_RNG_ACKNOWLEDGE_WEAKNESS
655655
WC_CACHE_RESISTANT_BASE64_TABLE
656-
WC_DILITHIUM_FIXED_ARRAY
657656
WC_DISABLE_RADIX_ZERO_PAD
658657
WC_FLAG_DONT_USE_AESNI
659658
WC_FORCE_LINUXKM_FORTIFY_SOURCE
@@ -738,12 +737,6 @@ WOLFSSL_CLANG_TIDY
738737
WOLFSSL_CLIENT_EXAMPLE
739738
WOLFSSL_CONTIKI
740739
WOLFSSL_CRL_ALLOW_MISSING_CDP
741-
WOLFSSL_DILITHIUM_ASSIGN_KEY
742-
WOLFSSL_DILITHIUM_NO_CHECK_KEY
743-
WOLFSSL_DILITHIUM_NO_MAKE
744-
WOLFSSL_DILITHIUM_REVERSE_HASH_OID
745-
WOLFSSL_DILITHIUM_SIGN_CHECK_W0
746-
WOLFSSL_DILITHIUM_SIGN_CHECK_Y
747740
WOLFSSL_DISABLE_EARLY_SANITY_CHECKS
748741
WOLFSSL_DRBG_SHA256
749742
WOLFSSL_DTLS_DISALLOW_FUTURE
@@ -832,6 +825,8 @@ WOLFSSL_NO_DECODE_EXTRA
832825
WOLFSSL_NO_DEL_HANDLE
833826
WOLFSSL_NO_DER_TO_PEM
834827
WOLFSSL_NO_DH186
828+
WOLFSSL_NO_DILITHIUM_LEGACY_GATES
829+
WOLFSSL_NO_DILITHIUM_LEGACY_NAMES
835830
WOLFSSL_NO_DTLS_SIZE_CHECK
836831
WOLFSSL_NO_ETM_ALERT
837832
WOLFSSL_NO_FENCE

CMakeLists.txt

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -673,21 +673,31 @@ if (WOLFSSL_PQC_HYBRIDS)
673673
list(APPEND WOLFSSL_DEFINITIONS "-DWOLFSSL_PQC_HYBRIDS")
674674
endif()
675675

676-
# Dilithium
676+
# ML-DSA (FIPS 204)
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

681685
if (WOLFSSL_DILITHIUM)
682-
list(APPEND WOLFSSL_DEFINITIONS "-DHAVE_DILITHIUM")
686+
message(DEPRECATION
687+
"WOLFSSL_DILITHIUM is the legacy alias for WOLFSSL_MLDSA and will be "
688+
"removed in a future release. Set -DWOLFSSL_MLDSA=yes instead.")
689+
endif()
690+
691+
if (WOLFSSL_MLDSA OR WOLFSSL_DILITHIUM)
692+
list(APPEND WOLFSSL_DEFINITIONS "-DWOLFSSL_HAVE_MLDSA")
683693
list(APPEND WOLFSSL_DEFINITIONS "-DWOLFSSL_SHA3")
684694
list(APPEND WOLFSSL_DEFINITIONS "-DWOLFSSL_SHAKE128")
685695
list(APPEND WOLFSSL_DEFINITIONS "-DWOLFSSL_SHAKE256")
686696

687-
set_wolfssl_definitions("HAVE_DILITHIUM" RESULT)
688-
set_wolfssl_definitions("WOLFSSL_SHA3" RESULT)
689-
set_wolfssl_definitions("WOLFSSL_SHAKE128" RESULT)
690-
set_wolfssl_definitions("WOLFSSL_SHAKE256" RESULT)
697+
set_wolfssl_definitions("WOLFSSL_HAVE_MLDSA" RESULT)
698+
set_wolfssl_definitions("WOLFSSL_SHA3" RESULT)
699+
set_wolfssl_definitions("WOLFSSL_SHAKE128" RESULT)
700+
set_wolfssl_definitions("WOLFSSL_SHAKE256" RESULT)
691701
endif()
692702

693703
# LMS

ChangeLog.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,19 @@
2323
NULL/length/`MISSING_KEY` checks as the `*Hash*` family.
2424
`wc_SlhDsaKey_VerifyMsg` is unchanged. All three gain doxygen coverage.
2525

26+
* Renamed the post-quantum signature implementation from its
27+
pre-standardization name *Dilithium* to its NIST-standardized name
28+
**ML-DSA** (FIPS 204), mirroring the earlier Kyber → ML-KEM rename
29+
in `wc_mlkem.{h,c}`. The legacy `<wolfssl/wolfcrypt/dilithium.h>`
30+
header, `dilithium_key` type, `wc_dilithium_*` / `wc_Dilithium_*`
31+
functions, and `HAVE_DILITHIUM` / `WOLFSSL_DILITHIUM_*` /
32+
`WC_DILITHIUM_*` build gates remain available through a temporary
33+
compatibility shim, so application code keeps compiling unchanged.
34+
See [doc/dilithium-to-mldsa-migration.md](doc/dilithium-to-mldsa-migration.md)
35+
for the full list of renamed symbols, the new `WOLFSSL_MLDSA` cmake
36+
option / `--enable-mldsa` configure switch, and the migration steps
37+
for moving consumer code to the canonical API.
38+
2639
* TLS 1.3: zero traffic key staging buffers in `SetKeysSide()` once a
2740
CryptoCB callback has imported the AES key into a Secure Element
2841
(`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

0 commit comments

Comments
 (0)