diff options
author | Niels Möller <nisse@lysator.liu.se> | 2023-04-08 21:25:48 +0200 |
---|---|---|
committer | Niels Möller <nisse@lysator.liu.se> | 2023-04-08 21:25:48 +0200 |
commit | e7267628cbc9299f21fb335cb99586f4e925de7e (patch) | |
tree | 157ba1160513aa3531dcd2d13351d74f340fecbc | |
parent | bde8fd7661a4cf8ee56e9a3730cc34bad61997b4 (diff) | |
download | nettle-e7267628cbc9299f21fb335cb99586f4e925de7e.tar.gz |
Cycle counts for ghash_update.
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | examples/nettle-benchmark.c | 14 |
2 files changed, 18 insertions, 0 deletions
@@ -1,3 +1,7 @@ +2023-04-08 Niels Möller <nisse@lysator.liu.se> + + * examples/nettle-benchmark.c (bench_ghash_update): New function. + 2023-04-07 Niels Möller <nisse@lysator.liu.se> * ghash-update.c (gcm_gf_mul): Rewrite to avoid side channel diff --git a/examples/nettle-benchmark.c b/examples/nettle-benchmark.c index 613b1dcf..04c3e0f2 100644 --- a/examples/nettle-benchmark.c +++ b/examples/nettle-benchmark.c @@ -56,6 +56,7 @@ #include "des.h" #include "eax.h" #include "gcm.h" +#include "ghash-internal.h" #include "memxor.h" #include "salsa20.h" #include "salsa20-internal.h" @@ -875,10 +876,22 @@ bench_sha3_permute(void) TIME_CYCLES (t, sha3_permute (&state)); printf("sha3_permute: %.2f cycles (%.2f / round)\n", t, t / 24.0); } +static void +bench_ghash_update(void) +{ + struct gcm_key key; + union nettle_block16 state; + const uint8_t data[160]; + double t; + + TIME_CYCLES (t, _ghash_update (&key, &state, 10, data)); + printf("ghash_update: %.2f cycles / block\n", t / 10.0); +} #else #define bench_sha1_compress() #define bench_salsa20_core() #define bench_sha3_permute() +#define bench_ghash_update() #endif #if WITH_OPENSSL @@ -986,6 +999,7 @@ main(int argc, char **argv) bench_sha1_compress(); bench_salsa20_core(); bench_sha3_permute(); + bench_ghash_update(); printf("\n"); header(); |