Signed-off-by: Dmitry Eremin-Solenikov <[email protected]>
---
examples/nettle-benchmark.c | 47 +++++++++++++++++++++++++--------------------
1 file changed, 26 insertions(+), 21 deletions(-)
diff --git a/examples/nettle-benchmark.c b/examples/nettle-benchmark.c
index 53c4e5f9..e0578c31 100644
--- a/examples/nettle-benchmark.c
+++ b/examples/nettle-benchmark.c
@@ -794,7 +794,7 @@ main(int argc, char **argv)
break;
case OPT_HELP:
- printf("Usage: nettle-benchmark [-f clock frequency] [alg]\n");
+ printf("Usage: nettle-benchmark [-f clock frequency] [alg...]\n");
return EXIT_SUCCESS;
case '?':
@@ -804,8 +804,6 @@ main(int argc, char **argv)
abort();
}
- alg = argv[optind];
-
time_init();
bench_sha1_compress();
bench_salsa20_core();
@@ -815,29 +813,36 @@ main(int argc, char **argv)
header();
- if (!alg || strstr ("memxor", alg))
+ do
{
- time_memxor();
- printf("\n");
- }
-
- for (i = 0; hashes[i]; i++)
- if (!alg || strstr(hashes[i]->name, alg))
- time_hash(hashes[i]);
+ alg = argv[optind];
+
+ if (!alg || strstr ("memxor", alg))
+ {
+ time_memxor();
+ printf("\n");
+ }
+
+ 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))
- time_umac();
+ if (!alg || strstr ("poly1305-aes", alg))
+ time_poly1305_aes();
- if (!alg || strstr ("poly1305-aes", alg))
- time_poly1305_aes();
+ for (i = 0; ciphers[i]; i++)
+ if (!alg || strstr(ciphers[i]->name, alg))
+ time_cipher(ciphers[i]);
- for (i = 0; ciphers[i]; i++)
- if (!alg || strstr(ciphers[i]->name, alg))
- time_cipher(ciphers[i]);
+ for (i = 0; aeads[i]; i++)
+ if (!alg || strstr(aeads[i]->name, alg))
+ time_aead(aeads[i]);
- for (i = 0; aeads[i]; i++)
- if (!alg || strstr(aeads[i]->name, alg))
- time_aead(aeads[i]);
+ optind++;
+ } while (alg && argv[optind]);
return 0;
}
--
2.11.0
_______________________________________________
nettle-bugs mailing list
[email protected]
http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs