From 70d9d062d095242bcfe8df25fc57fb88eadec3a9 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Sun, 26 Feb 2017 13:45:50 -0500 Subject: Add missing try/catch in invalid signature test From GH #889 --- src/tests/test_pubkey.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/tests/test_pubkey.cpp b/src/tests/test_pubkey.cpp index 712fa8df4..9a8c5d2e7 100644 --- a/src/tests/test_pubkey.cpp +++ b/src/tests/test_pubkey.cpp @@ -42,10 +42,18 @@ void check_invalid_signatures(Test::Result& result, { const std::vector bad_sig = Test::mutate_vec(signature); - if(!result.test_eq("incorrect signature invalid", - verifier.verify_message(message, bad_sig), false)) + try + { + if(!result.test_eq("incorrect signature invalid", + verifier.verify_message(message, bad_sig), false)) + { + result.test_note("Accepted invalid signature " + Botan::hex_encode(bad_sig)); + } + } + catch(std::exception& e) { result.test_note("Accepted invalid signature " + Botan::hex_encode(bad_sig)); + result.test_failure("Modified signature rejected with exception", e.what()); } } } -- cgit v1.2.3