diff options
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/test_package_transform.cpp | 3 | ||||
-rw-r--r-- | src/tests/test_rng.h | 7 | ||||
-rw-r--r-- | src/tests/test_rsa.cpp | 2 | ||||
-rw-r--r-- | src/tests/test_srp6.cpp | 3 |
4 files changed, 12 insertions, 3 deletions
diff --git a/src/tests/test_package_transform.cpp b/src/tests/test_package_transform.cpp index f09251e1d..d72c3bbcb 100644 --- a/src/tests/test_package_transform.cpp +++ b/src/tests/test_package_transform.cpp @@ -30,7 +30,8 @@ class Package_Transform_Tests final : public Test for(size_t input_len = 2; input_len != 256; ++input_len) { - std::vector<uint8_t> input = unlock(Test::rng().random_vec(input_len)); + std::vector<uint8_t> input; + Test::rng().random_vec(input, input_len); std::vector<uint8_t> output(input.size() + cipher->block_size()); // aont_package owns/deletes the passed cipher object, kind of a bogus API 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() diff --git a/src/tests/test_rsa.cpp b/src/tests/test_rsa.cpp index 3ac5d4733..725e3c313 100644 --- a/src/tests/test_rsa.cpp +++ b/src/tests/test_rsa.cpp @@ -284,7 +284,7 @@ class RSA_Blinding_Tests final : public Test */ const size_t rng_bytes = rsa.get_n().bytes() + (2*8*BOTAN_BLINDING_REINIT_INTERVAL); - Botan_Tests::Fixed_Output_RNG fixed_rng(Botan::unlock(Test::rng().random_vec(rng_bytes))); + Botan_Tests::Fixed_Output_RNG fixed_rng(Test::rng(), rng_bytes); Botan::PK_Decryptor_EME decryptor(rsa, fixed_rng, "Raw", "base"); for(size_t i = 1; i <= BOTAN_BLINDING_REINIT_INTERVAL ; ++i) diff --git a/src/tests/test_srp6.cpp b/src/tests/test_srp6.cpp index a25d857a2..8c84709cd 100644 --- a/src/tests/test_srp6.cpp +++ b/src/tests/test_srp6.cpp @@ -103,7 +103,8 @@ class SRP6_RT_Tests final : public Test const std::string group_id = "modp/srp/1024"; const std::string hash_id = "SHA-256"; - const std::vector<uint8_t> salt = unlock(Test::rng().random_vec(16)); + std::vector<uint8_t> salt; + Test::rng().random_vec(salt, 16); const Botan::BigInt verifier = Botan::generate_srp6_verifier(username, password, salt, group_id, hash_id); |