diff options
author | lloyd <[email protected]> | 2010-03-13 19:08:01 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-03-13 19:08:01 +0000 |
commit | 72a154f3d7eef286b42a116232f8b7be88ccb6d6 (patch) | |
tree | 6b351fb118ded9a9d0bc0455d8b56b394ba1b9b0 /checks/pk_bench.cpp | |
parent | 17470c645f0d622f6be3e9e14811703c670c0cc4 (diff) |
Centralize which ECC domains are used for benchmarking
Diffstat (limited to 'checks/pk_bench.cpp')
-rw-r--r-- | checks/pk_bench.cpp | 51 |
1 files changed, 17 insertions, 34 deletions
diff --git a/checks/pk_bench.cpp b/checks/pk_bench.cpp index 5a6bbe7f6..e3e96ae04 100644 --- a/checks/pk_bench.cpp +++ b/checks/pk_bench.cpp @@ -7,6 +7,7 @@ #include <botan/pkcs8.h> #include <botan/mem_ops.h> #include <botan/parsing.h> +#include <botan/oids.h> #include <map> #if defined(BOTAN_HAS_RSA) @@ -66,6 +67,16 @@ using namespace Botan; namespace { +const char* ec_domains[] = { + "secp160r2", + "secp192r1", + "secp224r1", + "secp256r1", + "secp384r1", + "secp521r1", + 0 +}; + class Benchmark_Report { public: @@ -293,18 +304,9 @@ void benchmark_ecdsa(RandomNumberGenerator& rng, double seconds, Benchmark_Report& report) { - const char* domains[] = { "1.3.132.0.30", // secp160r2 - "1.2.840.10045.3.1.1", // secp192r1 - "1.3.132.0.33", // secp224r1 - "1.2.840.10045.3.1.7", // secp256r1 - "1.3.132.0.34", // secp384r1 - "1.3.132.0.35", // secp512r1 - NULL }; - - for(size_t j = 0; domains[j]; j++) + for(size_t j = 0; ec_domains[j]; j++) { - OID oid(domains[j]); - EC_Domain_Params params(oid); + EC_Domain_Params params(OIDS::lookup(ec_domains[j])); u32bit pbits = params.get_curve().get_p().bits(); @@ -351,19 +353,9 @@ void benchmark_gost_3410(RandomNumberGenerator& rng, double seconds, Benchmark_Report& report) { - const char* domains[] = { "1.3.132.0.6", // secp112r1 - "1.3.132.0.28", // secp128r1 - "1.3.132.0.30", // secp160r2 - "1.3.132.0.33", // secp224r1 - "1.2.643.2.2.35.1", // gost 256p - "1.3.132.0.34", // secp384r1 - "1.3.132.0.35", // secp512r1 - NULL }; - - for(size_t j = 0; domains[j]; j++) + for(size_t j = 0; ec_domains[j]; j++) { - OID oid(domains[j]); - EC_Domain_Params params(oid); + EC_Domain_Params params(OIDS::lookup(ec_domains[j])); u32bit pbits = params.get_curve().get_p().bits(); @@ -410,18 +402,9 @@ void benchmark_ecdh(RandomNumberGenerator& rng, double seconds, Benchmark_Report& report) { - const char* domains[] = { "1.3.132.0.6", // secp112r1 - "1.3.132.0.28", // secp128r1 - "1.3.132.0.30", // secp160r2 - "1.3.132.0.33", // secp224r1 - "1.3.132.0.34", // secp384r1 - "1.3.132.0.35", // secp512r1 - NULL }; - - for(size_t j = 0; domains[j]; j++) + for(size_t j = 0; ec_domains[j]; j++) { - OID oid(domains[j]); - EC_Domain_Params params(oid); + EC_Domain_Params params(OIDS::lookup(ec_domains[j])); u32bit pbits = params.get_curve().get_p().bits(); |