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/hash | |
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/hash')
-rw-r--r-- | src/lib/hash/comb4p/comb4p.cpp | 5 | ||||
-rw-r--r-- | src/lib/hash/par_hash/par_hash.cpp | 6 |
2 files changed, 3 insertions, 8 deletions
diff --git a/src/lib/hash/comb4p/comb4p.cpp b/src/lib/hash/comb4p/comb4p.cpp index 4cb08eb0b..4797e2483 100644 --- a/src/lib/hash/comb4p/comb4p.cpp +++ b/src/lib/hash/comb4p/comb4p.cpp @@ -41,9 +41,8 @@ Comb4P* Comb4P::make(const Spec& spec) { if(spec.arg_count() == 2) { - auto& hashes = Algo_Registry<HashFunction>::global_registry(); - std::unique_ptr<HashFunction> h1(hashes.make(spec.arg(0))); - std::unique_ptr<HashFunction> h2(hashes.make(spec.arg(1))); + std::unique_ptr<HashFunction> h1(make_hash_function(spec.arg(0))); + std::unique_ptr<HashFunction> h2(make_hash_function(spec.arg(1))); if(h1 && h2) return new Comb4P(h1.release(), h2.release()); diff --git a/src/lib/hash/par_hash/par_hash.cpp b/src/lib/hash/par_hash/par_hash.cpp index d3c641a95..b6133929c 100644 --- a/src/lib/hash/par_hash/par_hash.cpp +++ b/src/lib/hash/par_hash/par_hash.cpp @@ -8,7 +8,6 @@ #include <botan/internal/hash_utils.h> #include <botan/par_hash.h> #include <botan/parsing.h> -#include <botan/internal/algo_registry.h> namespace Botan { @@ -16,14 +15,11 @@ BOTAN_REGISTER_NAMED_T(HashFunction, "Parallel", Parallel, Parallel::make); Parallel* Parallel::make(const Spec& spec) { - auto& hash_fns = Algo_Registry<HashFunction>::global_registry(); - std::vector<std::unique_ptr<HashFunction>> hashes; for(size_t i = 0; i != spec.arg_count(); ++i) { - std::unique_ptr<HashFunction> h(hash_fns.make(spec.arg(i))); - + std::unique_ptr<HashFunction> h(get_hash_function(spec.arg(i))); if(!h) return nullptr; hashes.push_back(std::move(h)); |