aboutsummaryrefslogtreecommitdiffstats
path: root/checks/pk_bench.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2011-02-07 14:00:45 +0000
committerlloyd <[email protected]>2011-02-07 14:00:45 +0000
commit6aae5ab9f16af0fc0f027bc0c4dc3ee4ee239510 (patch)
treedb4714f423af2a0146a6312d281feaca8fcc2c2b /checks/pk_bench.cpp
parente0934ae723f6b97f1adbc408e42719db64b9607d (diff)
Fix the ordering of the GOST 34.10 signature values. Add a test
derived from a DNSSEC RFC. Bug reported by Bert Hubert to the mailing list. According to Bert, this ordering is compatible with the version included in OpenSSL. Also, benchmark GOST 34.10 using the GOST 34.11 hash since that is always what it is used with.
Diffstat (limited to 'checks/pk_bench.cpp')
-rw-r--r--checks/pk_bench.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/checks/pk_bench.cpp b/checks/pk_bench.cpp
index 3597257a4..348cb7ff1 100644
--- a/checks/pk_bench.cpp
+++ b/checks/pk_bench.cpp
@@ -154,7 +154,7 @@ void benchmark_sig_ver(PK_Verifier& ver, PK_Signer& sig,
if(verify_timer.seconds() < seconds)
{
verify_timer.start();
- bool verified = ver.verify_message(message, signature);
+ const bool verified = ver.verify_message(message, signature);
verify_timer.stop();
if(!verified)
@@ -165,10 +165,10 @@ void benchmark_sig_ver(PK_Verifier& ver, PK_Signer& sig,
sig_random = rng.random_vec(signature.size());
verify_timer.start();
- bool verified2 = ver.verify_message(message, sig_random);
+ const bool verified_bad = ver.verify_message(message, sig_random);
verify_timer.stop();
- if(verified2)
+ if(verified_bad)
std::cerr << "Signature verification failure (bad sig OK)\n";
}
}
@@ -356,16 +356,9 @@ void benchmark_gost_3410(RandomNumberGenerator& rng,
{
EC_Domain_Params params(OIDS::lookup(ec_domains[j]));
- size_t pbits = params.get_curve().get_p().bits();
-
- size_t hashbits = pbits;
-
- if(hashbits <= 192)
- hashbits = 160;
- if(hashbits == 521)
- hashbits = 512;
+ const size_t pbits = params.get_curve().get_p().bits();
- const std::string padding = "EMSA1(SHA-" + to_string(hashbits) + ")";
+ const std::string padding = "EMSA1(GOST-34.11)";
Timer keygen_timer("keygen");
Timer verify_timer(padding + " verify");