summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--crypto/src/pqc/crypto/ntruprime/NtruLPRimeParameters.cs12
-rw-r--r--crypto/src/pqc/crypto/ntruprime/SNtruPrimeParameters.cs12
-rw-r--r--crypto/test/src/pqc/crypto/test/NtruPrimeVectorTest.cs18
3 files changed, 30 insertions, 12 deletions
diff --git a/crypto/src/pqc/crypto/ntruprime/NtruLPRimeParameters.cs b/crypto/src/pqc/crypto/ntruprime/NtruLPRimeParameters.cs
index eac349267..f6578e83f 100644
--- a/crypto/src/pqc/crypto/ntruprime/NtruLPRimeParameters.cs
+++ b/crypto/src/pqc/crypto/ntruprime/NtruLPRimeParameters.cs
@@ -47,12 +47,12 @@ namespace Org.BouncyCastle.Pqc.Crypto.NtruPrime
             this._defaultKeySize = defaultKeySize;
         }
 
-        public static NtruLPRimeParameters ntrulpr653 = new NtruLPRimeParameters("NTRU_LPRime_653", 653, 4621, true, 252, 2175,113,2031,290,1125,897,1025, 865, -1, 128);
-        public static NtruLPRimeParameters ntrulpr761 = new NtruLPRimeParameters("NTRU_LPRime_761", 761, 4591, true, 250, 2156,114,2007,287,1294,1039,1167, 1007, -1, 128);
-        public static NtruLPRimeParameters ntrulpr857 = new NtruLPRimeParameters("NTRU_LPRime_857", 857, 5167, true, 281, 2433,101,2265,324,1463,1184,1312, 1152, -1, 128);
-        public static NtruLPRimeParameters ntrulpr953 = new NtruLPRimeParameters("NTRU_LPRime_953", 953, 6343, true, 345, 2997,82,2798,400,1652,1349,1477, 1317, -1, 192);
-        public static NtruLPRimeParameters ntrulpr1013 = new NtruLPRimeParameters("NTRU_LPRime_1013", 1013, 7177, true, 392, 3367,73,3143,449,1773,1455,1583, 1423, -1, 192);
-        public static NtruLPRimeParameters ntrulpr1277 = new NtruLPRimeParameters("NTRU_LPRime_1277", 1277, 7879, true, 429, 3724,66,3469,496,2231,1847,1975, 1815, -1, 256);
+        public static readonly NtruLPRimeParameters ntrulpr653 = new NtruLPRimeParameters("NTRU_LPRime_653", 653, 4621, true, 252, 2175,113,2031,290,1125,897,1025, 865, -1, 256);
+        public static readonly NtruLPRimeParameters ntrulpr761 = new NtruLPRimeParameters("NTRU_LPRime_761", 761, 4591, true, 250, 2156,114,2007,287,1294,1039,1167, 1007, -1, 256);
+        public static readonly NtruLPRimeParameters ntrulpr857 = new NtruLPRimeParameters("NTRU_LPRime_857", 857, 5167, true, 281, 2433,101,2265,324,1463,1184,1312, 1152, -1, 256);
+        public static readonly NtruLPRimeParameters ntrulpr953 = new NtruLPRimeParameters("NTRU_LPRime_953", 953, 6343, true, 345, 2997,82,2798,400,1652,1349,1477, 1317, -1, 256);
+        public static readonly NtruLPRimeParameters ntrulpr1013 = new NtruLPRimeParameters("NTRU_LPRime_1013", 1013, 7177, true, 392, 3367,73,3143,449,1773,1455,1583, 1423, -1, 256);
+        public static readonly NtruLPRimeParameters ntrulpr1277 = new NtruLPRimeParameters("NTRU_LPRime_1277", 1277, 7879, true, 429, 3724,66,3469,496,2231,1847,1975, 1815, -1, 256);
 
         public int P => p;
 
diff --git a/crypto/src/pqc/crypto/ntruprime/SNtruPrimeParameters.cs b/crypto/src/pqc/crypto/ntruprime/SNtruPrimeParameters.cs
index b6872da79..108793058 100644
--- a/crypto/src/pqc/crypto/ntruprime/SNtruPrimeParameters.cs
+++ b/crypto/src/pqc/crypto/ntruprime/SNtruPrimeParameters.cs
@@ -44,12 +44,12 @@ namespace Org.BouncyCastle.Pqc.Crypto.NtruPrime
             this._defaultKeySize = defaultKeySize;
         }
 
