summary refs log tree commit diff
path: root/crypto/test/src
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-10-13 16:55:08 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-10-13 16:55:08 +0700
commit067b6742fd263010272799bf1deba46a242adb42 (patch)
tree3229e6eecb2c159c7655418f1306b860de284c94 /crypto/test/src
parentRemove unnecessary copies (diff)
downloadBouncyCastle.NET-ed25519-067b6742fd263010272799bf1deba46a242adb42.tar.xz
Refactoring in Pqc.Crypto.Tests
Diffstat (limited to 'crypto/test/src')
-rw-r--r--crypto/test/src/pqc/crypto/test/BikeVectorTest.cs181
-rw-r--r--crypto/test/src/pqc/crypto/test/CmceVectorTest.cs210
-rw-r--r--crypto/test/src/pqc/crypto/test/CrystalsDilithiumTest.cs4
-rw-r--r--crypto/test/src/pqc/crypto/test/CrystalsKyberTest.cs2
-rw-r--r--crypto/test/src/pqc/crypto/test/FalconTest.cs2
-rw-r--r--crypto/test/src/pqc/crypto/test/FrodoVectorTest.cs4
-rw-r--r--crypto/test/src/pqc/crypto/test/NtruVectorTest.cs3
-rw-r--r--crypto/test/src/pqc/crypto/test/PicnicVectorTest.cs2
-rw-r--r--crypto/test/src/pqc/crypto/test/SaberVectorTest.cs2
-rw-r--r--crypto/test/src/pqc/crypto/test/SikeVectorTest.cs2
10 files changed, 196 insertions, 216 deletions
diff --git a/crypto/test/src/pqc/crypto/test/BikeVectorTest.cs b/crypto/test/src/pqc/crypto/test/BikeVectorTest.cs
index 89cc674e7..e4e6e5adc 100644
--- a/crypto/test/src/pqc/crypto/test/BikeVectorTest.cs
+++ b/crypto/test/src/pqc/crypto/test/BikeVectorTest.cs
@@ -1,19 +1,35 @@
-using System;
 using System.Collections.Generic;
 using System.IO;
+
+using NUnit.Framework;
+
 using Org.BouncyCastle.Crypto;
+using Org.BouncyCastle.Pqc.Crypto.Bike;
+using Org.BouncyCastle.Pqc.Crypto.Utilities;
 using Org.BouncyCastle.Utilities;
 using Org.BouncyCastle.Utilities.Encoders;
 using Org.BouncyCastle.Utilities.Test;
