aboutsummaryrefslogtreecommitdiffstats
path: root/src/benchmark
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-09-23 19:35:33 +0000
committerlloyd <[email protected]>2009-09-23 19:35:33 +0000
commitfec26d84bd9e3dd35d68429d91723eb2f56b7ff6 (patch)
tree9a253d67615d68abae5018148c3a596311386831 /src/benchmark
parent858cc406f5c28ba386c444124cba78153a5dee6d (diff)
In the benchmark code, set a random key for the block and stream ciphers.
This, I think, was what was causing the OpenSSL AES code to crash (without a key being set, the rounds are unset and probably causes the code to loop out past the end of an array somewhere). Sadly, this also confirms that OpenSSL's AES is much faster than Botan's: AES-128: 115.032 [core] 152.994 [openssl] AES-192: 98.6724 [core] 130.087 [openssl] AES-256: 86.6348 [core] 113.608 [openssl] Definitely some improvement can be made there! :(
Diffstat (limited to 'src/benchmark')
-rw-r--r--src/benchmark/benchmark.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/benchmark/benchmark.cpp b/src/benchmark/benchmark.cpp
index 9be845974..6e61baa59 100644
--- a/src/benchmark/benchmark.cpp
+++ b/src/benchmark/benchmark.cpp
@@ -54,6 +54,8 @@ bench_block_cipher(BlockCipher* block_cipher,
const u32bit in_blocks = buf_len / block_cipher->BLOCK_SIZE;
+ block_cipher->set_key(buf, block_cipher->MAXIMUM_KEYLENGTH);
+
while(nanoseconds_used < nanoseconds_max)
{
block_cipher->encrypt_n(buf, buf, in_blocks);
@@ -79,6 +81,8 @@ bench_stream_cipher(StreamCipher* stream_cipher,
u64bit nanoseconds_used = 0;
u64bit reps = 0;
+ stream_cipher->set_key(buf, stream_cipher->MAXIMUM_KEYLENGTH);
+
while(nanoseconds_used < nanoseconds_max)
{
stream_cipher->encrypt(buf, buf_len);