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/pk_pad/emsa_pssr/pssr.cpp | |
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/pk_pad/emsa_pssr/pssr.cpp')
-rw-r--r-- | src/lib/pk_pad/emsa_pssr/pssr.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/lib/pk_pad/emsa_pssr/pssr.cpp b/src/lib/pk_pad/emsa_pssr/pssr.cpp index 3f93ca79d..691d15964 100644 --- a/src/lib/pk_pad/emsa_pssr/pssr.cpp +++ b/src/lib/pk_pad/emsa_pssr/pssr.cpp @@ -17,14 +17,13 @@ PSSR* PSSR::make(const Spec& request) if(request.arg(1, "MGF1") != "MGF1") return nullptr; - auto hash = make_a<HashFunction>(request.arg(0)); - - if(!hash) - return nullptr; - - const size_t salt_size = request.arg_as_integer(2, hash->output_length()); + if(HashFunction* hash = get_hash_function(request.arg(0))) + { + const size_t salt_size = request.arg_as_integer(2, hash->output_length()); + return new PSSR(hash, salt_size); + } - return new PSSR(hash, salt_size); + return nullptr; } BOTAN_REGISTER_NAMED_T(EMSA, "PSSR", PSSR, PSSR::make); |