summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2018-02-21 23:07:31 +0100
committerNiels Möller <nisse@lysator.liu.se>2018-02-21 23:07:31 +0100
commitbe5b2eda8461cbe2f586b82fc04a245e4d18da99 (patch)
tree4f50ffcd4bb5d81d77246f8912bb4454594ae845 /examples
parent9a14e981d88f77787c972c9a2b02e2a0162978f4 (diff)
parent073fdc228fda390faf072d45d675674b7ff93ee7 (diff)
downloadnettle-be5b2eda8461cbe2f586b82fc04a245e4d18da99.tar.gz
Merge branch 'cmac-support'
Diffstat (limited to 'examples')
-rw-r--r--examples/nettle-benchmark.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/examples/nettle-benchmark.c b/examples/nettle-benchmark.c
index 655ce09e..b6863cb5 100644
--- a/examples/nettle-benchmark.c
+++ b/examples/nettle-benchmark.c
@@ -64,6 +64,7 @@
#include "sha3.h"
#include "twofish.h"
#include "umac.h"
+#include "cmac.h"
#include "poly1305.h"
#include "nettle-meta.h"
@@ -403,7 +404,7 @@ time_umac(void)
struct umac64_ctx ctx64;
struct umac96_ctx ctx96;
struct umac128_ctx ctx128;
-
+
uint8_t key[16];
umac32_set_key (&ctx32, key);
@@ -440,6 +441,24 @@ time_umac(void)
}
static void
+time_cmac(void)
+{
+ static uint8_t data[BENCH_BLOCK];
+ struct bench_hash_info info;
+ struct cmac_aes128_ctx ctx;
+
+ uint8_t key[16];
+
+ cmac_aes128_set_key (&ctx, key);
+ info.ctx = &ctx;
+ info.update = (nettle_hash_update_func *) cmac_aes128_update;
+ info.data = data;
+
+ display("cmac-aes128", "update", AES_BLOCK_SIZE,
+ time_function(bench_hash, &info));
+}
+
+static void
time_poly1305_aes(void)
{
static uint8_t data[BENCH_BLOCK];
@@ -849,6 +868,9 @@ main(int argc, char **argv)
if (!alg || strstr ("umac", alg))
time_umac();
+ if (!alg || strstr ("cmac", alg))
+ time_cmac();
+
if (!alg || strstr ("poly1305-aes", alg))
time_poly1305_aes();