Skip to content

Commit

Permalink
Dilithium: add implementation of signing that allocated less
Browse files Browse the repository at this point in the history
Added implementation of signing that allocates less memory by doing the
matrix/vector loops in the sign code - WOLFSSL_DILITHIUM_SIGN_SMALL_MEM.
Split out vector operations into vector and polynomial operations so
that small mem signing can call them.
Fix benchmark to be able to compile with only Dilithium and no
asymmetric algorithms.
  • Loading branch information
SparkiDev committed Jul 5, 2024
1 parent e6fbe25 commit 44a5e1a
Show file tree
Hide file tree
Showing 2 changed files with 1,094 additions and 394 deletions.
8 changes: 4 additions & 4 deletions wolfcrypt/benchmark/benchmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -1226,7 +1226,7 @@ static const char* bench_result_words1[][4] = {
defined(HAVE_CURVE25519) || defined(HAVE_CURVE25519_SHARED_SECRET) || \
defined(HAVE_ED25519) || defined(HAVE_CURVE448) || \
defined(HAVE_CURVE448_SHARED_SECRET) || defined(HAVE_ED448) || \
defined(WOLFSSL_HAVE_KYBER)
defined(WOLFSSL_HAVE_KYBER) || defined(HAVE_DILITHIUM)

static const char* bench_desc_words[][15] = {
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 */
Expand Down Expand Up @@ -1692,15 +1692,15 @@ static const char* bench_result_words3[][5] = {
defined(HAVE_CURVE448) || defined(HAVE_ED448) || \
defined(HAVE_ECC) || !defined(NO_DH) || \
!defined(NO_RSA) || defined(HAVE_SCRYPT) || \
defined(WOLFSSL_HAVE_KYBER)
defined(WOLFSSL_HAVE_KYBER) || defined(HAVE_DILITHIUM)
#define BENCH_ASYM
#endif

#if defined(BENCH_ASYM)
#if defined(HAVE_ECC) || !defined(NO_RSA) || !defined(NO_DH) || \
defined(HAVE_CURVE25519) || defined(HAVE_ED25519) || \
defined(HAVE_CURVE448) || defined(HAVE_ED448) || \
defined(WOLFSSL_HAVE_KYBER)
defined(WOLFSSL_HAVE_KYBER) || defined(HAVE_DILITHIUM)
static const char* bench_result_words2[][5] = {
#ifdef BENCH_MICROSECOND
{ "ops took", "μsec" , "avg" , "ops/μsec", NULL }, /* 0 English
Expand Down Expand Up @@ -2654,7 +2654,7 @@ static void bench_stats_sym_finish(const char* desc, int useDeviceID,
#if defined(HAVE_ECC) || !defined(NO_RSA) || !defined(NO_DH) || \
defined(HAVE_CURVE25519) || defined(HAVE_ED25519) || \
defined(HAVE_CURVE448) || defined(HAVE_ED448) || \
defined(WOLFSSL_HAVE_KYBER)
defined(WOLFSSL_HAVE_KYBER) || defined(HAVE_DILITHIUM)
static void bench_stats_asym_finish_ex(const char* algo, int strength,
const char* desc, const char* desc_extra, int useDeviceID, int count,
double start, int ret)
Expand Down
Loading

0 comments on commit 44a5e1a

Please sign in to comment.