aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/test_mceliece.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-06-07 08:29:02 -0400
committerJack Lloyd <[email protected]>2016-06-07 08:29:25 -0400
commitb87a43f4cce797c7f1ee4ecc9bed229f6458a4d6 (patch)
tree4ca557ef7d9a52af68b1417192905a7f39e4819a /src/tests/test_mceliece.cpp
parent9e95b74f3c5ec01c384dfc38beb34c073501bc8b (diff)
Tweak for readability in McEliece tests
Using a struct here seems cleaner
Diffstat (limited to 'src/tests/test_mceliece.cpp')
-rw-r--r--src/tests/test_mceliece.cpp25
1 files changed, 10 insertions, 15 deletions
diff --git a/src/tests/test_mceliece.cpp b/src/tests/test_mceliece.cpp
index 455c50a8d..3f7fe529b 100644
--- a/src/tests/test_mceliece.cpp
+++ b/src/tests/test_mceliece.cpp
@@ -131,26 +131,21 @@ class McEliece_Tests : public Test
std::vector<Test::Result> run() override
{
- size_t params__n__t_min_max[] = {
- 256, 5, 15,
- 512, 5, 33,
- 1024, 15, 35,
- 2048, 33, 50,
- 2960, 50, 56,
- 6624, 110, 115
- };
+ struct keygen_params { size_t code_length, t_min, t_max; };
+
+ const keygen_params param_sets[] = { { 256, 5, 15 },
+ { 512, 5, 33 },
+ { 1024, 15, 35 },
+ { 2048, 33, 50 },
+ { 6624, 110, 115 } };
std::vector<Test::Result> results;
- for(size_t i = 0; i < sizeof(params__n__t_min_max)/sizeof(params__n__t_min_max[0]); i+=3)
+ for(size_t i = 0; i < sizeof(param_sets)/sizeof(param_sets[0]); ++i)
{
- const size_t code_length = params__n__t_min_max[i];
- const size_t min_t = params__n__t_min_max[i+1];
- const size_t max_t = params__n__t_min_max[i+2];
-
- for(size_t t = min_t; t <= max_t; ++t)
+ for(size_t t = param_sets[i].t_min; t <= param_sets[i].t_max; ++t)
{
- Botan::McEliece_PrivateKey sk1(Test::rng(), code_length, t);
+ Botan::McEliece_PrivateKey sk1(Test::rng(), param_sets[i].code_length, t);
const Botan::McEliece_PublicKey& pk1 = sk1;
const std::vector<byte> pk_enc = pk1.x509_subject_public_key();