summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--crypto/test/src/pqc/crypto/lms/test/HssTests.cs (renamed from crypto/test/src/pqc/crypto/lms/HSSTests.cs)36
-rw-r--r--crypto/test/src/pqc/crypto/lms/test/LmsKeyGenTests.cs (renamed from crypto/test/src/pqc/crypto/lms/LMSKeyGenTests.cs)6
-rw-r--r--crypto/test/src/pqc/crypto/lms/test/LmsTests.cs (renamed from crypto/test/src/pqc/crypto/lms/LMSTests.cs)14
-rw-r--r--crypto/test/src/pqc/crypto/lms/test/LmsVectorUtilities.cs (renamed from crypto/test/src/pqc/crypto/lms/LMSVectorUtils.cs)4
-rw-r--r--crypto/test/src/pqc/crypto/lms/test/TypeTests.cs (renamed from crypto/test/src/pqc/crypto/lms/TypeTests.cs)2
5 files changed, 29 insertions, 33 deletions
diff --git a/crypto/test/src/pqc/crypto/lms/HSSTests.cs b/crypto/test/src/pqc/crypto/lms/test/HssTests.cs
index 691c51914..fcc3cb9c6 100644
--- a/crypto/test/src/pqc/crypto/lms/HSSTests.cs
+++ b/crypto/test/src/pqc/crypto/lms/test/HssTests.cs
@@ -10,13 +10,11 @@ using Org.BouncyCastle.Utilities;
 using Org.BouncyCastle.Utilities.Encoders;
 using Org.BouncyCastle.Utilities.Test;
 
