aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-11-18 16:30:15 -0500
committerJack Lloyd <[email protected]>2017-11-18 16:30:15 -0500
commit5f7a90fd7c3eecc83c2e17b85a7082f052954bd6 (patch)
tree2eaf72dc75b17a2883c85071b5a6e3a530bb1f47 /src
parentd7c6164dc9f5b33a3de5d2c2a3570e05f8e80082 (diff)
Add timings for RFC 3394 keywrap
Diffstat (limited to 'src')
-rw-r--r--src/cli/speed.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/cli/speed.cpp b/src/cli/speed.cpp
index 0c15b74d5..894fc3ef4 100644
--- a/src/cli/speed.cpp
+++ b/src/cli/speed.cpp
@@ -52,6 +52,10 @@
#include <botan/fpe_fe1.h>
#endif
+#if defined(BOTAN_HAS_RFC3394_KEYWRAP)
+ #include <botan/rfc3394.h>
+#endif
+
#if defined(BOTAN_HAS_COMPRESSION)
#include <botan/compression.h>
#endif
@@ -805,6 +809,14 @@ class Speed final : public Command
bench_fpe_fe1(msec);
}
#endif
+
+#if defined(BOTAN_HAS_RFC3394_KEYWRAP)
+ else if(algo == "rfc3394")
+ {
+ bench_rfc3394(msec);
+ }
+#endif
+
#if defined(BOTAN_HAS_ECC_GROUP)
else if(algo == "ecc_mult")
{
@@ -1225,6 +1237,34 @@ class Speed final : public Command
}
#endif
+#if defined(BOTAN_HAS_RFC3394_KEYWRAP)
+
+ void bench_rfc3394(const std::chrono::milliseconds runtime)
+ {
+ Timer wrap_timer("RFC3394 AES-256 key wrap");
+ Timer unwrap_timer("RFC3394 AES-256 key unwrap");
+
+ const Botan::SymmetricKey kek(rng(), 32);
+ Botan::secure_vector<uint8_t> key(64, 0);
+
+ while(wrap_timer.under(runtime))
+ {
+ wrap_timer.start();
+ key = Botan::rfc3394_keywrap(key, kek);
+ wrap_timer.stop();
+
+ unwrap_timer.start();
+ key = Botan::rfc3394_keyunwrap(key, kek);
+ unwrap_timer.stop();
+
+ key[0] += 1;
+ }
+
+ record_result(wrap_timer);
+ record_result(unwrap_timer);
+ }
+#endif
+
#if defined(BOTAN_HAS_DL_GROUP)
void bench_modexp(const std::chrono::milliseconds runtime)