Commit 7560b387 authored by Dmitry Baryshkov's avatar Dmitry Baryshkov Committed by Niels Möller
Browse files

Allow user to specify multiple algorithms to nettle-benchmark


Signed-off-by: Dmitry Baryshkov's avatarDmitry Eremin-Solenikov <dbaryshkov@gmail.com>
parent c380faf7
...@@ -809,7 +809,7 @@ main(int argc, char **argv) ...@@ -809,7 +809,7 @@ main(int argc, char **argv)
break; break;
case OPT_HELP: case OPT_HELP:
printf("Usage: nettle-benchmark [-f clock frequency] [alg]\n"); printf("Usage: nettle-benchmark [-f clock frequency] [alg...]\n");
return EXIT_SUCCESS; return EXIT_SUCCESS;
case '?': case '?':
...@@ -819,8 +819,6 @@ main(int argc, char **argv) ...@@ -819,8 +819,6 @@ main(int argc, char **argv)
abort(); abort();
} }
alg = argv[optind];
time_init(); time_init();
bench_sha1_compress(); bench_sha1_compress();
bench_salsa20_core(); bench_salsa20_core();
...@@ -830,29 +828,36 @@ main(int argc, char **argv) ...@@ -830,29 +828,36 @@ main(int argc, char **argv)
header(); header();
if (!alg || strstr ("memxor", alg)) do
{ {
time_memxor(); alg = argv[optind];
printf("\n");
} if (!alg || strstr ("memxor", alg))
{
for (i = 0; hashes[i]; i++) time_memxor();
if (!alg || strstr(hashes[i]->name, alg)) printf("\n");
time_hash(hashes[i]); }
for (i = 0; hashes[i]; i++)
if (!alg || strstr(hashes[i]->name, alg))
time_hash(hashes[i]);
if (!alg || strstr ("umac", alg))
time_umac();
if (!alg || strstr ("umac", alg)) if (!alg || strstr ("poly1305-aes", alg))
time_umac(); time_poly1305_aes();
if (!alg || strstr ("poly1305-aes", alg)) for (i = 0; ciphers[i]; i++)
time_poly1305_aes(); if (!alg || strstr(ciphers[i]->name, alg))
time_cipher(ciphers[i]);
for (i = 0; ciphers[i]; i++) for (i = 0; aeads[i]; i++)
if (!alg || strstr(ciphers[i]->name, alg)) if (!alg || strstr(aeads[i]->name, alg))
time_cipher(ciphers[i]); time_aead(aeads[i]);
for (i = 0; aeads[i]; i++) optind++;
if (!alg || strstr(aeads[i]->name, alg)) } while (alg && argv[optind]);
time_aead(aeads[i]);
return 0; return 0;
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment