diff options
author | lloyd <[email protected]> | 2015-03-04 04:30:20 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2015-03-04 04:30:20 +0000 |
commit | 2591a2cd863696b91128ff4a8461bb96d497e7b4 (patch) | |
tree | acb7a179a0790ec63c0c21ecb2ea9d7939e05248 /src/lib/rng | |
parent | c794f78bd9b7eebc58c39fd00de90b26fb4cfb67 (diff) |
Hide Algorithm_Factory and use the functions in lookup.h internally.
Fix two memory leaks (in TLS and modes) caused by calling get_foo and
then cloning the result before saving it (leaking the original object),
a holdover from the conversion between construction techniques in 1.11.14
Diffstat (limited to 'src/lib/rng')
-rw-r--r-- | src/lib/rng/rng.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/lib/rng/rng.cpp b/src/lib/rng/rng.cpp index a5222c51d..462d8afa1 100644 --- a/src/lib/rng/rng.cpp +++ b/src/lib/rng/rng.cpp @@ -7,16 +7,15 @@ #include <botan/rng.h> #include <botan/hmac_rng.h> -#include <botan/internal/algo_registry.h> +#include <botan/lookup.h> namespace Botan { RandomNumberGenerator* RandomNumberGenerator::make_rng() { - std::unique_ptr<RandomNumberGenerator> rng( - new HMAC_RNG(make_a<MessageAuthenticationCode>("HMAC(SHA-512)"), - make_a<MessageAuthenticationCode>("HMAC(SHA-256)")) - ); + std::unique_ptr<MessageAuthenticationCode> h1(make_message_auth("HMAC(SHA-512")); + std::unique_ptr<MessageAuthenticationCode> h2(h1->clone()); + std::unique_ptr<RandomNumberGenerator> rng(new HMAC_RNG(h1.release(), h2.release())); rng->reseed(256); |