diff options
author | Jack Lloyd <[email protected]> | 2016-11-12 02:53:15 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-11-12 02:53:15 -0500 |
commit | eda1db90585c11507854b5584d7d4acf7e47be15 (patch) | |
tree | 53b197f2bac857d9ae7a40bab3afee7b05c34728 /src | |
parent | aa7503986177f51939c67425f0d03fb83a07c812 (diff) |
Basic speed test for XMSS
Diffstat (limited to 'src')
-rw-r--r-- | src/cli/speed.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/cli/speed.cpp b/src/cli/speed.cpp index c89ae6046..47cdc03c0 100644 --- a/src/cli/speed.cpp +++ b/src/cli/speed.cpp @@ -87,6 +87,10 @@ #include <botan/mceliece.h> #endif +#if defined(BOTAN_HAS_XMSS) + #include <botan/xmss.h> +#endif + #if defined(BOTAN_HAS_NEWHOPE) && defined(BOTAN_HAS_CHACHA) #include <botan/newhope.h> #include <botan/chacha.h> @@ -424,6 +428,12 @@ class Speed final : public Command bench_mceliece(provider, msec); } #endif +#if defined(BOTAN_HAS_XMSS) + else if(algo == "XMSS") + { + bench_xmss(provider, msec); + } +#endif #if defined(BOTAN_HAS_NEWHOPE) && defined(BOTAN_HAS_CHACHA) else if(algo == "NEWHOPE") { @@ -1173,6 +1183,30 @@ class Speed final : public Command } #endif +#if defined(BOTAN_HAS_XMSS) + void bench_xmss(const std::string& provider, + std::chrono::milliseconds msec) + { + std::vector<std::string> xmss_params{ + "XMSS_SHA2-256_W16_H10", + "XMSS_SHA2-512_W16_H10", + }; + + for(std::string params : xmss_params) + { + Timer keygen_timer(params, provider, "keygen"); + + std::unique_ptr<Botan::Private_Key> key(keygen_timer.run([&] { + return new Botan::XMSS_PrivateKey(Botan::XMSS_Parameters::XMSS_SHA2_256_W16_H10, rng()); + })); + + output() << Timer::result_string_ops(keygen_timer); + bench_pk_sig(*key, params, provider, "", msec); + } + } +#endif + + #if defined(BOTAN_HAS_NEWHOPE) && defined(BOTAN_HAS_CHACHA) void bench_newhope(const std::string& /*provider*/, std::chrono::milliseconds msec) |