diff options
-rw-r--r-- | src/cli/speed.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/cli/speed.cpp b/src/cli/speed.cpp index 2db8e5128..28501f0c0 100644 --- a/src/cli/speed.cpp +++ b/src/cli/speed.cpp @@ -457,7 +457,7 @@ class Speed final : public Command const std::chrono::milliseconds runtime, size_t buf_size) { - Botan::secure_vector<uint8_t> buffer = rng().random_vec(buf_size * 1024); + Botan::secure_vector<uint8_t> buffer = rng().random_vec(buf_size); Timer encrypt_timer(cipher.name(), provider, "encrypt", buffer.size()); @@ -476,7 +476,7 @@ class Speed final : public Command const std::chrono::milliseconds runtime, size_t buf_size) { - Botan::secure_vector<uint8_t> buffer = rng().random_vec(buf_size * 1024); + Botan::secure_vector<uint8_t> buffer = rng().random_vec(buf_size); Timer timer(hash.name(), provider, "hash", buffer.size()); timer.run_until_elapsed(runtime, [&] { hash.update(buffer); }); @@ -488,17 +488,13 @@ class Speed final : public Command const std::chrono::milliseconds runtime, size_t buf_size) { - Botan::secure_vector<uint8_t> buffer = rng().random_vec(buf_size * 1024); - - Timer timer(mac.name(), provider, "mac", buffer.size()); + Botan::secure_vector<uint8_t> buffer = rng().random_vec(buf_size); - while(timer.under(runtime)) - { - const Botan::SymmetricKey key(rng(), mac.maximum_keylength()); - mac.set_key(key); - timer.run([&] { mac.update(buffer); }); - } + const Botan::SymmetricKey key(rng(), mac.maximum_keylength()); + mac.set_key(key); + Timer timer(mac.name(), provider, "mac", buffer.size()); + timer.run_until_elapsed(runtime, [&] { mac.update(buffer); }); output() << Timer::result_string_bps(timer); } @@ -545,7 +541,7 @@ class Speed final : public Command Botan::secure_vector<uint8_t> buffer(buf_size); rng.add_entropy(buffer.data(), buffer.size()); - size_t bits = rng.reseed(256); + rng.reseed(256); Timer timer(rng_name, "", "generate", buffer.size()); timer.run_until_elapsed(runtime, [&] { rng.randomize(buffer.data(), buffer.size()); }); |