[PATCH 1/8] tests/benchmark: add benchmark for Ed448
Jussi Kivilinna
jussi.kivilinna at iki.fi
Mon Apr 26 23:00:39 CEST 2021
* tests/benchmark.c (ecc_bench): Add Ed448.
--
Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>
---
tests/benchmark.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/tests/benchmark.c b/tests/benchmark.c
index 5963527e..605b50c6 100644
--- a/tests/benchmark.c
+++ b/tests/benchmark.c
@@ -1475,7 +1475,7 @@ ecc_bench (int iterations, int print_header)
{
#if USE_ECC
gpg_error_t err;
- const char *p_sizes[] = { "192", "224", "256", "384", "521", "Ed25519",
+ const char *p_sizes[] = { "192", "224", "256", "384", "521", "Ed25519", "Ed448",
"gost256", "gost512" };
int testno;
@@ -1492,14 +1492,17 @@ ecc_bench (int iterations, int print_header)
int count;
int p_size;
int is_ed25519;
+ int is_ed448;
int is_gost;
is_ed25519 = !strcmp (p_sizes[testno], "Ed25519");
+ is_ed448 = !strcmp (p_sizes[testno], "Ed448");
is_gost = !strncmp (p_sizes[testno], "gost", 4);
/* Only P-{224,256,384,521} are allowed in fips mode */
if (gcry_fips_mode_active()
- && (is_ed25519 || is_gost || !strcmp (p_sizes[testno], "192")))
+ && (is_ed25519 || is_ed448 || is_gost
+ || !strcmp (p_sizes[testno], "192")))
continue;
if (is_ed25519)
@@ -1508,6 +1511,12 @@ ecc_bench (int iterations, int print_header)
printf ("EdDSA Ed25519 ");
fflush (stdout);
}
+ else if (is_ed448)
+ {
+ p_size = 448;
+ printf ("EdDSA Ed448 ");
+ fflush (stdout);
+ }
else if (is_gost)
{
p_size = atoi (p_sizes[testno] + 4);
@@ -1525,6 +1534,10 @@ ecc_bench (int iterations, int print_header)
err = gcry_sexp_build (&key_spec, NULL,
"(genkey (ecdsa (curve \"Ed25519\")"
"(flags eddsa)))");
+ else if (is_ed448)
+ err = gcry_sexp_build (&key_spec, NULL,
+ "(genkey (ecdsa (curve \"Ed448\")"
+ "(flags eddsa)))");
else if (is_gost)
err = gcry_sexp_build (&key_spec, NULL,
"(genkey (ecdsa (curve %s)))",
@@ -1562,6 +1575,10 @@ ecc_bench (int iterations, int print_header)
err = gcry_sexp_build (&data, NULL,
"(data (flags eddsa)(hash-algo sha512)"
" (value %m))", x);
+ else if (is_ed448)
+ err = gcry_sexp_build (&data, NULL,
+ "(data (flags eddsa)(hash-algo shake256)"
+ " (value %m))", x);
else if (is_gost)
err = gcry_sexp_build (&data, NULL, "(data (flags gost) (value %m))", x);
else
--
2.30.2
More information about the Gcrypt-devel
mailing list