summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--crypto/src/pqc/crypto/crystals/dilithium/DilithiumEngine.cs2
-rw-r--r--crypto/src/pqc/crypto/crystals/dilithium/DilithiumParameters.cs5
-rw-r--r--crypto/src/pqc/crypto/utils/PqcUtilities.cs6
-rw-r--r--crypto/test/src/pqc/crypto/test/CrystalsDilithiumTest.cs41
4 files changed, 1 insertions, 53 deletions
diff --git a/crypto/src/pqc/crypto/crystals/dilithium/DilithiumEngine.cs b/crypto/src/pqc/crypto/crystals/dilithium/DilithiumEngine.cs
index 27f1a59cd..b03da9748 100644
--- a/crypto/src/pqc/crypto/crystals/dilithium/DilithiumEngine.cs
+++ b/crypto/src/pqc/crypto/crystals/dilithium/DilithiumEngine.cs
@@ -203,7 +203,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Crystals.Dilithium
             }
 
             byte[] KeyMu = Arrays.CopyOf(key, SeedBytes + RndBytes + CrhBytes);
-            Array.Copy(mu, 0, KeyMu, SeedBytes, RndBytes);
+            Array.Copy(rnd, 0, KeyMu, SeedBytes, RndBytes);
             Array.Copy(mu, 0, KeyMu, SeedBytes + RndBytes, CrhBytes);
             ShakeDigest256.BlockUpdate(KeyMu, 0, SeedBytes + RndBytes + CrhBytes);
             ShakeDigest256.OutputFinal(rhoPrime, 0, CrhBytes);
diff --git a/crypto/src/pqc/crypto/crystals/dilithium/DilithiumParameters.cs b/crypto/src/pqc/crypto/crystals/dilithium/DilithiumParameters.cs
index e6aa6ab21..05c52c0c9 100644
--- a/crypto/src/pqc/crypto/crystals/dilithium/DilithiumParameters.cs
+++ b/crypto/src/pqc/crypto/crystals/dilithium/DilithiumParameters.cs
@@ -7,13 +7,8 @@ namespace Org.BouncyCastle.Pqc.Crypto.Crystals.Dilithium
         : ICipherParameters
     {
         public static DilithiumParameters Dilithium2 = new DilithiumParameters(2, false);
-        public static DilithiumParameters Dilithium2Aes = new DilithiumParameters(2, true);
-        
         public static DilithiumParameters Dilithium3 = new DilithiumParameters(3, false);
-        public static DilithiumParameters Dilithium3Aes = new DilithiumParameters(3, true);
-        
         public static DilithiumParameters Dilithium5 = new DilithiumParameters(5, false);
-        public static DilithiumParameters Dilithium5Aes = new DilithiumParameters(5, true);
 
         private int k;
         private bool usingAes;
diff --git a/crypto/src/pqc/crypto/utils/PqcUtilities.cs b/crypto/src/pqc/crypto/utils/PqcUtilities.cs
index 9174dd71b..9f9f3381a 100644
--- a/crypto/src/pqc/crypto/utils/PqcUtilities.cs
+++ b/crypto/src/pqc/crypto/utils/PqcUtilities.cs
@@ -201,16 +201,10 @@ namespace Org.BouncyCastle.Pqc.Crypto.Utilities
             dilithiumOids[DilithiumParameters.Dilithium2] = BCObjectIdentifiers.dilithium2;
             dilithiumOids[DilithiumParameters.Dilithium3] = BCObjectIdentifiers.dilithium3;
             dilithiumOids[DilithiumParameters.Dilithium5] = BCObjectIdentifiers.dilithium5;
-            dilithiumOids[DilithiumParameters.Dilithium2Aes] = BCObjectIdentifiers.dilithium2_aes;
-            dilithiumOids[DilithiumParameters.Dilithium3Aes] = BCObjectIdentifiers.dilithium3_aes;
-            dilithiumOids[DilithiumParameters.Dilithium5Aes] = BCObjectIdentifiers.dilithium5_aes;
             
             dilithiumParams[BCObjectIdentifiers.dilithium2] = DilithiumParameters.Dilithium2;
             dilithiumParams[BCObjectIdentifiers.dilithium3] = DilithiumParameters.Dilithium3;
             dilithiumParams[BCObjectIdentifiers.dilithium5] = DilithiumParameters.Dilithium5;
-            dilithiumParams[BCObjectIdentifiers.dilithium2_aes] = DilithiumParameters.Dilithium2Aes;
-            dilithiumParams[BCObjectIdentifiers.dilithium3_aes] = DilithiumParameters.Dilithium3Aes;
-            dilithiumParams[BCObjectIdentifiers.dilithium5_aes] = DilithiumParameters.Dilithium5Aes;
 
             bikeParams[BCObjectIdentifiers.bike128] = BikeParameters.bike128;
             bikeParams[BCObjectIdentifiers.bike192] = BikeParameters.bike192;
diff --git a/crypto/test/src/pqc/crypto/test/CrystalsDilithiumTest.cs b/crypto/test/src/pqc/crypto/test/CrystalsDilithiumTest.cs
index bb6da3ffb..85133cb22 100644
--- a/crypto/test/src/pqc/crypto/test/CrystalsDilithiumTest.cs
+++ b/crypto/test/src/pqc/crypto/test/CrystalsDilithiumTest.cs
@@ -21,9 +21,6 @@ namespace Org.BouncyCastle.Pqc.Crypto.Tests
             { "PQCsignKAT_Dilithium2.rsp", DilithiumParameters.Dilithium2 },
             { "PQCsignKAT_Dilithium3.rsp", DilithiumParameters.Dilithium3 },
             { "PQCsignKAT_Dilithium5.rsp", DilithiumParameters.Dilithium5 },
-            { "PQCsignKAT_Dilithium2-AES.rsp", DilithiumParameters.Dilithium2Aes },
-            { "PQCsignKAT_Dilithium3-AES.rsp", DilithiumParameters.Dilithium3Aes },
-            { "PQCsignKAT_Dilithium5-AES.rsp", DilithiumParameters.Dilithium5Aes },
         };
 
         private static readonly string[] TestVectorFiles =
