diff options
author | Jack Lloyd <[email protected]> | 2019-09-13 05:43:31 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2019-09-13 05:50:27 -0400 |
commit | d8f23de97ba48449befae12eda4f6853e74b6a74 (patch) | |
tree | 8065a954e8c82da111351added304214baafea65 /src/cli/speed.cpp | |
parent | 71a92630ac1e3d995a017610e82a62ad6c54d246 (diff) |
Add a variant of RandomNumberGenerator::random_vec
This avoids the unlock(rng.random_vec(...)) pattern which is
pretty wasteful in terms of heap overhead.
Diffstat (limited to 'src/cli/speed.cpp')
-rw-r--r-- | src/cli/speed.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cli/speed.cpp b/src/cli/speed.cpp index 0d5bb34cd..8361243dc 100644 --- a/src/cli/speed.cpp +++ b/src/cli/speed.cpp @@ -1644,7 +1644,7 @@ class Speed final : public Command // Generate a new random ciphertext to decrypt if(ciphertext.empty() || enc_timer->under(msec)) { - plaintext = unlock(rng().random_vec(enc.maximum_input_size())); + rng().random_vec(plaintext, enc.maximum_input_size()); ciphertext = enc_timer->run([&]() { return enc.encrypt(plaintext, rng()); }); } @@ -1790,7 +1790,7 @@ class Speed final : public Command Length here is kind of arbitrary, but 48 bytes fits into a single hash block so minimizes hashing overhead versus the PK op itself. */ - message = unlock(rng().random_vec(48)); + rng().random_vec(message, 48); signature = sig_timer->run([&]() { return sig.sign_message(message, rng()); }); |