diff options
author | Jack Lloyd <lloyd@randombit.net> | 2016-08-31 12:58:58 -0400 |
---|---|---|
committer | Jack Lloyd <lloyd@randombit.net> | 2016-08-31 12:58:58 -0400 |
commit | dfab07a7bc00dc00f98ab86c70d536306073f34f (patch) | |
tree | d3dbb140764f259c932171d6f229d033dee685ca /src/tests/unit_ecdh.cpp | |
parent | e29024608fca1b811aa72a7aafd930a42740b968 (diff) | |
parent | 1b9cf39063194fe91dc8e5d78f73d7251c5d16fc (diff) |
Merge master into this branch, resolving conflicts with #457/#576
which recently landed on master.
Diffstat (limited to 'src/tests/unit_ecdh.cpp')
-rw-r--r-- | src/tests/unit_ecdh.cpp | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/src/tests/unit_ecdh.cpp b/src/tests/unit_ecdh.cpp index 0368a53d1..40a10203a 100644 --- a/src/tests/unit_ecdh.cpp +++ b/src/tests/unit_ecdh.cpp @@ -41,24 +41,30 @@ class ECDH_Unit_Tests : public Test std::vector<std::string> oids = { "1.2.840.10045.3.1.7", "1.3.132.0.8", "1.2.840.10045.3.1.1" }; - - for(auto&& oid : oids) + try { - Botan::EC_Group dom_pars(Botan::OIDS::lookup(oid)); - Botan::ECDH_PrivateKey private_a(Test::rng(), dom_pars); - Botan::ECDH_PrivateKey private_b(Test::rng(), dom_pars); + for(auto&& oid : oids) + { + Botan::EC_Group dom_pars(Botan::OIDS::lookup(oid)); + Botan::ECDH_PrivateKey private_a(Test::rng(), dom_pars); + Botan::ECDH_PrivateKey private_b(Test::rng(), dom_pars); - Botan::PK_Key_Agreement ka(private_a, "KDF2(SHA-1)"); - Botan::PK_Key_Agreement kb(private_b, "KDF2(SHA-1)"); + Botan::PK_Key_Agreement ka(private_a, "KDF2(SHA-512)"); + Botan::PK_Key_Agreement kb(private_b, "KDF2(SHA-512)"); - Botan::SymmetricKey alice_key = ka.derive_key(32, private_b.public_value()); - Botan::SymmetricKey bob_key = kb.derive_key(32, private_a.public_value()); + Botan::SymmetricKey alice_key = ka.derive_key(32, private_b.public_value()); + Botan::SymmetricKey bob_key = kb.derive_key(32, private_a.public_value()); - if(!result.test_eq("same derived key", alice_key.bits_of(), bob_key.bits_of())) - { - result.test_note("Keys where " + alice_key.as_string() + " and " + bob_key.as_string()); + if(!result.test_eq("same derived key", alice_key.bits_of(), bob_key.bits_of())) + { + result.test_note("Keys where " + alice_key.as_string() + " and " + bob_key.as_string()); + } } } + catch(Botan::Lookup_Error&) + { + result.test_note("Skipping due to missing KFD2 or SHA-512"); + } return result; } |