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/tests/test_rng.h | |
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/tests/test_rng.h')
-rw-r--r-- | src/tests/test_rng.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/tests/test_rng.h b/src/tests/test_rng.h index 01fe89c92..080603a23 100644 --- a/src/tests/test_rng.h +++ b/src/tests/test_rng.h @@ -69,6 +69,13 @@ class Fixed_Output_RNG : public Botan::RandomNumberGenerator m_buf.insert(m_buf.end(), in.begin(), in.end()); } + Fixed_Output_RNG(RandomNumberGenerator& rng, size_t len) + { + std::vector<uint8_t> output; + rng.random_vec(output, len); + m_buf.insert(m_buf.end(), output.begin(), output.end()); + } + Fixed_Output_RNG() = default; protected: uint8_t random() |