Skip to content

Commit

Permalink
Merge pull request wolfSSL#8172 from SparkiDev/kyber_bench_fix
Browse files Browse the repository at this point in the history
Kyber benchmark: allow ML-KEM and Kyber
  • Loading branch information
douzzer authored Nov 12, 2024
2 parents 4996aed + cadafff commit c5f1acf
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions wolfcrypt/benchmark/benchmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -3652,6 +3652,24 @@ static void* benchmarks_do(void* args)

#ifdef WOLFSSL_HAVE_KYBER
if (bench_all || (bench_pq_asym_algs & BENCH_KYBER)) {
#ifndef WOLFSSL_NO_ML_KEM
#ifdef WOLFSSL_KYBER512
if (bench_all || (bench_pq_asym_algs & BENCH_KYBER512)) {
bench_kyber(WC_ML_KEM_512);
}
#endif
#ifdef WOLFSSL_KYBER768
if (bench_all || (bench_pq_asym_algs & BENCH_KYBER768)) {
bench_kyber(WC_ML_KEM_768);
}
#endif
#ifdef WOLFSSL_KYBER1024
if (bench_all || (bench_pq_asym_algs & BENCH_KYBER1024)) {
bench_kyber(WC_ML_KEM_1024);
}
#endif
#endif
#ifdef WOLFSSL_KYBER_ORIGINAL
#ifdef WOLFSSL_KYBER512
if (bench_all || (bench_pq_asym_algs & BENCH_KYBER512)) {
bench_kyber(KYBER512);
Expand All @@ -3667,6 +3685,7 @@ static void* benchmarks_do(void* args)
bench_kyber(KYBER1024);
}
#endif
#endif
}
#endif

Expand Down Expand Up @@ -9471,6 +9490,27 @@ void bench_kyber(int type)
int keySize = 0;

switch (type) {
#ifndef WOLFSSL_NO_ML_KEM
#ifdef WOLFSSL_WC_ML_KEM_512
case WC_ML_KEM_512:
name = "ML-KEM 512 ";
keySize = 128;
break;
#endif
#ifdef WOLFSSL_WC_ML_KEM_768
case WC_ML_KEM_768:
name = "ML-KEM 768 ";
keySize = 192;
break;
#endif
#ifdef WOLFSSL_WC_ML_KEM_1024
case WC_ML_KEM_1024:
name = "ML-KEM 1024 ";
keySize = 256;
break;
#endif
#endif
#ifdef WOLFSSL_KYBER_ORIGINAL
#ifdef WOLFSSL_KYBER512
case KYBER512:
name = "KYBER512 ";
Expand All @@ -9488,6 +9528,7 @@ void bench_kyber(int type)
name = "KYBER1024";
keySize = 256;
break;
#endif
#endif
}

Expand Down

0 comments on commit c5f1acf

Please sign in to comment.