aboutsummaryrefslogtreecommitdiffstats
path: root/src/cmd/speed/speed.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/speed/speed.cpp')
-rw-r--r--src/cmd/speed/speed.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/cmd/speed/speed.cpp b/src/cmd/speed/speed.cpp
index 2e3d2c6fa..9deb9cc63 100644
--- a/src/cmd/speed/speed.cpp
+++ b/src/cmd/speed/speed.cpp
@@ -133,9 +133,6 @@ void time_transform(std::unique_ptr<Transformation> tf,
if(!tf)
return;
- if(tf->maximum_keylength() > 0)
- tf->set_key(rng.random_vec(tf->maximum_keylength()));
-
for(size_t buf_size : { 16, 64, 256, 1024, 8192 })
{
secure_vector<byte> buffer(buf_size);
@@ -158,6 +155,10 @@ void time_transform(const std::string& algo, RandomNumberGenerator& rng)
{
std::unique_ptr<Transformation> tf;
tf.reset(get_aead(algo, ENCRYPTION));
+
+ if(Keyed_Transform* keyed = dynamic_cast<Keyed_Transform*>(tf.get()))
+ keyed->set_key(rng.random_vec(keyed->key_spec().maximum_keylength()));
+
time_transform(std::move(tf), rng);
}