aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-02-26 13:45:50 -0500
committerJack Lloyd <[email protected]>2017-02-26 13:45:50 -0500
commit70d9d062d095242bcfe8df25fc57fb88eadec3a9 (patch)
treef5965bda96f936fcd5a4277de3f62e67274a0011
parent0e509c7ebfb6cabf6e2022065c90ddd705d8a6bc (diff)
Add missing try/catch in invalid signature test
From GH #889
-rw-r--r--src/tests/test_pubkey.cpp12
1 files changed, 10 insertions, 2 deletions
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<uint8_t> 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());
}
}
}