diff options
author | Jack Lloyd <[email protected]> | 2015-12-11 09:42:06 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2015-12-11 09:42:06 -0500 |
commit | 6b9a3a534071ef84c121c406559f8fc7ad546104 (patch) | |
tree | c11480ad1f07e443ba4e992fefcd618b532c2e93 /src/lib/pubkey/mceies/mceies.cpp | |
parent | 79a51627ee11f4d7f55d589751b30463d1f02a76 (diff) |
Reroot the exception hierarchy into a toplevel Exception class
As the alternatives are unfortunate for applications trying to catch
all library errors, and it seems deriving from std::runtime_error
causes problems with MSVC DLLs (GH #340)
Effectively reverts 2837e915d82e43
Diffstat (limited to 'src/lib/pubkey/mceies/mceies.cpp')
-rw-r--r-- | src/lib/pubkey/mceies/mceies.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/pubkey/mceies/mceies.cpp b/src/lib/pubkey/mceies/mceies.cpp index 301c5dda4..e83fa257e 100644 --- a/src/lib/pubkey/mceies/mceies.cpp +++ b/src/lib/pubkey/mceies/mceies.cpp @@ -48,7 +48,7 @@ mceies_encrypt(const McEliece_PublicKey& pubkey, std::unique_ptr<AEAD_Mode> aead(get_aead(algo, ENCRYPTION)); if(!aead) - throw std::runtime_error("mce_encrypt unable to create AEAD instance '" + algo + "'"); + throw Exception("mce_encrypt unable to create AEAD instance '" + algo + "'"); const size_t nonce_len = aead->default_nonce_length(); @@ -81,12 +81,12 @@ mceies_decrypt(const McEliece_PrivateKey& privkey, std::unique_ptr<AEAD_Mode> aead(get_aead(algo, DECRYPTION)); if(!aead) - throw std::runtime_error("Unable to create AEAD instance '" + algo + "'"); + throw Exception("Unable to create AEAD instance '" + algo + "'"); const size_t nonce_len = aead->default_nonce_length(); if(ct_len < mce_code_bytes + nonce_len + aead->tag_size()) - throw std::runtime_error("Input message too small to be valid"); + throw Exception("Input message too small to be valid"); const secure_vector<byte> mce_key = kem_op.decrypt(ct, mce_code_bytes); @@ -105,7 +105,7 @@ mceies_decrypt(const McEliece_PrivateKey& privkey, } catch(std::exception& e) { - throw std::runtime_error("mce_decrypt failed: " + std::string(e.what())); + throw Exception("mce_decrypt failed: " + std::string(e.what())); } } |