diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-10-12 23:11:38 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-10-12 23:11:38 +0700 |
commit | 6850fa9083d5d51b3e2ae35a021962148b8f9878 (patch) | |
tree | d123f47ad8c1646caa33f3a285d44ff1b7d4b60c /crypto/test | |
parent | Refactoring SphincsPlus (performance) (diff) | |
download | BouncyCastle.NET-ed25519-6850fa9083d5d51b3e2ae35a021962148b8f9878.tar.xz |
Skip redundant cipher init in Frodo-AES
Diffstat (limited to 'crypto/test')
-rw-r--r-- | crypto/test/src/pqc/crypto/test/FrodoVectorTest.cs | 81 |
1 files changed, 28 insertions, 53 deletions
diff --git a/crypto/test/src/pqc/crypto/test/FrodoVectorTest.cs b/crypto/test/src/pqc/crypto/test/FrodoVectorTest.cs index 311a5cd3a..1c8c768d2 100644 --- a/crypto/test/src/pqc/crypto/test/FrodoVectorTest.cs +++ b/crypto/test/src/pqc/crypto/test/FrodoVectorTest.cs @@ -18,14 +18,13 @@ namespace Org.BouncyCastle.Pqc.Crypto.Tests [Test] public void TestParameters() { - FrodoParameters[] parameters = { - FrodoParameters.frodokem19888r3, - FrodoParameters.frodokem19888shaker3, - FrodoParameters.frodokem31296r3, - FrodoParameters.frodokem31296shaker3, - FrodoParameters.frodokem43088r3, - FrodoParameters.frodokem43088shaker3 + FrodoParameters.frodokem19888r3, + FrodoParameters.frodokem19888shaker3, + FrodoParameters.frodokem31296r3, + FrodoParameters.frodokem31296shaker3, + FrodoParameters.frodokem43088r3, + FrodoParameters.frodokem43088shaker3 }; Assert.AreEqual(128, FrodoParameters.frodokem19888r3.DefaultKeySize); @@ -39,43 +38,24 @@ namespace Org.BouncyCastle.Pqc.Crypto.Tests [Test] public void TestVectors() { - // bool full = System.getProperty("test.full", "false").equals("true"); - bool full = false; + string[] files = { + "PQCkemKAT_19888.rsp", + "PQCkemKAT_31296.rsp", + "PQCkemKAT_43088.rsp", + "PQCkemKAT_19888_shake.rsp", + "PQCkemKAT_31296_shake.rsp", + "PQCkemKAT_43088_shake.rsp" + }; + + FrodoParameters[] parameters = { + FrodoParameters.frodokem19888r3, + FrodoParameters.frodokem31296r3, + FrodoParameters.frodokem43088r3, + FrodoParameters.frodokem19888shaker3, + FrodoParameters.frodokem31296shaker3, + FrodoParameters.frodokem43088shaker3 + }; - string[] files; - FrodoParameters[] parameters; - if (full) - { - files = new []{ - "PQCkemKAT_19888.rsp", - "PQCkemKAT_31296.rsp", - "PQCkemKAT_43088.rsp", - "PQCkemKAT_19888_shake.rsp", - "PQCkemKAT_31296_shake.rsp", - "PQCkemKAT_43088_shake.rsp" - }; - - parameters = new []{ - FrodoParameters.frodokem19888r3, - FrodoParameters.frodokem31296r3, - FrodoParameters.frodokem43088r3, - FrodoParameters.frodokem19888shaker3, - FrodoParameters.frodokem31296shaker3, - FrodoParameters.frodokem43088shaker3 - }; - } - else - { - files = new[]{ - "PQCkemKAT_19888.rsp", - "PQCkemKAT_19888_shake.rsp", - }; - - parameters = new[]{ - FrodoParameters.frodokem19888r3, - FrodoParameters.frodokem19888shaker3, - }; - } TestSampler sampler = new TestSampler(); for (int fileIndex = 0; fileIndex != files.Length; fileIndex++) { @@ -96,17 +76,12 @@ namespace Org.BouncyCastle.Pqc.Crypto.Tests } if (line.Length == 0) { - if (buf.Count > 0 && !sampler.SkipTest(buf["count"])) + if (buf.Count > 0) { - String count = buf["count"]; - if (!"0".Equals(count)) - { - // randomly skip tests after zero. - // if (rnd.nextBoolean()) - // { - // continue; - // } - } + string count = buf["count"]; + if (sampler.SkipTest(count)) + continue; + Console.Write($"test case: {count}"); byte[] seed = Hex.Decode(buf["seed"]); // seed for nist secure random |