diff options
Diffstat (limited to 'src/pk_pad/emsa2/emsa2.cpp')
-rw-r--r-- | src/pk_pad/emsa2/emsa2.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/pk_pad/emsa2/emsa2.cpp b/src/pk_pad/emsa2/emsa2.cpp index 24292d390..9f5f4b277 100644 --- a/src/pk_pad/emsa2/emsa2.cpp +++ b/src/pk_pad/emsa2/emsa2.cpp @@ -96,11 +96,16 @@ bool EMSA2::verify(const MemoryRegion<byte>& coded, *************************************************/ EMSA2::EMSA2(const std::string& hash_name) { - hash_id = ieee1363_hash_id(hash_name); - if(hash_id == 0) - throw Encoding_Error("EMSA2 cannot be used with " + hash->name()); hash = get_hash(hash_name); empty_hash = hash->final(); + + hash_id = ieee1363_hash_id(hash->name()); + + if(hash_id == 0) + { + delete hash; + throw Encoding_Error("EMSA2 cannot be used with " + hash->name()); + } } } |