From 9772e10e3112f9b14669d372574bcc01981028f2 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Sun, 18 Feb 2018 12:01:43 -0500 Subject: Add functions to reduce integers mod the order to EC_Group This allows calculating the Barett reduction params just once, when the group is initialized, then sharing them across all operations which use that group. --- src/tests/unit_ecc.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/tests/unit_ecc.cpp') diff --git a/src/tests/unit_ecc.cpp b/src/tests/unit_ecc.cpp index 96e2438b3..bd8295033 100644 --- a/src/tests/unit_ecc.cpp +++ b/src/tests/unit_ecc.cpp @@ -889,9 +889,15 @@ class ECC_Invalid_Key_Tests final : public Text_Based_Test const std::string encoded = get_req_str(vars, "SubjectPublicKey"); Botan::DataSource_Memory key_data(Botan::hex_decode(encoded)); - std::unique_ptr key(Botan::X509::load_key(key_data)); - result.test_eq("public key fails check", key->check_key(Test::rng(), false), false); - + try + { + std::unique_ptr key(Botan::X509::load_key(key_data)); + result.test_eq("public key fails check", key->check_key(Test::rng(), false), false); + } + catch(Botan::Decoding_Error&) + { + result.test_success("Decoding invalid ECC key results in decoding error exception"); + } return result; } -- cgit v1.2.3