Skip to content

Commit

Permalink
Add LMS/HSS to speed CI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
FAlbertDev committed Oct 12, 2023
1 parent b8663c1 commit 414800f
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/cli/speed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@
#include <botan/dilithium.h>
#endif

#if defined(BOTAN_HAS_HSS_LMS)
#include <botan/hss_lms.h>
#endif

#if defined(BOTAN_HAS_SPHINCS_PLUS_WITH_SHA2) || defined(BOTAN_HAS_SPHINCS_PLUS_WITH_SHAKE)
#include <botan/sphincsplus.h>
#endif
Expand Down Expand Up @@ -609,6 +613,11 @@ class Speed final : public Command {
bench_xmss(provider, msec);
}
#endif
#if defined(BOTAN_HAS_HSS_LMS)
else if(algo == "HSS-LMS") {
bench_hss_lms(provider, msec);
}
#endif
#if defined(BOTAN_HAS_SPHINCS_PLUS_WITH_SHA2) || defined(BOTAN_HAS_SPHINCS_PLUS_WITH_SHAKE)
else if(algo == "SPHINCS+") {
bench_sphincs_plus(provider, msec);
Expand Down Expand Up @@ -2065,6 +2074,33 @@ class Speed final : public Command {
}
#endif

#if defined(BOTAN_HAS_HSS_LMS)
void bench_hss_lms(const std::string& provider, std::chrono::milliseconds msec) {
// At first we compare instances with multiple hash functions. LMS trees with
// height 10 are suitable, since they can be used for enough signatures and are
// fast enough for speed testing.
// Afterward, setups with multiple HSS layers are tested
std::vector<std::string> hss_lms_instances{"SHA-256,HW(10,1)",
"SHAKE-256(256),HW(10,1)",
"SHAKE-256(192),HW(10,1)",
"Truncated(SHA-256,192),HW(10,1)",
"SHA-256,HW(10,1),HW(10,1)",
"SHA-256,HW(10,1),HW(10,1),HW(10,1)"};

for(auto params : hss_lms_instances) {
auto keygen_timer = make_timer(params, provider, "keygen");

std::unique_ptr<Botan::Private_Key> key(
keygen_timer->run([&] { return Botan::create_private_key("HSS-LMS", rng(), params); }));

record_result(keygen_timer);
if(bench_pk_sig(*key, params, provider, "", msec) == 1) {
break;
}
}
}
#endif

#if defined(BOTAN_HAS_ZFEC)
void bench_zfec(std::chrono::milliseconds msec) {
const size_t k = 4;
Expand Down

0 comments on commit 414800f

Please sign in to comment.