diff options
Diffstat (limited to 'src/cli/speed.cpp')
-rw-r--r-- | src/cli/speed.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/cli/speed.cpp b/src/cli/speed.cpp index 9539e22ec..fa8a09fd7 100644 --- a/src/cli/speed.cpp +++ b/src/cli/speed.cpp @@ -989,9 +989,19 @@ class Speed final : public Command const Botan::SymmetricKey key(rng(), cipher.maximum_keylength()); ks_timer.run([&]() { cipher.set_key(key); }); - for(auto buf_size : buf_sizes) + const size_t bs = cipher.block_size(); + std::set<size_t> buf_sizes_in_blocks; + for(size_t buf_size : buf_sizes) + { + if(buf_size % bs == 0) + buf_sizes_in_blocks.insert(buf_size); + else + buf_sizes_in_blocks.insert(buf_size + bs - (buf_size % bs)); + } + + for(size_t buf_size : buf_sizes_in_blocks) { - std::vector<uint8_t> buffer(buf_size * cipher.block_size()); + std::vector<uint8_t> buffer(buf_size); Timer encrypt_timer(cipher.name(), buffer.size(), "encrypt", provider, buf_size); Timer decrypt_timer(cipher.name(), buffer.size(), "decrypt", provider, buf_size); |