Skip to content

Commit

Permalink
Merge pull request #15 from itzmeanjan/update-readme
Browse files Browse the repository at this point in the history
Reflect latest state of project on README
  • Loading branch information
itzmeanjan authored Dec 16, 2023
2 parents 3dcb256 + c5e7099 commit 9b53454
Show file tree
Hide file tree
Showing 44 changed files with 1,503 additions and 654 deletions.
376 changes: 281 additions & 95 deletions README.md

Large diffs are not rendered by default.

107 changes: 79 additions & 28 deletions benchmarks/bench_sphincs+.hpp
Original file line number Diff line number Diff line change
@@ -1,52 +1,65 @@
#pragma once
#include "sphincs.hpp"
#include "sphincs+.hpp"
#include "x86_64_cpu_cycles.hpp"
#include <benchmark/benchmark.h>
#include <cassert>

// Benchmark SPHINCS+ Routines
namespace bench_sphincs {
namespace bench_sphincs_plus {

// Benchmark SPHINCS+ keypair generation
template<const size_t n, const uint32_t h, const uint32_t d, const size_t w, const sphincs_hashing::variant v>
template<const size_t n, const uint32_t h, const uint32_t d, const size_t w, const sphincs_plus_hashing::variant v>
static inline void
keygen(benchmark::State& state)
{
namespace utils = sphincs_utils;
namespace utils = sphincs_plus_utils;
constexpr size_t pklen = utils::get_sphincs_pkey_len<n>();
constexpr size_t sklen = utils::get_sphincs_skey_len<n>();

uint8_t* sk_seed = static_cast<uint8_t*>(std::malloc(n));
uint8_t* sk_prf = static_cast<uint8_t*>(std::malloc(n));
uint8_t* pk_seed = static_cast<uint8_t*>(std::malloc(n));
uint8_t* pkey = static_cast<uint8_t*>(std::malloc(pklen));
uint8_t* skey = static_cast<uint8_t*>(std::malloc(sklen));

#if defined __x86_64__
sphincs_plus_utils::random_data<uint8_t>(sk_seed, n);
sphincs_plus_utils::random_data<uint8_t>(sk_prf, n);
sphincs_plus_utils::random_data<uint8_t>(pk_seed, n);

#ifdef __x86_64__
uint64_t total_cycles = 0ul;
#endif

for (auto _ : state) {
#if defined __x86_64__
#ifdef __x86_64__
const uint64_t start = cpu_cycles();
#endif

sphincs::keygen<n, h, d, w, v>(skey, pkey);
sphincs_plus::keygen<n, h, d, w, v>(sk_seed, sk_prf, pk_seed, skey, pkey);

benchmark::DoNotOptimize(sk_seed);
benchmark::DoNotOptimize(sk_prf);
benchmark::DoNotOptimize(pk_seed);
benchmark::DoNotOptimize(skey);
benchmark::DoNotOptimize(pkey);
benchmark::ClobberMemory();

#if defined __x86_64__
#ifdef __x86_64__
const uint64_t end = cpu_cycles();
total_cycles += (end - start);
#endif
}

state.SetItemsProcessed(state.iterations());

#if defined __x86_64__
#ifdef __x86_64__
total_cycles /= static_cast<uint64_t>(state.iterations());
state.counters["average_cpu_cycles"] = static_cast<double>(total_cycles);
#endif

std::free(sk_seed);
std::free(sk_prf);
std::free(pk_seed);
std::free(pkey);
std::free(skey);
}
Expand All @@ -58,57 +71,78 @@ template<const size_t n,
const uint32_t a,
const uint32_t k,
const size_t w,
const sphincs_hashing::variant v,
const sphincs_plus_hashing::variant v,
const bool randomize = false>
static inline void
sign(benchmark::State& state)
{
namespace utils = sphincs_utils;
namespace utils = sphincs_plus_utils;
constexpr size_t pklen = utils::get_sphincs_pkey_len<n>();
constexpr size_t sklen = utils::get_sphincs_skey_len<n>();
constexpr size_t siglen = utils::get_sphincs_sig_len<n, h, d, a, k, w>();
constexpr size_t mlen = 32;

uint8_t* sk_seed = static_cast<uint8_t*>(std::malloc(n));
uint8_t* sk_prf = static_cast<uint8_t*>(std::malloc(n));
uint8_t* pk_seed = static_cast<uint8_t*>(std::malloc(n));
uint8_t* pkey = static_cast<uint8_t*>(std::malloc(pklen));
uint8_t* skey = static_cast<uint8_t*>(std::malloc(sklen));
uint8_t* msg = static_cast<uint8_t*>(std::malloc(mlen));
uint8_t* rand_bytes = static_cast<uint8_t*>(std::malloc(n));
uint8_t* sig = static_cast<uint8_t*>(std::malloc(siglen));

sphincs_utils::random_data<uint8_t>(msg, mlen);
sphincs::keygen<n, h, d, w, v>(skey, pkey);
sphincs_plus_utils::random_data<uint8_t>(sk_seed, n);
sphincs_plus_utils::random_data<uint8_t>(sk_prf, n);
sphincs_plus_utils::random_data<uint8_t>(pk_seed, n);

sphincs_plus::keygen<n, h, d, w, v>(sk_seed, sk_prf, pk_seed, skey, pkey);

#if defined __x86_64__
sphincs_plus_utils::random_data<uint8_t>(msg, mlen);
sphincs_plus_utils::random_data<uint8_t>(rand_bytes, n);

#ifdef __x86_64__
uint64_t total_cycles = 0ul;
#endif

for (auto _ : state) {
#if defined __x86_64__
#ifdef __x86_64__
const uint64_t start = cpu_cycles();
#endif

sphincs::sign<n, h, d, a, k, w, v, randomize>(msg, mlen, skey, sig);
if constexpr (randomize) {
sphincs_plus::sign<n, h, d, a, k, w, v, randomize>(msg, mlen, skey, rand_bytes, sig);
} else {
sphincs_plus::sign<n, h, d, a, k, w, v, randomize>(msg, mlen, skey, nullptr, sig);
}

benchmark::DoNotOptimize(msg);
benchmark::DoNotOptimize(skey);
if constexpr (randomize) {
benchmark::DoNotOptimize(rand_bytes);
}
benchmark::DoNotOptimize(sig);
benchmark::ClobberMemory();

#if defined __x86_64__
#ifdef __x86_64__
const uint64_t end = cpu_cycles();
total_cycles += (end - start);
#endif
}

state.SetItemsProcessed(state.iterations());

#if defined __x86_64__
#ifdef __x86_64__
total_cycles /= static_cast<uint64_t>(state.iterations());
state.counters["average_cpu_cycles"] = static_cast<double>(total_cycles);
#endif

std::free(sk_seed);
std::free(sk_prf);
std::free(pk_seed);
std::free(pkey);
std::free(skey);
std::free(msg);
std::free(rand_bytes);
std::free(sig);
}

Expand All @@ -119,45 +153,58 @@ template<const size_t n,
const uint32_t a,
const uint32_t k,
const size_t w,
const sphincs_hashing::variant v,
const sphincs_plus_hashing::variant v,
const bool randomize = false>
static inline void
verify(benchmark::State& state)
{
namespace utils = sphincs_utils;
namespace utils = sphincs_plus_utils;
constexpr size_t pklen = utils::get_sphincs_pkey_len<n>();
constexpr size_t sklen = utils::get_sphincs_skey_len<n>();
constexpr size_t siglen = utils::get_sphincs_sig_len<n, h, d, a, k, w>();
constexpr size_t mlen = 32;

uint8_t* sk_seed = static_cast<uint8_t*>(std::malloc(n));
uint8_t* sk_prf = static_cast<uint8_t*>(std::malloc(n));
uint8_t* pk_seed = static_cast<uint8_t*>(std::malloc(n));
uint8_t* pkey = static_cast<uint8_t*>(std::malloc(pklen));
uint8_t* skey = static_cast<uint8_t*>(std::malloc(sklen));
uint8_t* msg = static_cast<uint8_t*>(std::malloc(mlen));
uint8_t* rand_bytes = static_cast<uint8_t*>(std::malloc(n));
uint8_t* sig = static_cast<uint8_t*>(std::malloc(siglen));

sphincs_utils::random_data<uint8_t>(msg, mlen);
sphincs::keygen<n, h, d, w, v>(skey, pkey);
sphincs::sign<n, h, d, a, k, w, v, randomize>(msg, mlen, skey, sig);
sphincs_plus_utils::random_data<uint8_t>(sk_seed, n);
sphincs_plus_utils::random_data<uint8_t>(sk_prf, n);
sphincs_plus_utils::random_data<uint8_t>(pk_seed, n);
sphincs_plus_utils::random_data<uint8_t>(msg, mlen);
sphincs_plus_utils::random_data<uint8_t>(rand_bytes, n);

sphincs_plus::keygen<n, h, d, w, v>(sk_seed, sk_prf, pk_seed, skey, pkey);
if constexpr (randomize) {
sphincs_plus::sign<n, h, d, a, k, w, v, randomize>(msg, mlen, skey, rand_bytes, sig);
} else {
sphincs_plus::sign<n, h, d, a, k, w, v, randomize>(msg, mlen, skey, nullptr, sig);
}

#if defined __x86_64__
#ifdef __x86_64__
uint64_t total_cycles = 0ul;
#endif

bool flag = true;
for (auto _ : state) {
#if defined __x86_64__
#ifdef __x86_64__
const uint64_t start = cpu_cycles();
#endif

flag &= sphincs::verify<n, h, d, a, k, w, v>(msg, mlen, sig, pkey);
flag &= sphincs_plus::verify<n, h, d, a, k, w, v>(msg, mlen, sig, pkey);

benchmark::DoNotOptimize(flag);
benchmark::DoNotOptimize(msg);
benchmark::DoNotOptimize(sig);
benchmark::DoNotOptimize(pkey);
benchmark::ClobberMemory();

#if defined __x86_64__
#ifdef __x86_64__
const uint64_t end = cpu_cycles();
total_cycles += (end - start);
#endif
Expand All @@ -166,14 +213,18 @@ verify(benchmark::State& state)
assert(flag);
state.SetItemsProcessed(state.iterations());

#if defined __x86_64__
#ifdef __x86_64__
total_cycles /= static_cast<uint64_t>(state.iterations());
state.counters["average_cpu_cycles"] = static_cast<double>(total_cycles);
#endif

std::free(sk_seed);
std::free(sk_prf);
std::free(pk_seed);
std::free(pkey);
std::free(skey);
std::free(msg);
std::free(rand_bytes);
std::free(sig);
}

Expand Down
6 changes: 3 additions & 3 deletions benchmarks/bench_sphincs+_128f_robust.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "bench_sphincs+.hpp"

BENCHMARK(bench_sphincs::keygen<16, 66, 22, 16, sphincs_hashing::variant::robust>)->Name("sphincs+-128f-robust/keygen");
BENCHMARK(bench_sphincs::sign<16, 66, 22, 6, 33, 16, sphincs_hashing::variant::robust>)->Name("sphincs+-128f-robust/sign");
BENCHMARK(bench_sphincs::verify<16, 66, 22, 6, 33, 16, sphincs_hashing::variant::robust>)->Name("sphincs+-128f-robust/verify");
BENCHMARK(bench_sphincs_plus::keygen<16, 66, 22, 16, sphincs_plus_hashing::variant::robust>)->Name("sphincs+-128f-robust/keygen");
BENCHMARK(bench_sphincs_plus::sign<16, 66, 22, 6, 33, 16, sphincs_plus_hashing::variant::robust>)->Name("sphincs+-128f-robust/sign");
BENCHMARK(bench_sphincs_plus::verify<16, 66, 22, 6, 33, 16, sphincs_plus_hashing::variant::robust>)->Name("sphincs+-128f-robust/verify");
6 changes: 3 additions & 3 deletions benchmarks/bench_sphincs+_128f_simple.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "bench_sphincs+.hpp"

BENCHMARK(bench_sphincs::keygen<16, 66, 22, 16, sphincs_hashing::variant::simple>)->Name("sphincs+-128f-simple/keygen");
BENCHMARK(bench_sphincs::sign<16, 66, 22, 6, 33, 16, sphincs_hashing::variant::simple>)->Name("sphincs+-128f-simple/sign");
BENCHMARK(bench_sphincs::verify<16, 66, 22, 6, 33, 16, sphincs_hashing::variant::simple>)->Name("sphincs+-128f-simple/verify");
BENCHMARK(bench_sphincs_plus::keygen<16, 66, 22, 16, sphincs_plus_hashing::variant::simple>)->Name("sphincs+-128f-simple/keygen");
BENCHMARK(bench_sphincs_plus::sign<16, 66, 22, 6, 33, 16, sphincs_plus_hashing::variant::simple>)->Name("sphincs+-128f-simple/sign");
BENCHMARK(bench_sphincs_plus::verify<16, 66, 22, 6, 33, 16, sphincs_plus_hashing::variant::simple>)->Name("sphincs+-128f-simple/verify");
6 changes: 3 additions & 3 deletions benchmarks/bench_sphincs+_128s_robust.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "bench_sphincs+.hpp"

BENCHMARK(bench_sphincs::keygen<16, 63, 7, 16, sphincs_hashing::variant::robust>)->Name("sphincs+-128s-robust/keygen");
BENCHMARK(bench_sphincs::sign<16, 63, 7, 12, 14, 16, sphincs_hashing::variant::robust>)->Name("sphincs+-128s-robust/sign");
BENCHMARK(bench_sphincs::verify<16, 63, 7, 12, 14, 16, sphincs_hashing::variant::robust>)->Name("sphincs+-128s-robust/verify");
BENCHMARK(bench_sphincs_plus::keygen<16, 63, 7, 16, sphincs_plus_hashing::variant::robust>)->Name("sphincs+-128s-robust/keygen");
BENCHMARK(bench_sphincs_plus::sign<16, 63, 7, 12, 14, 16, sphincs_plus_hashing::variant::robust>)->Name("sphincs+-128s-robust/sign");
BENCHMARK(bench_sphincs_plus::verify<16, 63, 7, 12, 14, 16, sphincs_plus_hashing::variant::robust>)->Name("sphincs+-128s-robust/verify");
6 changes: 3 additions & 3 deletions benchmarks/bench_sphincs+_128s_simple.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "bench_sphincs+.hpp"

BENCHMARK(bench_sphincs::keygen<16, 63, 7, 16, sphincs_hashing::variant::simple>)->Name("sphincs+-128s-simple/keygen");
BENCHMARK(bench_sphincs::sign<16, 63, 7, 12, 14, 16, sphincs_hashing::variant::simple>)->Name("sphincs+-128s-simple/sign");
BENCHMARK(bench_sphincs::verify<16, 63, 7, 12, 14, 16, sphincs_hashing::variant::simple>)->Name("sphincs+-128s-simple/verify");
BENCHMARK(bench_sphincs_plus::keygen<16, 63, 7, 16, sphincs_plus_hashing::variant::simple>)->Name("sphincs+-128s-simple/keygen");
BENCHMARK(bench_sphincs_plus::sign<16, 63, 7, 12, 14, 16, sphincs_plus_hashing::variant::simple>)->Name("sphincs+-128s-simple/sign");
BENCHMARK(bench_sphincs_plus::verify<16, 63, 7, 12, 14, 16, sphincs_plus_hashing::variant::simple>)->Name("sphincs+-128s-simple/verify");
6 changes: 3 additions & 3 deletions benchmarks/bench_sphincs+_192f_robust.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "bench_sphincs+.hpp"

BENCHMARK(bench_sphincs::keygen<24, 66, 22, 16, sphincs_hashing::variant::robust>)->Name("sphincs+-192f-robust/keygen");
BENCHMARK(bench_sphincs::sign<24, 66, 22, 8, 33, 16, sphincs_hashing::variant::robust>)->Name("sphincs+-192f-robust/sign");
BENCHMARK(bench_sphincs::verify<24, 66, 22, 8, 33, 16, sphincs_hashing::variant::robust>)->Name("sphincs+-192f-robust/verify");
BENCHMARK(bench_sphincs_plus::keygen<24, 66, 22, 16, sphincs_plus_hashing::variant::robust>)->Name("sphincs+-192f-robust/keygen");
BENCHMARK(bench_sphincs_plus::sign<24, 66, 22, 8, 33, 16, sphincs_plus_hashing::variant::robust>)->Name("sphincs+-192f-robust/sign");
BENCHMARK(bench_sphincs_plus::verify<24, 66, 22, 8, 33, 16, sphincs_plus_hashing::variant::robust>)->Name("sphincs+-192f-robust/verify");
6 changes: 3 additions & 3 deletions benchmarks/bench_sphincs+_192f_simple.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "bench_sphincs+.hpp"

BENCHMARK(bench_sphincs::keygen<24, 66, 22, 16, sphincs_hashing::variant::simple>)->Name("sphincs+-192f-simple/keygen");
BENCHMARK(bench_sphincs::sign<24, 66, 22, 8, 33, 16, sphincs_hashing::variant::simple>)->Name("sphincs+-192f-simple/sign");
BENCHMARK(bench_sphincs::verify<24, 66, 22, 8, 33, 16, sphincs_hashing::variant::simple>)->Name("sphincs+-192f-simple/verify");
BENCHMARK(bench_sphincs_plus::keygen<24, 66, 22, 16, sphincs_plus_hashing::variant::simple>)->Name("sphincs+-192f-simple/keygen");
BENCHMARK(bench_sphincs_plus::sign<24, 66, 22, 8, 33, 16, sphincs_plus_hashing::variant::simple>)->Name("sphincs+-192f-simple/sign");
BENCHMARK(bench_sphincs_plus::verify<24, 66, 22, 8, 33, 16, sphincs_plus_hashing::variant::simple>)->Name("sphincs+-192f-simple/verify");
6 changes: 3 additions & 3 deletions benchmarks/bench_sphincs+_192s_robust.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "bench_sphincs+.hpp"

BENCHMARK(bench_sphincs::keygen<24, 63, 7, 16, sphincs_hashing::variant::robust>)->Name("sphincs+-192s-robust/keygen");
BENCHMARK(bench_sphincs::sign<24, 63, 7, 14, 17, 16, sphincs_hashing::variant::robust>)->Name("sphincs+-192s-robust/sign");
BENCHMARK(bench_sphincs::verify<24, 63, 7, 14, 17, 16, sphincs_hashing::variant::robust>)->Name("sphincs+-192s-robust/verify");
BENCHMARK(bench_sphincs_plus::keygen<24, 63, 7, 16, sphincs_plus_hashing::variant::robust>)->Name("sphincs+-192s-robust/keygen");
BENCHMARK(bench_sphincs_plus::sign<24, 63, 7, 14, 17, 16, sphincs_plus_hashing::variant::robust>)->Name("sphincs+-192s-robust/sign");
BENCHMARK(bench_sphincs_plus::verify<24, 63, 7, 14, 17, 16, sphincs_plus_hashing::variant::robust>)->Name("sphincs+-192s-robust/verify");
6 changes: 3 additions & 3 deletions benchmarks/bench_sphincs+_192s_simple.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "bench_sphincs+.hpp"

BENCHMARK(bench_sphincs::keygen<24, 63, 7, 16, sphincs_hashing::variant::simple>)->Name("sphincs+-192s-simple/keygen");
BENCHMARK(bench_sphincs::sign<24, 63, 7, 14, 17, 16, sphincs_hashing::variant::simple>)->Name("sphincs+-192s-simple/sign");
BENCHMARK(bench_sphincs::verify<24, 63, 7, 14, 17, 16, sphincs_hashing::variant::simple>)->Name("sphincs+-192s-simple/verify");
BENCHMARK(bench_sphincs_plus::keygen<24, 63, 7, 16, sphincs_plus_hashing::variant::simple>)->Name("sphincs+-192s-simple/keygen");
BENCHMARK(bench_sphincs_plus::sign<24, 63, 7, 14, 17, 16, sphincs_plus_hashing::variant::simple>)->Name("sphincs+-192s-simple/sign");
BENCHMARK(bench_sphincs_plus::verify<24, 63, 7, 14, 17, 16, sphincs_plus_hashing::variant::simple>)->Name("sphincs+-192s-simple/verify");
6 changes: 3 additions & 3 deletions benchmarks/bench_sphincs+_256f_robust.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "bench_sphincs+.hpp"

BENCHMARK(bench_sphincs::keygen<32, 68, 17, 16, sphincs_hashing::variant::robust>)->Name("sphincs+-256f-robust/keygen");
BENCHMARK(bench_sphincs::sign<32, 68, 17, 9, 35, 16, sphincs_hashing::variant::robust>)->Name("sphincs+-256f-robust/sign");
BENCHMARK(bench_sphincs::verify<32, 68, 17, 9, 35, 16, sphincs_hashing::variant::robust>)->Name("sphincs+-256f-robust/verify");
BENCHMARK(bench_sphincs_plus::keygen<32, 68, 17, 16, sphincs_plus_hashing::variant::robust>)->Name("sphincs+-256f-robust/keygen");
BENCHMARK(bench_sphincs_plus::sign<32, 68, 17, 9, 35, 16, sphincs_plus_hashing::variant::robust>)->Name("sphincs+-256f-robust/sign");
BENCHMARK(bench_sphincs_plus::verify<32, 68, 17, 9, 35, 16, sphincs_plus_hashing::variant::robust>)->Name("sphincs+-256f-robust/verify");
6 changes: 3 additions & 3 deletions benchmarks/bench_sphincs+_256f_simple.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "bench_sphincs+.hpp"

BENCHMARK(bench_sphincs::keygen<32, 68, 17, 16, sphincs_hashing::variant::simple>)->Name("sphincs+-256f-simple/keygen");
BENCHMARK(bench_sphincs::sign<32, 68, 17, 9, 35, 16, sphincs_hashing::variant::simple>)->Name("sphincs+-256f-simple/sign");
BENCHMARK(bench_sphincs::verify<32, 68, 17, 9, 35, 16, sphincs_hashing::variant::simple>)->Name("sphincs+-256f-simple/verify");
BENCHMARK(bench_sphincs_plus::keygen<32, 68, 17, 16, sphincs_plus_hashing::variant::simple>)->Name("sphincs+-256f-simple/keygen");
BENCHMARK(bench_sphincs_plus::sign<32, 68, 17, 9, 35, 16, sphincs_plus_hashing::variant::simple>)->Name("sphincs+-256f-simple/sign");
BENCHMARK(bench_sphincs_plus::verify<32, 68, 17, 9, 35, 16, sphincs_plus_hashing::variant::simple>)->Name("sphincs+-256f-simple/verify");
6 changes: 3 additions & 3 deletions benchmarks/bench_sphincs+_256s_robust.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "bench_sphincs+.hpp"

BENCHMARK(bench_sphincs::keygen<32, 64, 8, 16, sphincs_hashing::variant::robust>)->Name("sphincs+-256s-robust/keygen");
BENCHMARK(bench_sphincs::sign<32, 64, 8, 14, 22, 16, sphincs_hashing::variant::robust>)->Name("sphincs+-256s-robust/sign");
BENCHMARK(bench_sphincs::verify<32, 64, 8, 14, 22, 16, sphincs_hashing::variant::robust>)->Name("sphincs+-256s-robust/verify");
BENCHMARK(bench_sphincs_plus::keygen<32, 64, 8, 16, sphincs_plus_hashing::variant::robust>)->Name("sphincs+-256s-robust/keygen");
BENCHMARK(bench_sphincs_plus::sign<32, 64, 8, 14, 22, 16, sphincs_plus_hashing::variant::robust>)->Name("sphincs+-256s-robust/sign");
BENCHMARK(bench_sphincs_plus::verify<32, 64, 8, 14, 22, 16, sphincs_plus_hashing::variant::robust>)->Name("sphincs+-256s-robust/verify");
6 changes: 3 additions & 3 deletions benchmarks/bench_sphincs+_256s_simple.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "bench_sphincs+.hpp"

BENCHMARK(bench_sphincs::keygen<32, 64, 8, 16, sphincs_hashing::variant::simple>)->Name("sphincs+-256s-simple/keygen");
BENCHMARK(bench_sphincs::sign<32, 64, 8, 14, 22, 16, sphincs_hashing::variant::simple>)->Name("sphincs+-256s-simple/sign");
BENCHMARK(bench_sphincs::verify<32, 64, 8, 14, 22, 16, sphincs_hashing::variant::simple>)->Name("sphincs+-256s-simple/verify");
BENCHMARK(bench_sphincs_plus::keygen<32, 64, 8, 16, sphincs_plus_hashing::variant::simple>)->Name("sphincs+-256s-simple/keygen");
BENCHMARK(bench_sphincs_plus::sign<32, 64, 8, 14, 22, 16, sphincs_plus_hashing::variant::simple>)->Name("sphincs+-256s-simple/sign");
BENCHMARK(bench_sphincs_plus::verify<32, 64, 8, 14, 22, 16, sphincs_plus_hashing::variant::simple>)->Name("sphincs+-256s-simple/verify");
9 changes: 5 additions & 4 deletions benchmarks/x86_64_cpu_cycles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@
#include <emmintrin.h>
#include <x86intrin.h>

// x86_64 architecture specific compiler built-in routine for computing CPU
// cycles spent executing some instructions. For example
// x86_64 architecture specific intrinsic for computing CPU cycles ( more specifically ticks ) spent executing a set of instructions. For example
//
// start = cpu_cycles()
// {
// ... bunch of instructions ...
// ... bunch
// ... of
// ... instructions
// }
// end = cpu_cycles()
//
// CPU cycles spent executing code block = end - start
// CPU cycles spent executing above code block = end - start
static inline uint64_t
cpu_cycles()
{
Expand Down
Loading

0 comments on commit 9b53454

Please sign in to comment.