]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
Benchmarking of _skein256_block and _skein512_block.
authorNiels Möller <nisse@lysator.liu.se>
Thu, 12 Jan 2017 21:40:34 +0000 (22:40 +0100)
committerNiels Möller <nisse@lysator.liu.se>
Thu, 12 Jan 2017 21:40:34 +0000 (22:40 +0100)
ChangeLog
examples/nettle-benchmark.c

index df76fd5cb2b1dc2b07079599486826a0a056fe9f..b82cd69846cd31e961f3ef37fdb00e48a57b986e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-01-12  Niels Möller  <nisse@lysator.liu.se>
+
+       * examples/nettle-benchmark.c (bench_skein256_block)
+       (bench_skein512_block): New functions.
+       (main): Use them.
+
 2016-12-27  Niels Möller  <nisse@lysator.liu.se>
 
        * testsuite/skein256-test.c: Use symbolic constants.
index dea697b779c4ef3c3ef8e2e0a54a1880ab86dff1..fbd817ad8f88b719af5f405f8c3a5a9e67ba7eaf 100644 (file)
@@ -62,6 +62,7 @@
 #include "sha1.h"
 #include "sha2.h"
 #include "sha3.h"
+#include "skein.h"
 #include "twofish.h"
 #include "umac.h"
 #include "poly1305.h"
@@ -704,10 +705,38 @@ 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_skein256_block(void)
+{
+  uint64_t dst[_SKEIN256_LENGTH];
+  static const uint64_t keys[_SKEIN256_NKEYS];
+  static const uint64_t tweak[_SKEIN_NTWEAK];
+  static const uint8_t src[SKEIN256_BLOCK_SIZE];
+  double t;
+
+  TIME_CYCLES (t, _skein256_block (dst, keys, tweak, src));
+  printf("skein256_permute: %.2f cycles (%.2f / 8 rounds)\n", t, t / 9);
+}
+
+static void
+bench_skein512_block(void)
+{
+  uint64_t dst[_SKEIN512_LENGTH];
+  static const uint64_t keys[_SKEIN512_NKEYS];
+  static const uint64_t tweak[_SKEIN_NTWEAK];
+  static const uint8_t src[SKEIN512_BLOCK_SIZE];
+  double t;
+
+  TIME_CYCLES (t, _skein512_block (dst, keys, tweak, src));
+  printf("skein512_permute: %.2f cycles (%.2f / 8 rounds)\n", t, t / 9);
+}
 #else
 #define bench_sha1_compress()
 #define bench_salsa20_core()
 #define bench_sha3_permute()
+#define bench_skein256_block()
+#define bench_skein512_block()
 #endif
 
 #if WITH_OPENSSL
@@ -804,6 +833,8 @@ main(int argc, char **argv)
   bench_sha1_compress();
   bench_salsa20_core();
   bench_sha3_permute();
+  bench_skein256_block();
+  bench_skein512_block();
   printf("\n");
   time_overhead();