-        public static SNtruPrimeParameters sntrup653 = new SNtruPrimeParameters("SNTRU_Prime_653", 653, 4621, false, 288, -1,-1,-1,-1,1518,994,897, 865, 994, 128);
-        public static SNtruPrimeParameters sntrup761 = new SNtruPrimeParameters("SNTRU_Prime_761", 761, 4591, false, 286, -1,-1,-1,-1,1763,1158,1039, 1007, 1158, 128);
-        public static SNtruPrimeParameters sntrup857 = new SNtruPrimeParameters("SNTRU_Prime_857", 857, 5167, false, 322, -1,-1,-1,-1,1999,1322,1184, 1152, 1322, 128);
-        public static SNtruPrimeParameters sntrup953 = new SNtruPrimeParameters("SNTRU_Prime_953", 953, 6343, false, 396, -1,-1,-1,-1,2254,1505,1349, 1317, 1505, 192);
-        public static SNtruPrimeParameters sntrup1013 = new SNtruPrimeParameters("SNTRU_Prime_1013", 1013, 7177, false, 448, -1,-1,-1,-1,2417,1623,1455, 1423, 1623, 192);
-        public static SNtruPrimeParameters sntrup1277 = new SNtruPrimeParameters("SNTRU_Prime_1277", 1277, 7879, false, 492, -1,-1,-1,-1,3059,2067,1847, 1815, 2067, 256);
+        public static readonly SNtruPrimeParameters sntrup653 = new SNtruPrimeParameters("SNTRU_Prime_653", 653, 4621, false, 288, -1,-1,-1,-1,1518,994,897, 865, 994, 256);
+        public static readonly SNtruPrimeParameters sntrup761 = new SNtruPrimeParameters("SNTRU_Prime_761", 761, 4591, false, 286, -1,-1,-1,-1,1763,1158,1039, 1007, 1158, 256);
+        public static readonly SNtruPrimeParameters sntrup857 = new SNtruPrimeParameters("SNTRU_Prime_857", 857, 5167, false, 322, -1,-1,-1,-1,1999,1322,1184, 1152, 1322, 256);
+        public static readonly SNtruPrimeParameters sntrup953 = new SNtruPrimeParameters("SNTRU_Prime_953", 953, 6343, false, 396, -1,-1,-1,-1,2254,1505,1349, 1317, 1505, 256);
+        public static readonly SNtruPrimeParameters sntrup1013 = new SNtruPrimeParameters("SNTRU_Prime_1013", 1013, 7177, false, 448, -1,-1,-1,-1,2417,1623,1455, 1423, 1623, 256);
+        public static readonly SNtruPrimeParameters sntrup1277 = new SNtruPrimeParameters("SNTRU_Prime_1277", 1277, 7879, false, 492, -1,-1,-1,-1,3059,2067,1847, 1815, 2067, 256);
 
         public int P => p;
 
diff --git a/crypto/test/src/pqc/crypto/test/NtruPrimeVectorTest.cs b/crypto/test/src/pqc/crypto/test/NtruPrimeVectorTest.cs
index 34a7a4cae..14c37cbbe 100644
--- a/crypto/test/src/pqc/crypto/test/NtruPrimeVectorTest.cs
+++ b/crypto/test/src/pqc/crypto/test/NtruPrimeVectorTest.cs
@@ -38,6 +38,24 @@ namespace Org.BouncyCastle.Pqc.Crypto.Tests
 
         private static readonly IEnumerable<string> TestVectorFilesSNtruP = ParametersSNtruP.Keys;
 
+        [Test]
+        public void TestParameters()
+        {
+            Assert.AreEqual(256, SNtruPrimeParameters.sntrup653.DefaultKeySize);
+            Assert.AreEqual(256, SNtruPrimeParameters.sntrup761.DefaultKeySize);
+            Assert.AreEqual(256, SNtruPrimeParameters.sntrup857.DefaultKeySize);
+            Assert.AreEqual(256, SNtruPrimeParameters.sntrup953.DefaultKeySize);
+            Assert.AreEqual(256, SNtruPrimeParameters.sntrup1013.DefaultKeySize);
+            Assert.AreEqual(256, SNtruPrimeParameters.sntrup1277.DefaultKeySize);
+
+            Assert.AreEqual(256, NtruLPRimeParameters.ntrulpr653.DefaultKeySize);
+            Assert.AreEqual(256, NtruLPRimeParameters.ntrulpr761.DefaultKeySize);
+            Assert.AreEqual(256, NtruLPRimeParameters.ntrulpr857.DefaultKeySize);
+            Assert.AreEqual(256, NtruLPRimeParameters.ntrulpr953.DefaultKeySize);
+            Assert.AreEqual(256, NtruLPRimeParameters.ntrulpr1013.DefaultKeySize);
+            Assert.AreEqual(256, NtruLPRimeParameters.ntrulpr1277.DefaultKeySize);
+        }
+
         [TestCaseSource(nameof(TestVectorFilesNtruLP))]
         [Parallelizable(ParallelScope.All)]
         public void TVNtruLP(string testVectorFile)