@@ -33,12 +30,6 @@ namespace Org.BouncyCastle.Pqc.Crypto.Tests
             "PQCsignKAT_Dilithium5.rsp",
         };
 
-        private static readonly string[] TestVectorFilesAes =
-        {
-            "PQCsignKAT_Dilithium2-AES.rsp",
-            "PQCsignKAT_Dilithium3-AES.rsp",
-            "PQCsignKAT_Dilithium5-AES.rsp",
-        };
 
         [TestCaseSource(nameof(TestVectorFiles))]
         [Parallelizable(ParallelScope.All)]
@@ -47,13 +38,6 @@ namespace Org.BouncyCastle.Pqc.Crypto.Tests
             RunTestVectorFile(testVectorFile);
         }
 
-        [TestCaseSource(nameof(TestVectorFilesAes))]
-        [Parallelizable(ParallelScope.All)]
-        public void TVAes(string testVectorFile)
-        {
-            RunTestVectorFile(testVectorFile);
-        }
-
         [Test]
         public void TestKeyEncodingDilithium2()
         {
@@ -81,31 +65,6 @@ namespace Org.BouncyCastle.Pqc.Crypto.Tests
             Assert.AreEqual(((DilithiumPrivateKeyParameters)priv).GetEncoded(), ((DilithiumPrivateKeyParameters)privDec).GetEncoded());
         }
 
-        [Test]
-        public void TestK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+KgtMLO281zeO8+wqulbbrTqYfkdHXhjL0tU+kcp+zM5jHn3bgx77FFj4gXg+LIgj6sYMuUNgcOZcZQEuyUPLbsZEiEkbOsCQr/JqKxeAjNmeCKUOlVpxZuHfj8mCMT5h2fXeByDj1Ie5szCdjhuqLjnSvWu1uXAQrdtyjCTMolNWKhBsUa+L8s5agh37qhk7ZHu5B1IrzDLUxyZ89aXda+6Rp/AC/F3EDZKEreruBqzVzIgOEo92RbyGXju2I2ekSr/AqUT2JBO6rdE6OWSt/ibdXFRkRv/f7XASwqwVsFkBgnNBmioZLSOdIYw12ZcvotlFtNKfi2BMe6lj2ZY2DqA/rnnekaIPh2dBIrevzWQgLStqrn/2g59F2saBH6bg=");
-           
-            AsymmetricKeyParameter altPubDec = PqcPublicKeyFactory.CreateKey(SubjectPublicKeyInfo.GetInstance(altSubPubEnc));
-            Assert.AreEqual(altEncKey, ((DilithiumPublicKeyParameters)altPubDec).GetEncoded());
-
-            Security.SecureRandom random = new Security.SecureRandom();
-            DilithiumKeyGenerationParameters kparam = new DilithiumKeyGenerationParameters(random, DilithiumParameters.Dilithium2Aes);
-            DilithiumKeyPairGenerator kpg = new DilithiumKeyPairGenerator();
-            kpg.Init(kparam);
-            AsymmetricCipherKeyPair ackp = kpg.GenerateKeyPair();
-
-            AsymmetricKeyParameter pub = ackp.Public;
-            AsymmetricKeyParameter priv = ackp.Private;
-
-            AsymmetricKeyParameter pubDec = PqcPublicKeyFactory.CreateKey(PqcSubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(pub));
-            AsymmetricKeyParameter privDec = PqcPrivateKeyFactory.CreateKey(PqcPrivateKeyInfoFactory.CreatePrivateKeyInfo(priv));
-
-            Assert.AreEqual(((DilithiumPublicKeyParameters)pub).GetEncoded(), ((DilithiumPublicKeyParameters)pubDec).GetEncoded());
-            Assert.AreEqual(((DilithiumPrivateKeyParameters)priv).GetEncoded(), ((DilithiumPrivateKeyParameters)privDec).GetEncoded());
-        }
-
         private static void RunTestVector(string name, IDictionary<string, string> buf)
         {
             string count = buf["count"];