From 7f34c12781b65e1ea71e5b9ac1785397242b0132 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Tue, 25 Oct 2022 22:04:40 +0700 Subject: Refactor Pqc test configs --- crypto/test/src/pqc/crypto/test/BikeVectorTest.cs | 7 +---- crypto/test/src/pqc/crypto/test/FalconTest.cs | 6 +---- crypto/test/src/pqc/crypto/test/HqcVectorTest.cs | 7 +---- .../src/pqc/crypto/test/NtruPrimeVectorTest.cs | 20 ++------------ crypto/test/src/pqc/crypto/test/NtruVectorTest.cs | 8 +----- .../test/src/pqc/crypto/test/PicnicVectorTest.cs | 31 +++------------------- crypto/test/src/pqc/crypto/test/SaberVectorTest.cs | 31 +--------------------- 7 files changed, 10 insertions(+), 100 deletions(-) (limited to 'crypto') diff --git a/crypto/test/src/pqc/crypto/test/BikeVectorTest.cs b/crypto/test/src/pqc/crypto/test/BikeVectorTest.cs index 99201901c..9d954b5da 100644 --- a/crypto/test/src/pqc/crypto/test/BikeVectorTest.cs +++ b/crypto/test/src/pqc/crypto/test/BikeVectorTest.cs @@ -22,12 +22,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Tests { "PQCkemKAT_BIKE_10276.rsp", BikeParameters.bike256 }, }; - private static readonly string[] TestVectorFiles = - { - "PQCkemKAT_BIKE_3114.rsp", - "PQCkemKAT_BIKE_6198.rsp", - "PQCkemKAT_BIKE_10276.rsp", - }; + private static readonly IEnumerable TestVectorFiles = Parameters.Keys; [Test] public void TestParameters() diff --git a/crypto/test/src/pqc/crypto/test/FalconTest.cs b/crypto/test/src/pqc/crypto/test/FalconTest.cs index b9859759c..c7421de6c 100644 --- a/crypto/test/src/pqc/crypto/test/FalconTest.cs +++ b/crypto/test/src/pqc/crypto/test/FalconTest.cs @@ -22,11 +22,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Tests { "falcon1024-KAT.rsp", FalconParameters.falcon_1024 }, }; - private static readonly string[] TestVectorFiles = - { - "falcon512-KAT.rsp", - "falcon1024-KAT.rsp", - }; + private static readonly IEnumerable TestVectorFiles = Parameters.Keys; [Test] public void TestParameters() diff --git a/crypto/test/src/pqc/crypto/test/HqcVectorTest.cs b/crypto/test/src/pqc/crypto/test/HqcVectorTest.cs index 108508f9d..c836c8cb3 100644 --- a/crypto/test/src/pqc/crypto/test/HqcVectorTest.cs +++ b/crypto/test/src/pqc/crypto/test/HqcVectorTest.cs @@ -22,12 +22,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Tests { "PQCkemKAT_7285.rsp", HqcParameters.hqc256 }, }; - private static readonly string[] TestVectorFiles = - { - "PQCkemKAT_2289.rsp", - "PQCkemKAT_4562.rsp", - "PQCkemKAT_7285.rsp", - }; + private static readonly IEnumerable TestVectorFiles = Parameters.Keys; [Test] public void TestParameters() diff --git a/crypto/test/src/pqc/crypto/test/NtruPrimeVectorTest.cs b/crypto/test/src/pqc/crypto/test/NtruPrimeVectorTest.cs index 45364363c..34a7a4cae 100644 --- a/crypto/test/src/pqc/crypto/test/NtruPrimeVectorTest.cs +++ b/crypto/test/src/pqc/crypto/test/NtruPrimeVectorTest.cs @@ -34,25 +34,9 @@ namespace Org.BouncyCastle.Pqc.Crypto.Tests { "kat_kem_sntrup_1277.rsp", SNtruPrimeParameters.sntrup1277 }, }; - private static readonly string[] TestVectorFilesNtruLP = - { - "kat_kem_ntrulp_653.rsp", - "kat_kem_ntrulp_761.rsp", - "kat_kem_ntrulp_857.rsp", - "kat_kem_ntrulp_953.rsp", - "kat_kem_ntrulp_1013.rsp", - "kat_kem_ntrulp_1277.rsp", - }; + private static readonly IEnumerable TestVectorFilesNtruLP = ParametersNtruLP.Keys; - private static readonly string[] TestVectorFilesSNtruP = - { - "kat_kem_sntrup_653.rsp", - "kat_kem_sntrup_761.rsp", - "kat_kem_sntrup_857.rsp", - "kat_kem_sntrup_953.rsp", - "kat_kem_sntrup_1013.rsp", - "kat_kem_sntrup_1277.rsp", - }; + private static readonly IEnumerable TestVectorFilesSNtruP = ParametersSNtruP.Keys; [TestCaseSource(nameof(TestVectorFilesNtruLP))] [Parallelizable(ParallelScope.All)] diff --git a/crypto/test/src/pqc/crypto/test/NtruVectorTest.cs b/crypto/test/src/pqc/crypto/test/NtruVectorTest.cs index 099380654..d69e33710 100644 --- a/crypto/test/src/pqc/crypto/test/NtruVectorTest.cs +++ b/crypto/test/src/pqc/crypto/test/NtruVectorTest.cs @@ -25,13 +25,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Tests { "PQCkemKAT_1450.rsp", NtruParameters.NtruHrss701 }, }; - private static readonly string[] TestVectorFiles = - { - "PQCkemKAT_935.rsp", - "PQCkemKAT_1234.rsp", - "PQCkemKAT_1590.rsp", - "PQCkemKAT_1450.rsp", - }; + private static readonly IEnumerable TestVectorFiles = Parameters.Keys; [TestCaseSource(nameof(TestVectorFiles))] [Parallelizable(ParallelScope.All)] diff --git a/crypto/test/src/pqc/crypto/test/PicnicVectorTest.cs b/crypto/test/src/pqc/crypto/test/PicnicVectorTest.cs index e6925da20..c83bcae0b 100644 --- a/crypto/test/src/pqc/crypto/test/PicnicVectorTest.cs +++ b/crypto/test/src/pqc/crypto/test/PicnicVectorTest.cs @@ -32,36 +32,11 @@ namespace Org.BouncyCastle.Pqc.Crypto.Tests { "picnicl5full.rsp", PicnicParameters.picnicl5full }, }; - private static readonly string[] TestVectorFilesBasic = - { - "picnicl1fs.rsp", - "picnicl3ur.rsp", - "picnic3l1.rsp", - "picnicl1full.rsp", - }; - - private static readonly string[] TestVectorFilesExtra = - { - "picnicl1ur.rsp", - "picnicl3fs.rsp", - "picnicl5fs.rsp", - "picnicl5ur.rsp", - "picnic3l3.rsp", - "picnic3l5.rsp", - "picnicl3full.rsp", - "picnicl5full.rsp", - }; - - [TestCaseSource(nameof(TestVectorFilesBasic))] - [Parallelizable(ParallelScope.All)] - public void TVBasic(string testVectorFile) - { - RunTestVectorFile(testVectorFile); - } + private static readonly IEnumerable TestVectorFiles = Parameters.Keys; - [Explicit, TestCaseSource(nameof(TestVectorFilesExtra))] + [TestCaseSource(nameof(TestVectorFiles))] [Parallelizable(ParallelScope.All)] - public void TVExtra(string testVectorFile) + public void TV(string testVectorFile) { RunTestVectorFile(testVectorFile); } diff --git a/crypto/test/src/pqc/crypto/test/SaberVectorTest.cs b/crypto/test/src/pqc/crypto/test/SaberVectorTest.cs index a7be67ff0..86e0e5299 100644 --- a/crypto/test/src/pqc/crypto/test/SaberVectorTest.cs +++ b/crypto/test/src/pqc/crypto/test/SaberVectorTest.cs @@ -16,18 +16,6 @@ namespace Org.BouncyCastle.Pqc.Crypto.Tests [TestFixture] public class SaberVectorTest { - //SaberParameters[] parameters = { - // SaberParameters.lightsaberkem128r3, - // SaberParameters.saberkem128r3, - // SaberParameters.firesaberkem128r3, - // SaberParameters.lightsaberkem192r3, - // SaberParameters.saberkem192r3, - // SaberParameters.firesaberkem192r3, - // SaberParameters.lightsaberkem256r3, - // SaberParameters.saberkem256r3, - // SaberParameters.firesaberkem256r3, - //}; - private static readonly Dictionary Parameters = new Dictionary() { { "lightsaber.rsp", SaberParameters.lightsaberkem256r3 }, @@ -47,24 +35,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Tests { "ufiresaber-90s.rsp", SaberParameters.ufiresaberkem90sr3}, }; - private static readonly string[] TestVectorFiles = - { - "lightsaber.rsp", - "saber.rsp", - "firesaber.rsp", - - "ulightsaber.rsp", - "usaber.rsp", - "ufiresaber.rsp", - - "lightsaber-90s.rsp", - "saber-90s.rsp", - "firesaber-90s.rsp", - - "ulightsaber-90s.rsp", - "usaber-90s.rsp", - "ufiresaber-90s.rsp", - }; + private static readonly IEnumerable TestVectorFiles = Parameters.Keys; [Test] public void TestParameters() -- cgit 1.4.1