-using NUnit.Framework;
-using Org.BouncyCastle.Pqc.Crypto.Utilities;
-using Org.BouncyCastle.Pqc.Crypto.Bike;
 
 namespace Org.BouncyCastle.Pqc.Crypto.Tests
 {
     [TestFixture]
     public class BikeVectorTest
     {
+        private static readonly Dictionary<string, BikeParameters> Parameters = new Dictionary<string, BikeParameters>()
+        {
+            { "PQCkemKAT_BIKE_3114.rsp", BikeParameters.bike128 },
+            { "PQCkemKAT_BIKE_6198.rsp", BikeParameters.bike192 },
+            { "PQCkemKAT_BIKE_10276.rsp", BikeParameters.bike256 },
+        };
+
+        private static readonly string[] TestVectorFiles =
+        {
+            "PQCkemKAT_BIKE_3114.rsp",
+            "PQCkemKAT_BIKE_6198.rsp",
+            // FIXME
+            //"PQCkemKAT_BIKE_10276.rsp"
+        };
+
         [Test]
         public void TestParameters()
         {
@@ -21,115 +37,94 @@ namespace Org.BouncyCastle.Pqc.Crypto.Tests
             Assert.AreEqual(192, BikeParameters.bike192.DefaultKeySize);
             Assert.AreEqual(256, BikeParameters.bike256.DefaultKeySize);
         }
-        
-        [Test]
-        public void TestVectors()
+
+        [TestCaseSource(nameof(TestVectorFiles))]
+        [Parallelizable(ParallelScope.All)]
+        public void TestVectors(string testVectorFile)
         {
-            bool full = false;
-            
-            string[] files;
-            if (full)
-            {
-                files = new []{
-                    "PQCkemKAT_BIKE_3114.rsp",
-                    "PQCkemKAT_BIKE_6198.rsp",
-                    "PQCkemKAT_BIKE_10276.rsp"
-                };
-            }
-            else
-            {
-                files = new []{
-                    "PQCkemKAT_BIKE_3114.rsp"
-                };
-            }
+            RunTestVectorFile(testVectorFile);
+        }
 
-            BikeParameters[] parameters = {
-                    BikeParameters.bike128,
-                    BikeParameters.bike192,
-                    BikeParameters.bike256
-            };
+        private static void RunTestVector(string name, IDictionary<string, string> buf)
+        {
+            string count = buf["count"];
+            byte[] seed = Hex.Decode(buf["seed"]); // seed for SecureRandom
+            byte[] pk = Hex.Decode(buf["pk"]);     // public key
+            byte[] sk = Hex.Decode(buf["sk"]);     // private key
+            byte[] ct = Hex.Decode(buf["ct"]);     // ciphertext
+            byte[] ss = Hex.Decode(buf["ss"]);     // session key
+
+            NistSecureRandom random = new NistSecureRandom(seed, null);
+            BikeParameters bikeParameters = Parameters[name];
+
+            BikeKeyPairGenerator kpGen = new BikeKeyPairGenerator();
+            BikeKeyGenerationParameters genParam = new BikeKeyGenerationParameters(random, bikeParameters);
+            //
+            // Generate keys and test.
+            //
+            kpGen.Init(genParam);
+            AsymmetricCipherKeyPair kp = kpGen.GenerateKeyPair();
+
+            BikePublicKeyParameters pubParams = (BikePublicKeyParameters)PublicKeyFactory.CreateKey(SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo((BikePublicKeyParameters) kp.Public));
+            BikePrivateKeyParameters privParams = (BikePrivateKeyParameters)PrivateKeyFactory.CreateKey(PrivateKeyInfoFactory.CreatePrivateKeyInfo((BikePrivateKeyParameters) kp.Private));
+
+            Assert.True(Arrays.AreEqual(pk, pubParams.PublicKey), name + " " + count + ": public key");
+            Assert.True(Arrays.AreEqual(sk, privParams.PrivateKey), name + " " + count + ": secret key");
+
+            // KEM Enc
+            BikeKemGenerator BikeEncCipher = new BikeKemGenerator(random);
+            ISecretWithEncapsulation secWenc = BikeEncCipher.GenerateEncapsulated(pubParams);
+            byte[] generated_cipher_text = secWenc.GetEncapsulation();
+            Assert.True(Arrays.AreEqual(ct, generated_cipher_text), name + " " + count + ": kem_enc cipher text");
+
+            byte[] secret = secWenc.GetSecret();
+            Assert.True(Arrays.AreEqual(ss, 0, secret.Length, secret, 0, secret.Length), name + " " + count + ": kem_enc key");
+
+            // KEM Dec
+            BikeKemExtractor BikeDecCipher = new BikeKemExtractor(privParams);
+
+            byte[] dec_key = BikeDecCipher.ExtractSecret(generated_cipher_text);
+
+            Assert.True(bikeParameters.DefaultKeySize == dec_key.Length * 8);
+            Assert.True(Arrays.AreEqual(dec_key, 0, dec_key.Length, ss, 0, dec_key.Length), name + " " + count + ": kem_dec ss");
+            Assert.True(Arrays.AreEqual(dec_key, secret), name + " " + count + ": kem_dec key");
+        }
 
+        private static void RunTestVectorFile(string name)
+        {
+            var buf = new Dictionary<string, string>();
             TestSampler sampler = new TestSampler();
-            for (int fileIndex = 0; fileIndex != files.Length; fileIndex++)
+            using (var src = new StreamReader(SimpleTest.GetTestDataAsStream("pqc.bike." + name)))
             {
-                string name = files[fileIndex];
-                Console.Write($"testing: {name}");
-                StreamReader src = new StreamReader(SimpleTest.GetTestDataAsStream("pqc.bike." + name));
-
-                string line = null;
-                Dictionary<string, string> buf = new Dictionary<string, string>();
+                string line;
                 while ((line = src.ReadLine()) != null)
                 {
                     line = line.Trim();
-
                     if (line.StartsWith("#"))
-                    {
                         continue;
-                    }
-                    if (line.Length == 0)
+
+                    if (line.Length > 0)
                     {
-                        if (buf.Count > 0 && !sampler.SkipTest(buf["count"]))
+                        int a = line.IndexOf('=');
+                        if (a > -1)
                         {
-                            string count = buf["count"];
-
-                            Console.Write($"test case: {count}\n");
-                            byte[] seed = Hex.Decode(buf["seed"]); // seed for Cmce secure random
-                            byte[] pk = Hex.Decode(buf["pk"]);     // public key
-                            byte[] sk = Hex.Decode(buf["sk"]);     // private key
-                            byte[] ct = Hex.Decode(buf["ct"]);     // ciphertext
-                            byte[] ss = Hex.Decode(buf["ss"]);     // session key
-
-                            NistSecureRandom random = new NistSecureRandom(seed, null);
-                            BikeParameters bikeParameters = parameters[fileIndex];
-
-                            BikeKeyPairGenerator kpGen = new BikeKeyPairGenerator();
-                            BikeKeyGenerationParameters genParam = new BikeKeyGenerationParameters(random, bikeParameters);
-                            //
-                            // Generate keys and test.
-                            //
-                            kpGen.Init(genParam);
-                            AsymmetricCipherKeyPair kp = kpGen.GenerateKeyPair();
-
-                            BikePublicKeyParameters pubParams = (BikePublicKeyParameters)PublicKeyFactory.CreateKey(SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo((BikePublicKeyParameters) kp.Public));
-                            BikePrivateKeyParameters privParams = (BikePrivateKeyParameters)PrivateKeyFactory.CreateKey(PrivateKeyInfoFactory.CreatePrivateKeyInfo((BikePrivateKeyParameters) kp.Private));
-
-                            Assert.True(Arrays.AreEqual(pk, pubParams.PublicKey), name + " " + count + ": public key");
-                            Assert.True(Arrays.AreEqual(sk, privParams.PrivateKey), name + " " + count + ": secret key");
-
-                            // KEM Enc
-                            BikeKemGenerator BikeEncCipher = new BikeKemGenerator(random);
-                            ISecretWithEncapsulation secWenc = BikeEncCipher.GenerateEncapsulated(pubParams);
-                            byte[] generated_cipher_text = secWenc.GetEncapsulation();
-                            Assert.True(Arrays.AreEqual(ct, generated_cipher_text), name + " " + count + ": kem_enc cipher text");
-
-                            byte[] secret = secWenc.GetSecret();
-                            Assert.True(Arrays.AreEqual(ss, 0, secret.Length, secret, 0, secret.Length), name + " " + count + ": kem_enc key");
-
-                            // KEM Dec
-                            BikeKemExtractor BikeDecCipher = new BikeKemExtractor(privParams);
-
-                            byte[] dec_key = BikeDecCipher.ExtractSecret(generated_cipher_text);
-
-                            Assert.True(bikeParameters.DefaultKeySize == dec_key.Length * 8);
-                            Assert.True(Arrays.AreEqual(dec_key, 0, dec_key.Length, ss, 0, dec_key.Length), name + " " + count + ": kem_dec ss");
-                            Assert.True(Arrays.AreEqual(dec_key, secret), name + " " + count + ": kem_dec key");
+                            buf[line.Substring(0, a).Trim()] = line.Substring(a + 1).Trim();
                         }
-                        buf.Clear();
-
                         continue;
                     }
 
-                    int a = line.IndexOf('=');
-                    if (a > -1)
+                    if (buf.Count > 0 && !sampler.SkipTest(buf["count"]))
                     {
-                        buf[line.Substring(0, a).Trim()] = line.Substring(a + 1).Trim();
+                        RunTestVector(name, buf);
+                        buf.Clear();
                     }
+                }
 
-
+                if (buf.Count > 0 && !sampler.SkipTest(buf["count"]))
+                {
+                    RunTestVector(name, buf);
                 }
-                Console.Write("testing successful!");
             }
-
         }
     }
-}
\ No newline at end of file
+}
diff --git a/crypto/test/src/pqc/crypto/test/CmceVectorTest.cs b/crypto/test/src/pqc/crypto/test/CmceVectorTest.cs
index 4bf7605e9..16b141478 100644
--- a/crypto/test/src/pqc/crypto/test/CmceVectorTest.cs
+++ b/crypto/test/src/pqc/crypto/test/CmceVectorTest.cs
@@ -20,6 +20,34 @@ namespace Org.BouncyCastle.Pqc.Crypto.Tests
     [TestFixture]
     public class CmceVectorTest
     {
+        private static readonly Dictionary<string, CmceParameters> Parameters = new Dictionary<string, CmceParameters>()
+        {
+            { "3488-64-cmce.txt", CmceParameters.mceliece348864r3 },
+            { "3488-64-f-cmce.txt", CmceParameters.mceliece348864fr3 },
+            { "4608-96-cmce.txt", CmceParameters.mceliece460896r3 },
+            { "4608-96-f-cmce.txt", CmceParameters.mceliece460896fr3 },
+            { "6688-128-cmce.txt", CmceParameters.mceliece6688128r3 },
+            { "6688-128-f-cmce.txt", CmceParameters.mceliece6688128fr3 },
+            { "6960-119-cmce.txt", CmceParameters.mceliece6960119r3 },
+            { "6960-119-f-cmce.txt", CmceParameters.mceliece6960119fr3 },
+            { "8192-128-cmce.txt", CmceParameters.mceliece8192128r3 },
+            { "8192-128-f-cmce.txt", CmceParameters.mceliece8192128fr3 },
+        };
+
+        private static readonly string[] TestVectorFiles =
+        {
+            "3488-64-cmce.txt",
+            "3488-64-f-cmce.txt",
+            "4608-96-cmce.txt",
+            "4608-96-f-cmce.txt",
+            "6688-128-cmce.txt",
+            "6688-128-f-cmce.txt",
+            "6960-119-cmce.txt",
+            "6960-119-f-cmce.txt",
+            "8192-128-cmce.txt",
+            "8192-128-f-cmce.txt"
+        };
+
         [Test]
         public void TestParameters()
         {
@@ -34,141 +62,93 @@ namespace Org.BouncyCastle.Pqc.Crypto.Tests
             Assert.AreEqual(256, CmceParameters.mceliece8192128r3.DefaultKeySize);
             Assert.AreEqual(256, CmceParameters.mceliece8192128fr3.DefaultKeySize);
         }
-        
-        [Test]
-        public void TestVectors()
-        {
 
-            //todo change to project property
-            // bool full = System.GetProperty("test.full", "false").equals("true");
-            bool full = false;
-            
-            string[] files;
-            if (full)
-            {
-                files = new []{
-                    "3488-64-cmce.txt",
-                    "3488-64-f-cmce.txt",
-                    "4608-96-cmce.txt",
-                    "4608-96-f-cmce.txt",
-                    "6688-128-cmce.txt",
-                    "6688-128-f-cmce.txt",
-                    "6960-119-cmce.txt",
-                    "6960-119-f-cmce.txt",
-                    "8192-128-cmce.txt",
-                    "8192-128-f-cmce.txt"
-                };
-            }
-            else
-            {
-                files = new []{
-                    "3488-64-cmce.txt",
-                    "3488-64-f-cmce.txt",
-                };
-            }
+        [TestCaseSource(nameof(TestVectorFiles))]
+        [Parallelizable(ParallelScope.All)]
+        public void TestVectors(string testVectorFile)
+        {
+            RunTestVectorFile(testVectorFile);
+        }
 
-            CmceParameters[] parameters = {
-                CmceParameters.mceliece348864r3,
-                CmceParameters.mceliece348864fr3,
-                CmceParameters.mceliece460896r3,
-                CmceParameters.mceliece460896fr3,
-                CmceParameters.mceliece6688128r3,
-                CmceParameters.mceliece6688128fr3,
-                CmceParameters.mceliece6960119r3,
-                CmceParameters.mceliece6960119fr3,
-                CmceParameters.mceliece8192128r3,
-                CmceParameters.mceliece8192128fr3
-            };
+        private static void RunTestVector(string name, IDictionary<string, string> buf)
+        {
+            string count = buf["count"];
+            byte[] seed = Hex.Decode(buf["seed"]); // seed for SecureRandom
+            byte[] pk = Hex.Decode(buf["pk"]);     // public key
+            byte[] sk = Hex.Decode(buf["sk"]);     // private key
+            byte[] ct = Hex.Decode(buf["ct"]);     // ciphertext
+            byte[] ss = Hex.Decode(buf["ss"]);     // session key
+
+            NistSecureRandom random = new NistSecureRandom(seed, null);
+            CmceParameters Cmceparameters = Parameters[name];
+
+            CmceKeyPairGenerator kpGen = new CmceKeyPairGenerator();
+            CmceKeyGenerationParameters genParam = new CmceKeyGenerationParameters(random, Cmceparameters);
+            //
+            // Generate keys and test.
+            //
+            kpGen.Init(genParam);
+            AsymmetricCipherKeyPair kp = kpGen.GenerateKeyPair();
+
+            CmcePublicKeyParameters pubParams = (CmcePublicKeyParameters)PublicKeyFactory.CreateKey(SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo((CmcePublicKeyParameters)kp.Public));
+            CmcePrivateKeyParameters privParams = (CmcePrivateKeyParameters)PrivateKeyFactory.CreateKey(PrivateKeyInfoFactory.CreatePrivateKeyInfo((CmcePrivateKeyParameters)kp.Private));
+
+            Assert.True(Arrays.AreEqual(pk, pubParams.PublicKey), name + " " + count + ": public key");
+            Assert.True(Arrays.AreEqual(sk, privParams.PrivateKey), name + " " + count + ": secret key");
+
+            // KEM Enc
+            CmceKemGenerator CmceEncCipher = new CmceKemGenerator(random);
+            ISecretWithEncapsulation secWenc = CmceEncCipher.GenerateEncapsulated(pubParams);
+            byte[] generated_cipher_text = secWenc.GetEncapsulation();
+            Assert.True(Arrays.AreEqual(ct, generated_cipher_text), name + " " + count + ": kem_enc cipher text");
+            byte[] secret = secWenc.GetSecret();
+            Assert.True(Arrays.AreEqual(ss, 0, secret.Length, secret, 0, secret.Length), name + " " + count + ": kem_enc key");
+
+            // KEM Dec
+            CmceKemExtractor CmceDecCipher = new CmceKemExtractor(privParams);
+
+            byte[] dec_key = CmceDecCipher.ExtractSecret(generated_cipher_text);
+
+            Assert.True(Cmceparameters.DefaultKeySize == dec_key.Length * 8);
+            Assert.True(Arrays.AreEqual(dec_key, 0, dec_key.Length, ss, 0, dec_key.Length), name + " " + count + ": kem_dec ss");
+            Assert.True(Arrays.AreEqual(dec_key, secret), name + " " + count + ": kem_dec key");
+        }
 
+        private static void RunTestVectorFile(string name)
+        {
+            var buf = new Dictionary<string, string>();
             TestSampler sampler = new TestSampler();
-            for (int fileIndex = 0; fileIndex != files.Length; fileIndex++)
+            using (var src = new StreamReader(SimpleTest.GetTestDataAsStream("pqc.cmce." + name)))
             {
-                string name = files[fileIndex];
-                Console.Write($"testing: {name}");
-                StreamReader src = new StreamReader(SimpleTest.GetTestDataAsStream("pqc.cmce." + name));
-                // BufferedReader bin = new BufferedReader(new InputStreamReader(src));
-
-                string line = null;
-                Dictionary<string, string> buf = new Dictionary<string, string>();
-                // Random rnd = new Random(System.currentTimeMillis());
+                string line;
                 while ((line = src.ReadLine()) != null)
                 {
                     line = line.Trim();
-
                     if (line.StartsWith("#"))
-                    {
                         continue;
-                    }
-                    if (line.Length == 0)
+
+                    if (line.Length > 0)
                     {
-                        if (buf.Count > 0 && !sampler.SkipTest(buf["count"]))
+                        int a = line.IndexOf('=');
+                        if (a > -1)
                         {
-                            string count = buf["count"];
-                            if (!"0".Equals(count))
-                            {
-                                // randomly skip tests after zero.
-                                // if (rnd.nextBoolean())
-                                // {
-                                //     continue;
-                                // }
-                            }
-                            Console.Write($"test case: {count}\n");
-                            byte[] seed = Hex.Decode(buf["seed"]); // seed for Cmce secure random
-                            byte[] pk = Hex.Decode(buf["pk"]);     // public key
-                            byte[] sk = Hex.Decode(buf["sk"]);     // private key
-                            byte[] ct = Hex.Decode(buf["ct"]);     // ciphertext
-                            byte[] ss = Hex.Decode(buf["ss"]);     // session key
-
-                            NistSecureRandom random = new NistSecureRandom(seed, null);
-                            CmceParameters Cmceparameters = parameters[fileIndex];
-
-                            CmceKeyPairGenerator kpGen = new CmceKeyPairGenerator();
-                            CmceKeyGenerationParameters genParam = new CmceKeyGenerationParameters(random, Cmceparameters);
-                            //
-                            // Generate keys and test.
-                            //
-                            kpGen.Init(genParam);
-                            AsymmetricCipherKeyPair kp = kpGen.GenerateKeyPair();
-
-                            CmcePublicKeyParameters pubParams = (CmcePublicKeyParameters)PublicKeyFactory.CreateKey(SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo((CmcePublicKeyParameters)kp.Public));
-                            CmcePrivateKeyParameters privParams = (CmcePrivateKeyParameters)PrivateKeyFactory.CreateKey(PrivateKeyInfoFactory.CreatePrivateKeyInfo((CmcePrivateKeyParameters)kp.Private));
-
-                            Assert.True(Arrays.AreEqual(pk, pubParams.PublicKey), name + " " + count + ": public key");
-                            Assert.True(Arrays.AreEqual(sk, privParams.PrivateKey), name + " " + count + ": secret key");
-
-                            // KEM Enc
-                            CmceKemGenerator CmceEncCipher = new CmceKemGenerator(random);
-                            ISecretWithEncapsulation secWenc = CmceEncCipher.GenerateEncapsulated(pubParams);
-                            byte[] generated_cipher_text = secWenc.GetEncapsulation();
-                            Assert.True(Arrays.AreEqual(ct, generated_cipher_text), name + " " + count + ": kem_enc cipher text");
-                            byte[] secret = secWenc.GetSecret();
-                            Assert.True(Arrays.AreEqual(ss, 0, secret.Length, secret, 0, secret.Length), name + " " + count + ": kem_enc key");
-
-                            // KEM Dec
-                            CmceKemExtractor CmceDecCipher = new CmceKemExtractor(privParams);
-
-                            byte[] dec_key = CmceDecCipher.ExtractSecret(generated_cipher_text);
-
-                            Assert.True(Cmceparameters.DefaultKeySize == dec_key.Length * 8);
-                            Assert.True(Arrays.AreEqual(dec_key, 0, dec_key.Length, ss, 0, dec_key.Length), name + " " + count + ": kem_dec ss");
-                            Assert.True(Arrays.AreEqual(dec_key, secret), name + " " + count + ": kem_dec key");
+                            buf[line.Substring(0, a).Trim()] = line.Substring(a + 1).Trim();
                         }
-                        buf.Clear();
-
                         continue;
                     }
 
-                    int a = line.IndexOf('=');
-                    if (a > -1)
+                    if (buf.Count > 0 && !sampler.SkipTest(buf["count"]))
                     {
-                        buf[line.Substring(0, a).Trim()] = line.Substring(a + 1).Trim();
+                        RunTestVector(name, buf);
+                        buf.Clear();
                     }
+                }
 
-
+                if (buf.Count > 0 && !sampler.SkipTest(buf["count"]))
+                {
+                    RunTestVector(name, buf);
                 }
-                Console.Write("testing successful!");
             }
-
         }
     }
-}
\ No newline at end of file
+}
diff --git a/crypto/test/src/pqc/crypto/test/CrystalsDilithiumTest.cs b/crypto/test/src/pqc/crypto/test/CrystalsDilithiumTest.cs
index e9e8915ec..9d4d7fc9f 100644
--- a/crypto/test/src/pqc/crypto/test/CrystalsDilithiumTest.cs
+++ b/crypto/test/src/pqc/crypto/test/CrystalsDilithiumTest.cs
@@ -1,6 +1,8 @@
 using System.Collections.Generic;
 using System.IO;