-namespace Org.BouncyCastle.Pqc.Crypto.Lms
+namespace Org.BouncyCastle.Pqc.Crypto.Lms.Tests
 {
-
     [TestFixture]
-    public class HSSTests
+    public class HssTests
     {
-
         [Test]
         public void TestHssKeySerialisation()
         {
@@ -26,7 +24,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Lms
                 fixedSource[t] = 1;
             }
 
-            FixedSecureRandom.Source[] source = {new FixedSecureRandom.Source(fixedSource)};
+            FixedSecureRandom.Source[] source = { new FixedSecureRandom.Source(fixedSource) };
             SecureRandom rand = new FixedSecureRandom(source);
 
             HSSPrivateKeyParameters generatedPrivateKey = HSS.GenerateHssKeyPair(
@@ -65,12 +63,12 @@ namespace Org.BouncyCastle.Pqc.Crypto.Lms
          * From https://tools.ietf.org/html/rfc8554#appendix-F
          */
         [Test]
-        public void TestHSSVector_1()
+        public void TestHssVector_1()
         {
             var blocks = LoadVector("pqc.lms.testcase_1.txt");
 
             HSSPublicKeyParameters publicKey = HSSPublicKeyParameters.GetInstance(blocks[0]);
-            byte[] message = (byte[]) blocks[1];
+            byte[] message = blocks[1];
             HSSSignature signature = HSSSignature.GetInstance(blocks[2], publicKey.L);
             Assert.True(HSS.VerifySignature(publicKey, signature, message), "Test Case 1 ");
         }
@@ -80,7 +78,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Lms
          * From https://tools.ietf.org/html/rfc8554#appendix-F
          */
         [Test]
-        public void TestHSSVector_2()
+        public void TestHssVector_2()
         {
             var blocks = LoadVector("pqc.lms.testcase_2.txt");
 
@@ -109,7 +107,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Lms
                 {
                     if (sw.Length > 0)
                     {
-                        blocks.Add(LMSVectorUtils.ExtractPrefixedBytes(sw.ToString()));
+                        blocks.Add(LmsVectorUtilities.ExtractPrefixedBytes(sw.ToString()));
                         sw.Length = 0;
                     }
                 }
@@ -119,7 +117,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Lms
 
             if (sw.Length > 0)
             {
-                blocks.Add(LMSVectorUtils.ExtractPrefixedBytes(sw.ToString()));
+                blocks.Add(LmsVectorUtilities.ExtractPrefixedBytes(sw.ToString()));
                 sw.Length = 0;
             }
             return blocks;
@@ -173,7 +171,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Lms
                 fixedSource[t] = 1;
             }
 
-            FixedSecureRandom.Source[] source = {new FixedSecureRandom.Source(fixedSource)};
+            FixedSecureRandom.Source[] source = { new FixedSecureRandom.Source(fixedSource) };
             SecureRandom rand = new FixedSecureRandom(source);
 
             HSSPrivateKeyParameters keyPair = HSS.GenerateHssKeyPair(
@@ -204,7 +202,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Lms
             // This is a sanity test
             //
             {
-                FixedSecureRandom.Source[] source1 = {new FixedSecureRandom.Source(fixedSource)};
+                FixedSecureRandom.Source[] source1 = { new FixedSecureRandom.Source(fixedSource) };
                 SecureRandom rand1 = new FixedSecureRandom(source1);
 
                 HSSPrivateKeyParameters regenKeyPair = HSS.GenerateHssKeyPair(
@@ -349,7 +347,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Lms
                     //
                     // Assumes Signature is the last element in the set of vectors.
                     //
-                    FixedSecureRandom.Source[] source = {new FixedSecureRandom.Source(fixedESBuffer.ToArray())};
+                    FixedSecureRandom.Source[] source = { new FixedSecureRandom.Source(fixedESBuffer.ToArray()) };
                     FixedSecureRandom fixRnd = new FixedSecureRandom(source);
                     fixedESBuffer.SetLength(0);//todo is this correct? buffer.reset();
                     //fixedESBuffer = new MemoryStream();
@@ -485,7 +483,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Lms
                 //
                 // Assumes Signature is the last element in the set of vectors.
                 //
-                FixedSecureRandom.Source[] source = {new FixedSecureRandom.Source(fixedESBuffer.ToArray())};
+                FixedSecureRandom.Source[] source = { new FixedSecureRandom.Source(fixedESBuffer.ToArray()) };
                 FixedSecureRandom fixRnd = new FixedSecureRandom(source);
                 fixedESBuffer.SetLength(0);
                 var lmsParams = new List<LMSParameters>();
@@ -544,12 +542,12 @@ namespace Org.BouncyCastle.Pqc.Crypto.Lms
                     if (i % 5 == 0)
                     {
                         HSSSignature sigCalculated = HSS.GenerateSignature(pair, message);
-                        Assert.True(Arrays.AreEqual(sigCalculated.GetEncoded(),(byte[]) sigVectors[c]));
+                        Assert.True(Arrays.AreEqual(sigCalculated.GetEncoded(), sigVectors[c]));
 
                         Assert.True(HSS.VerifySignature(pubKeyFromVector, sigCalculated, message));
                         Assert.True(HSS.VerifySignature(pubKeyGenerated, sigCalculated, message));
 
-                        HSSSignature sigFromVector = HSSSignature.GetInstance((byte[]) sigVectors[c],
+                        HSSSignature sigFromVector = HSSSignature.GetInstance(sigVectors[c],
                             pubKeyFromVector.L);
 
                         Assert.True(HSS.VerifySignature(pubKeyFromVector, sigFromVector, message));
@@ -568,7 +566,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Lms
                 }
             }
         }
-        
+
         /**
          * Test remaining calculation is accurate and a new key is generated when
          * all the ots keys for that level are consumed.
@@ -760,7 +758,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Lms
                         Assert.True(ctr % 1024 == sig.Signature.Q);
 
                         // Check there was a post increment in the tail end LMS key.
-                        Assert.True((ctr % 1024) + 1 == keyPair.GetKeys()[keyPair.L - 1].GetIndex());
+                        Assert.True(ctr % 1024 + 1 == keyPair.GetKeys()[keyPair.L - 1].GetIndex());
 
                         Assert.True(ctr + 1 == keyPair.GetIndex());
 
@@ -852,7 +850,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Lms
             bs[off] = (byte)(n >> 24);
             bs[off + 1] = (byte)(n >> 16);
             bs[off + 2] = (byte)(n >> 8);
-            bs[off + 3] = (byte)(n);
+            bs[off + 3] = (byte)n;
         }
 
         private static bool TrimLine(ref string line)
diff --git a/crypto/test/src/pqc/crypto/lms/LMSKeyGenTests.cs b/crypto/test/src/pqc/crypto/lms/test/LmsKeyGenTests.cs
index 4dd417d01..fb66db457 100644
--- a/crypto/test/src/pqc/crypto/lms/LMSKeyGenTests.cs
+++ b/crypto/test/src/pqc/crypto/lms/test/LmsKeyGenTests.cs
@@ -1,14 +1,12 @@
-using System;
-
 using NUnit.Framework;
 
 using Org.BouncyCastle.Utilities;
 using Org.BouncyCastle.Utilities.Encoders;
 
-namespace Org.BouncyCastle.Pqc.Crypto.Lms
+namespace Org.BouncyCastle.Pqc.Crypto.Lms.Tests
 {
     [TestFixture]
-    public class LMSKeyGenTests
+    public class LmsKeyGenTests
     {
         [Test]
         public void TestGeneratePrivateKey()
diff --git a/crypto/test/src/pqc/crypto/lms/LMSTests.cs b/crypto/test/src/pqc/crypto/lms/test/LmsTests.cs
index 7f7b4c089..5a7a84031 100644
--- a/crypto/test/src/pqc/crypto/lms/LMSTests.cs
+++ b/crypto/test/src/pqc/crypto/lms/test/LmsTests.cs
@@ -5,10 +5,10 @@ using NUnit.Framework;
 using Org.BouncyCastle.Utilities;
 using Org.BouncyCastle.Utilities.Encoders;
 
-namespace Org.BouncyCastle.Pqc.Crypto.Lms
+namespace Org.BouncyCastle.Pqc.Crypto.Lms.Tests
 {
     [TestFixture]
-    public class LMSTests
+    public class LmsTests
     {
         [Test]
         public void TestCoefFunc()
@@ -32,11 +32,11 @@ namespace Org.BouncyCastle.Pqc.Crypto.Lms
             byte[] ms = new byte[32];
             for (int t = 0; t < ms.Length; t++)
             {
-                ms[t] = (byte) t;
+                ms[t] = (byte)t;
             }
 
             LMSContext ctx = privateKey.GetSignatureContext(null, null);
-            
+
             ctx.BlockUpdate(ms, 0, ms.Length);
 
             LMOtsSignature sig = LM_OTS.LMOtsGenerateSignature(privateKey, ctx.GetQ(), ctx.C);
@@ -123,7 +123,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Lms
                 Assert.False(LMS.VerifySignature(publicKey, signature, msg2));
             }
         }
-        
+
         [Test]
         public void TestContextSingleUse()
         {
@@ -136,7 +136,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Lms
             LMOtsPublicKey publicKey = LM_OTS.LmsOtsGeneratePublicKey(privateKey);
 
             byte[] ms = new byte[32];
-                for (int t = 0; t < ms.Length; t++)
+            for (int t = 0; t < ms.Length; t++)
             {
                 ms[t] = (byte)t;
             }
@@ -150,7 +150,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Lms
 
             try
             {
-                ctx.Update((byte)1);
+                ctx.Update(1);
                 Assert.Fail("Digest reuse after signature taken.");
             }
             catch (NullReferenceException)
diff --git a/crypto/test/src/pqc/crypto/lms/LMSVectorUtils.cs b/crypto/test/src/pqc/crypto/lms/test/LmsVectorUtilities.cs
index 642e29f2d..3ad03b0e1 100644
--- a/crypto/test/src/pqc/crypto/lms/LMSVectorUtils.cs
+++ b/crypto/test/src/pqc/crypto/lms/test/LmsVectorUtilities.cs
@@ -2,9 +2,9 @@ using System.IO;
 
 using Org.BouncyCastle.Utilities.Encoders;
 
-namespace Org.BouncyCastle.Pqc.Crypto.Lms
+namespace Org.BouncyCastle.Pqc.Crypto.Lms.Tests
 {
-    public class LMSVectorUtils
+    public class LmsVectorUtilities
     {
         public static byte[] ExtractPrefixedBytes(string vectorFromRFC)
         {
diff --git a/crypto/test/src/pqc/crypto/lms/TypeTests.cs b/crypto/test/src/pqc/crypto/lms/test/TypeTests.cs
index ca64737b8..948ce4747 100644
--- a/crypto/test/src/pqc/crypto/lms/TypeTests.cs
+++ b/crypto/test/src/pqc/crypto/lms/test/TypeTests.cs
@@ -2,7 +2,7 @@ using System.Collections.Generic;
 
 using NUnit.Framework;
 
-namespace Org.BouncyCastle.Pqc.Crypto.Lms
+namespace Org.BouncyCastle.Pqc.Crypto.Lms.Tests
 {
     [TestFixture]
     public class TypeTests