aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-12-22 12:51:40 -0500
committerJack Lloyd <[email protected]>2017-12-22 12:51:40 -0500
commitc8a39ff74a00f9787cb37925e1d09351096680d1 (patch)
treec6b127fa26b61f4d7624832c88923b95e77044d7 /src/tests
parente1d9bb580d88e51c4ce7eb2a019ec003e5c160b9 (diff)
Avoid possible null pointer deref
Caught with Coverity
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/unit_ecdsa.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/tests/unit_ecdsa.cpp b/src/tests/unit_ecdsa.cpp
index b4bafd7e4..99acc3f21 100644
--- a/src/tests/unit_ecdsa.cpp
+++ b/src/tests/unit_ecdsa.cpp
@@ -216,11 +216,11 @@ Test::Result test_ecdsa_create_save_load()
std::unique_ptr<Botan::Private_Key> loaded_key(Botan::PKCS8::load_key(pem_src, Test::rng()));
Botan::ECDSA_PrivateKey* loaded_ec_key = dynamic_cast<Botan::ECDSA_PrivateKey*>(loaded_key.get());
result.confirm("the loaded key could be converted into an ECDSA_PrivateKey", loaded_ec_key);
- result.confirm("the loaded key produces equal encoding",
- (ecc_private_key_pem == Botan::PKCS8::PEM_encode(*loaded_ec_key)));
if(loaded_ec_key)
{
+ result.confirm("the loaded key produces equal encoding",
+ (ecc_private_key_pem == Botan::PKCS8::PEM_encode(*loaded_ec_key)));
Botan::PK_Verifier verifier(*loaded_ec_key, "EMSA1(SHA-256)");
result.confirm("generated signature valid", verifier.verify_message(msg, msg_signature));
}