Commit a482e83c authored by Niels Möller's avatar Niels Möller
Browse files

Added umac benchmarking.

parent 5938db8f
2013-04-11 Niels Möller <>
* examples/nettle-benchmark.c (time_umac): New function.
(main): Call it.
* umac-set-key.c (_umac_set_key): Drop byteswapping of l3_key2, it
can be xored directly to the pad in native byteorder.
* umac-l3.c (_umac_l3): Drop key_2 argument, let caller do that
......@@ -55,6 +55,7 @@
#include "sha2.h"
#include "sha3.h"
#include "twofish.h"
#include "umac.h"
#include "nettle-meta.h"
#include "nettle-internal.h"
......@@ -352,6 +353,51 @@ time_hash(const struct nettle_hash *hash)
static void
static uint8_t data[BENCH_BLOCK];
struct bench_hash_info info;
struct umac32_ctx ctx32;
struct umac64_ctx ctx64;
struct umac96_ctx ctx96;
struct umac128_ctx ctx128;
uint8_t key[16];
umac32_set_key (&ctx32, key);
info.ctx = &ctx32;
info.update = (nettle_hash_update_func *) umac32_update; = data;
display("umac32", "update", UMAC_BLOCK_SIZE,
time_function(bench_hash, &info));
umac64_set_key (&ctx64, key);
info.ctx = &ctx64;
info.update = (nettle_hash_update_func *) umac64_update; = data;
display("umac64", "update", UMAC_BLOCK_SIZE,
time_function(bench_hash, &info));
umac96_set_key (&ctx96, key);
info.ctx = &ctx96;
info.update = (nettle_hash_update_func *) umac96_update; = data;
display("umac96", "update", UMAC_BLOCK_SIZE,
time_function(bench_hash, &info));
umac128_set_key (&ctx128, key);
info.ctx = &ctx128;
info.update = (nettle_hash_update_func *) umac128_update; = data;
display("umac128", "update", UMAC_BLOCK_SIZE,
time_function(bench_hash, &info));
static void
......@@ -669,6 +715,9 @@ main(int argc, char **argv)
if (!alg || strstr(hashes[i]->name, alg))
if (!alg || strstr ("umac", alg))
for (i = 0; ciphers[i]; i++)
if (!alg || strstr(ciphers[i]->name, alg))
Supports Markdown
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