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/block | |
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/block')
-rw-r--r-- | src/lib/block/cascade/cascade.cpp | 5 | ||||
-rw-r--r-- | src/lib/block/lion/lion.cpp | 4 |
2 files changed, 4 insertions, 5 deletions
diff --git a/src/lib/block/cascade/cascade.cpp b/src/lib/block/cascade/cascade.cpp index c80bfbc68..3b59a4362 100644 --- a/src/lib/block/cascade/cascade.cpp +++ b/src/lib/block/cascade/cascade.cpp @@ -14,9 +14,8 @@ BOTAN_REGISTER_NAMED_T(BlockCipher, "Cascade", Cascade_Cipher, Cascade_Cipher::m Cascade_Cipher* Cascade_Cipher::make(const BlockCipher::Spec& spec) { - auto& block_cipher = Algo_Registry<BlockCipher>::global_registry(); - std::unique_ptr<BlockCipher> c1(block_cipher.make(spec.arg(0))); - std::unique_ptr<BlockCipher> c2(block_cipher.make(spec.arg(1))); + std::unique_ptr<BlockCipher> c1(get_block_cipher(spec.arg(0))); + std::unique_ptr<BlockCipher> c2(get_block_cipher(spec.arg(1))); if(c1 && c2) return new Cascade_Cipher(c1.release(), c2.release()); diff --git a/src/lib/block/lion/lion.cpp b/src/lib/block/lion/lion.cpp index 44d4d0bed..a3f15fb51 100644 --- a/src/lib/block/lion/lion.cpp +++ b/src/lib/block/lion/lion.cpp @@ -17,8 +17,8 @@ Lion* make_lion(const BlockCipher::Spec& spec) { if(spec.arg_count_between(2, 3)) { - std::unique_ptr<HashFunction> hash(Algo_Registry<HashFunction>::global_registry().make(spec.arg(0))); - std::unique_ptr<StreamCipher> stream(Algo_Registry<StreamCipher>::global_registry().make(spec.arg(1))); + std::unique_ptr<HashFunction> hash(get_hash_function(spec.arg(0))); + std::unique_ptr<StreamCipher> stream(get_stream_cipher(spec.arg(1))); if(hash && stream) { |