diff options
Diffstat (limited to 'src/cli')
-rw-r--r-- | src/cli/speed.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/cli/speed.cpp b/src/cli/speed.cpp index 090b0abb1..98a51e47a 100644 --- a/src/cli/speed.cpp +++ b/src/cli/speed.cpp @@ -81,6 +81,10 @@ #include <botan/compression.h> #endif +#if defined(BOTAN_HAS_POLY_DBL) + #include <botan/internal/poly_dbl.h> +#endif + #if defined(BOTAN_HAS_PUBLIC_KEY_CRYPTO) #include <botan/pkcs8.h> #include <botan/pubkey.h> @@ -668,6 +672,12 @@ class Speed final : public Command bench_passhash9(); } #endif +#if defined(BOTAN_HAS_POLY_DBL) + else if(algo == "poly_dbl") + { + bench_poly_dbl(msec); + } +#endif #if defined(BOTAN_HAS_DL_GROUP) else if(algo == "modexp") @@ -2111,6 +2121,26 @@ class Speed final : public Command } #endif +#if defined(BOTAN_HAS_POLY_DBL) + void bench_poly_dbl(std::chrono::milliseconds msec) + { + for(size_t sz : { 8, 16, 24, 32, 64, 128 }) + { + std::unique_ptr<Timer> be_timer = make_timer("poly_dbl_be_" + std::to_string(sz)); + std::unique_ptr<Timer> le_timer = make_timer("poly_dbl_le_" + std::to_string(sz)); + + std::vector<uint8_t> buf(sz); + rng().randomize(buf.data(), sz); + + be_timer->run_until_elapsed(msec, [&]() { Botan::poly_double_n(buf.data(), buf.data(), sz); }); + le_timer->run_until_elapsed(msec, [&]() { Botan::poly_double_n_le(buf.data(), buf.data(), sz); }); + + record_result(be_timer); + record_result(le_timer); + } + } +#endif + #if defined(BOTAN_HAS_BCRYPT) void bench_bcrypt() |