Skip to content

Commit 44a5e1a

Browse files
committed
Dilithium: add implementation of signing that allocated less
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.
1 parent e6fbe25 commit 44a5e1a

File tree

2 files changed

+1094
-394
lines changed

2 files changed

+1094
-394
lines changed

wolfcrypt/benchmark/benchmark.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,7 +1226,7 @@ static const char* bench_result_words1[][4] = {
12261226
defined(HAVE_CURVE25519) || defined(HAVE_CURVE25519_SHARED_SECRET) || \
12271227
defined(HAVE_ED25519) || defined(HAVE_CURVE448) || \
12281228
defined(HAVE_CURVE448_SHARED_SECRET) || defined(HAVE_ED448) || \
1229-
defined(WOLFSSL_HAVE_KYBER)
1229+
defined(WOLFSSL_HAVE_KYBER) || defined(HAVE_DILITHIUM)
12301230

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

16991699
#if defined(BENCH_ASYM)
17001700
#if defined(HAVE_ECC) || !defined(NO_RSA) || !defined(NO_DH) || \
17011701
defined(HAVE_CURVE25519) || defined(HAVE_ED25519) || \
17021702
defined(HAVE_CURVE448) || defined(HAVE_ED448) || \
1703-
defined(WOLFSSL_HAVE_KYBER)
1703+
defined(WOLFSSL_HAVE_KYBER) || defined(HAVE_DILITHIUM)
17041704
static const char* bench_result_words2[][5] = {
17051705
#ifdef BENCH_MICROSECOND
17061706
{ "ops took", "μsec" , "avg" , "ops/μsec", NULL }, /* 0 English
@@ -2654,7 +2654,7 @@ static void bench_stats_sym_finish(const char* desc, int useDeviceID,
26542654
#if defined(HAVE_ECC) || !defined(NO_RSA) || !defined(NO_DH) || \
26552655
defined(HAVE_CURVE25519) || defined(HAVE_ED25519) || \
26562656
defined(HAVE_CURVE448) || defined(HAVE_ED448) || \
2657-
defined(WOLFSSL_HAVE_KYBER)
2657+
defined(WOLFSSL_HAVE_KYBER) || defined(HAVE_DILITHIUM)
26582658
static void bench_stats_asym_finish_ex(const char* algo, int strength,
26592659
const char* desc, const char* desc_extra, int useDeviceID, int count,
26602660
double start, int ret)

0 commit comments

Comments
 (0)