8345533: Switch ML-DSA implementation to FIPS 204 final

Reviewed-by: bperez, jnimeh
This commit is contained in:
Weijun Wang 2024-12-05 01:27:10 +00:00
parent 63d095169a
commit fb95a53944
3 changed files with 8 additions and 1 deletions

View file

@ -41,7 +41,7 @@ public class ML_DSA_Impls {
// set the version to an older one. The following VM option is required: // set the version to an older one. The following VM option is required:
// //
// --add-exports java.base/sun.security.provider=ALL-UNNAMED // --add-exports java.base/sun.security.provider=ALL-UNNAMED
public static Version version = Version.DRAFT; public static Version version = Version.FINAL;
static int name2int(String name) { static int name2int(String name) {
if (name.endsWith("44")) { if (name.endsWith("44")) {

View file

@ -32,6 +32,7 @@ import java.security.Security;
* @test * @test
* @bug 8342442 8345057 * @bug 8342442 8345057
* @library /test/lib * @library /test/lib
* @modules java.base/sun.security.provider
*/ */
/// This test runs on `internalProjection.json`-style files generated /// This test runs on `internalProjection.json`-style files generated

View file

@ -23,6 +23,7 @@
import jdk.test.lib.Asserts; import jdk.test.lib.Asserts;
import jdk.test.lib.json.JSONValue; import jdk.test.lib.json.JSONValue;
import jdk.test.lib.security.FixedSecureRandom; import jdk.test.lib.security.FixedSecureRandom;
import sun.security.provider.ML_DSA_Impls;
import java.security.*; import java.security.*;
import java.security.spec.EncodedKeySpec; import java.security.spec.EncodedKeySpec;
@ -34,6 +35,11 @@ import static jdk.test.lib.Utils.toByteArray;
public class ML_DSA_Test { public class ML_DSA_Test {
public static void run(JSONValue kat, Provider provider) throws Exception { public static void run(JSONValue kat, Provider provider) throws Exception {
// We only have ML-DSA test for internal functions, which
// is equivalent to the FIP 204 draft.
ML_DSA_Impls.version = ML_DSA_Impls.Version.DRAFT;
var mode = kat.get("mode").asString(); var mode = kat.get("mode").asString();
switch (mode) { switch (mode) {
case "keyGen" -> keyGenTest(kat, provider); case "keyGen" -> keyGenTest(kat, provider);