diff options
author | Jack Lloyd <[email protected]> | 2015-12-20 17:03:08 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2015-12-20 17:03:08 -0500 |
commit | 66fb50a462d72c106bd4a4102a1faff92bd5f7e2 (patch) | |
tree | 4ee9fa1680108e34b8cf7d4ea08bf794ae89881f /src | |
parent | 8ce0a52ba72837b3e3e8aee63f7ce3a96ca07178 (diff) |
Throw Lookup_Error instead of bare Exception when creating an obj fails
in the algo factory.
Fixes remaining issues of GH #369 - test_pubkey.cpp was expecting Lookup_Error
when something isn't found.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/base/algo_registry.h | 48 | ||||
-rw-r--r-- | src/tests/test_pubkey.cpp | 8 |
2 files changed, 28 insertions, 28 deletions
diff --git a/src/lib/base/algo_registry.h b/src/lib/base/algo_registry.h index 3b1a72d88..a431e9178 100644 --- a/src/lib/base/algo_registry.h +++ b/src/lib/base/algo_registry.h @@ -22,7 +22,7 @@ #define BOTAN_WORKAROUND_GH_321 #define NOMINMAX 1 #define WIN32_LEAN_AND_MEAN 1 - #include <Windows.h> + #include <windows.h> #endif @@ -33,28 +33,28 @@ namespace Botan { class WinCS_Mutex { public: - WinCS_Mutex() - { - InitializeCriticalSection(&m_cs); - } - - ~WinCS_Mutex() - { - DeleteCriticalSection(&m_cs); - } - - void lock() - { - EnterCriticalSection(&m_cs); - } - - void unlock() - { - LeaveCriticalSection(&m_cs); - } - - private: - CRITICAL_SECTION m_cs; + WinCS_Mutex() + { + ::InitializeCriticalSection(&m_cs); + } + + ~WinCS_Mutex() + { + ::DeleteCriticalSection(&m_cs); + } + + void lock() + { + ::EnterCriticalSection(&m_cs); + } + + void unlock() + { + ::LeaveCriticalSection(&m_cs); + } + + private: + CRITICAL_SECTION m_cs; }; #endif @@ -111,7 +111,7 @@ class Algo_Registry } catch(std::exception& e) { - throw Exception("Creating '" + spec.as_string() + "' failed: " + e.what()); + throw Lookup_Error("Creating '" + spec.as_string() + "' failed: " + e.what()); } return nullptr; diff --git a/src/tests/test_pubkey.cpp b/src/tests/test_pubkey.cpp index 9c8b635cd..db2a0ae31 100644 --- a/src/tests/test_pubkey.cpp +++ b/src/tests/test_pubkey.cpp @@ -104,7 +104,7 @@ PK_Signature_Generation_Test::run_one_test(const std::string&, const VarMap& var { signer.reset(new Botan::PK_Signer(*privkey, padding, Botan::IEEE_1363, sign_provider)); } - catch(...) + catch(Botan::Lookup_Error&) { //result.test_note("Skipping signing with " + sign_provider); continue; @@ -131,7 +131,7 @@ PK_Signature_Generation_Test::run_one_test(const std::string&, const VarMap& var { verifier.reset(new Botan::PK_Verifier(*pubkey, padding, Botan::IEEE_1363, verify_provider)); } - catch(...) + catch(Botan::Lookup_Error&) { //result.test_note("Skipping verifying with " + verify_provider); continue; @@ -193,7 +193,7 @@ PK_Encryption_Decryption_Test::run_one_test(const std::string&, const VarMap& va { encryptor.reset(new Botan::PK_Encryptor_EME(*privkey, padding, enc_provider)); } - catch(Botan::Lookup_Error) + catch(Botan::Lookup_Error&) { //result.test_note("Skipping encryption with provider " + enc_provider); continue; @@ -221,7 +221,7 @@ PK_Encryption_Decryption_Test::run_one_test(const std::string&, const VarMap& va { decryptor.reset(new Botan::PK_Decryptor_EME(*privkey, padding, dec_provider)); } - catch(Botan::Lookup_Error) + catch(Botan::Lookup_Error&) { //result.test_note("Skipping decryption with provider " + dec_provider); continue; |