diff options
Diffstat (limited to 'src/cli/speed.cpp')
-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) |