+
 using NUnit.Framework;
+
 using Org.BouncyCastle.Crypto;
 using Org.BouncyCastle.Pqc.Crypto.Crystals.Dilithium;
 using Org.BouncyCastle.Utilities;
@@ -42,7 +44,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Tests
         private static void TestVectors(string name, IDictionary<string, string> buf)
         {
             string count = buf["count"];
-            byte[] seed = Hex.Decode(buf["seed"]);      // seed for Dilithium secure random
+            byte[] seed = Hex.Decode(buf["seed"]);      // seed for SecureRandom
             int mlen = int.Parse(buf["mlen"]);          // message length
             byte[] msg = Hex.Decode(buf["msg"]);        // message
             byte[] pk = Hex.Decode(buf["pk"]);          // public key
diff --git a/crypto/test/src/pqc/crypto/test/CrystalsKyberTest.cs b/crypto/test/src/pqc/crypto/test/CrystalsKyberTest.cs
index 0e363d124..ea1423192 100644
--- a/crypto/test/src/pqc/crypto/test/CrystalsKyberTest.cs
+++ b/crypto/test/src/pqc/crypto/test/CrystalsKyberTest.cs
@@ -44,7 +44,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Tests
         {
             string count = buf["count"];
 
-            byte[] seed = Hex.Decode(buf["seed"]); // seed for Kyber secure random
+            byte[] seed = Hex.Decode(buf["seed"]); // seed for SecureRandom
             byte[] pk = Hex.Decode(buf["pk"]); // public key
             byte[] sk = Hex.Decode(buf["sk"]); // private key
             byte[] ct = Hex.Decode(buf["ct"]); // ciphertext
diff --git a/crypto/test/src/pqc/crypto/test/FalconTest.cs b/crypto/test/src/pqc/crypto/test/FalconTest.cs
index 4ede0803d..2586e5cb5 100644
--- a/crypto/test/src/pqc/crypto/test/FalconTest.cs
+++ b/crypto/test/src/pqc/crypto/test/FalconTest.cs
@@ -46,7 +46,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Tests
                         {
                             string count = buf["count"];
                             Console.Write("test case: " + count);
-                            byte[] seed = Hex.Decode(buf["seed"]); // seed for nist secure random
+                            byte[] seed = Hex.Decode(buf["seed"]); // seed for SecureRandom
                             byte[] pk = Hex.Decode(buf["pk"]);     // public key
                             byte[] sk = Hex.Decode(buf["sk"]);     // private key
                             byte[] sm = Hex.Decode(buf["sm"]);     // sm
diff --git a/crypto/test/src/pqc/crypto/test/FrodoVectorTest.cs b/crypto/test/src/pqc/crypto/test/FrodoVectorTest.cs
index ea3897b65..db72fb225 100644
--- a/crypto/test/src/pqc/crypto/test/FrodoVectorTest.cs
+++ b/crypto/test/src/pqc/crypto/test/FrodoVectorTest.cs
@@ -67,7 +67,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Tests
         private static void RunTestVector(string name, IDictionary<string, string> buf)
         {
             string count = buf["count"];
-            byte[] seed = Hex.Decode(buf["seed"]); // seed for nist secure random
+            byte[] seed = Hex.Decode(buf["seed"]); // seed for SecureRandom
             byte[] pk = Hex.Decode(buf["pk"]);     // public key
             byte[] sk = Hex.Decode(buf["sk"]);     // private key
             byte[] ct = Hex.Decode(buf["ct"]);     // ciphertext
@@ -114,7 +114,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Tests
             TestSampler sampler = new TestSampler();
             using (var src = new StreamReader(SimpleTest.GetTestDataAsStream("pqc.frodo." + name)))
             {
-                string line = null;
+                string line;
                 while ((line = src.ReadLine()) != null)
                 {
                     line = line.Trim();
diff --git a/crypto/test/src/pqc/crypto/test/NtruVectorTest.cs b/crypto/test/src/pqc/crypto/test/NtruVectorTest.cs
index 13f6ab800..f04db4855 100644
--- a/crypto/test/src/pqc/crypto/test/NtruVectorTest.cs
+++ b/crypto/test/src/pqc/crypto/test/NtruVectorTest.cs
@@ -1,12 +1,15 @@
 using System;
 using System.Collections.Generic;
 using System.IO;
+
 using NUnit.Framework;
+
 using Org.BouncyCastle.Crypto;
 using Org.BouncyCastle.Pqc.Crypto.Ntru;
 using Org.BouncyCastle.Utilities;
 using Org.BouncyCastle.Utilities.Encoders;
 using Org.BouncyCastle.Utilities.Test;
+
 using NtruKeyPairGenerator = Org.BouncyCastle.Pqc.Crypto.Ntru.NtruKeyPairGenerator;
 
 namespace Org.BouncyCastle.Pqc.Crypto.Tests
diff --git a/crypto/test/src/pqc/crypto/test/PicnicVectorTest.cs b/crypto/test/src/pqc/crypto/test/PicnicVectorTest.cs
index 8a4972048..c23996e55 100644
--- a/crypto/test/src/pqc/crypto/test/PicnicVectorTest.cs
+++ b/crypto/test/src/pqc/crypto/test/PicnicVectorTest.cs
@@ -69,7 +69,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Tests
         private static void RunTestVector(string name, IDictionary<string, string> buf)
         {
             string count = buf["count"];
-            byte[] seed = Hex.Decode(buf["seed"]);      // seed for picnic secure random
+            byte[] seed = Hex.Decode(buf["seed"]);      // seed for SecureRandom
             int mlen = int.Parse(buf["mlen"]);          // message length
             byte[] msg = Hex.Decode(buf["msg"]);        // message
             byte[] pk = Hex.Decode(buf["pk"]);          // public key
diff --git a/crypto/test/src/pqc/crypto/test/SaberVectorTest.cs b/crypto/test/src/pqc/crypto/test/SaberVectorTest.cs
index efe09dba3..f9d659c1e 100644
--- a/crypto/test/src/pqc/crypto/test/SaberVectorTest.cs
+++ b/crypto/test/src/pqc/crypto/test/SaberVectorTest.cs
@@ -83,7 +83,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Tests
                         {
                             String count = buf["count"];
 
-                            byte[] seed = Hex.Decode(buf["seed"]); // seed for SABER secure random
+                            byte[] seed = Hex.Decode(buf["seed"]); // seed for SecureRandom
                             byte[] pk = Hex.Decode(buf["pk"]); // public key
                             byte[] sk = Hex.Decode(buf["sk"]); // private key
                             byte[] ct = Hex.Decode(buf["ct"]); // ciphertext
diff --git a/crypto/test/src/pqc/crypto/test/SikeVectorTest.cs b/crypto/test/src/pqc/crypto/test/SikeVectorTest.cs
index cc20b2269..8b8c6bc50 100644
--- a/crypto/test/src/pqc/crypto/test/SikeVectorTest.cs
+++ b/crypto/test/src/pqc/crypto/test/SikeVectorTest.cs
@@ -62,7 +62,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Tests
         private static void RunTestVector(string name, IDictionary<string, string> buf)
         {
             string count = buf["count"];
-            byte[] seed = Hex.Decode(buf["seed"]);      // seed for SIKE secure random
+            byte[] seed = Hex.Decode(buf["seed"]);      // seed for SecureRandom
             byte[] pk = Hex.Decode(buf["pk"]);          // public key
             byte[] sk = Hex.Decode(buf["sk"]);          // private key
             byte[] ct = Hex.Decode(buf["ct"]);          // cipher text