diff options
author | Jack Lloyd <[email protected]> | 2016-10-30 13:32:35 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-10-30 13:32:35 -0400 |
commit | a5b9bae0c825624d5757caed0e5a7f5cf4c04db2 (patch) | |
tree | 5a76ad318523b1dce8fb1fd4f6cd44e4cbdc3291 /src/cli/speed.cpp | |
parent | 67990086f7bcefee9b5376fe4d98ff11a6614807 (diff) | |
parent | fb71bbc9c1d968946a730aaa0b0f49f4e02af80d (diff) |
Merge GH #696 Add ECKCDSA and ECGDSA speed tests
Diffstat (limited to 'src/cli/speed.cpp')
-rw-r--r-- | src/cli/speed.cpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/src/cli/speed.cpp b/src/cli/speed.cpp index 923abe5c2..7fe2a3757 100644 --- a/src/cli/speed.cpp +++ b/src/cli/speed.cpp @@ -63,6 +63,14 @@ #include <botan/ecdsa.h> #endif +#if defined(BOTAN_HAS_ECKCDSA) + #include <botan/eckcdsa.h> +#endif + +#if defined(BOTAN_HAS_ECGDSA) + #include <botan/ecgdsa.h> +#endif + #if defined(BOTAN_HAS_DIFFIE_HELLMAN) #include <botan/dh.h> #endif @@ -309,6 +317,8 @@ std::vector<std::string> default_benchmark_list() "DH", "ECDH", "ECDSA", + "ECKCDSA", + "ECGDSA", "Curve25519", "McEliece", "NEWHOPE" @@ -378,6 +388,18 @@ class Speed final : public Command bench_ecdsa(provider, msec); } #endif +#if defined(BOTAN_HAS_ECKCDSA) + else if(algo == "ECKCDSA") + { + bench_eckcdsa(provider, msec); + } +#endif +#if defined(BOTAN_HAS_ECGDSA) + else if(algo == "ECGDSA") + { + bench_ecgdsa(provider, msec); + } +#endif #if defined(BOTAN_HAS_DIFFIE_HELLMAN) else if(algo == "DH") { @@ -1002,6 +1024,46 @@ class Speed final : public Command } } #endif + +#if defined(BOTAN_HAS_ECKCDSA) + void bench_eckcdsa(const std::string& provider, + std::chrono::milliseconds msec) + { + for(std::string grp : { "secp256r1", "secp384r1", "secp521r1" }) + { + const std::string nm = "ECKCDSA-" + grp; + + Timer keygen_timer(nm, provider, "keygen"); + + std::unique_ptr<Botan::Private_Key> key(keygen_timer.run([&] { + return new Botan::ECKCDSA_PrivateKey(rng(), Botan::EC_Group(grp)); + })); + + output() << Timer::result_string_ops(keygen_timer); + bench_pk_sig(*key, nm, provider, "EMSA1(SHA-256)", msec); + } + } +#endif + +#if defined(BOTAN_HAS_ECGDSA) + void bench_ecgdsa(const std::string& provider, + std::chrono::milliseconds msec) + { + for(std::string grp : { "secp256r1", "secp384r1", "secp521r1" }) + { + const std::string nm = "ECGDSA-" + grp; + + Timer keygen_timer(nm, provider, "keygen"); + + std::unique_ptr<Botan::Private_Key> key(keygen_timer.run([&] { + return new Botan::ECGDSA_PrivateKey(rng(), Botan::EC_Group(grp)); + })); + + output() << Timer::result_string_ops(keygen_timer); + bench_pk_sig(*key, nm, provider, "EMSA1(SHA-256)", msec); + } + } +#endif #if defined(BOTAN_HAS_DIFFIE_HELLMAN) void bench_dh(const std::string& provider, |