diff options
author | Jack Lloyd <[email protected]> | 2016-01-04 02:42:24 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-01-04 02:42:24 -0500 |
commit | b2722fd321dcefcfc7111cc8185bb9cdc3f5e112 (patch) | |
tree | d8c184508348206591f5eb8dd1680239c6fa18b0 /src/tests/test_pubkey.cpp | |
parent | e61e64e37393be1827a9db27c95e4cc9d4af43dd (diff) |
Add ECDH via OpenSSL
Expose provider param in PK_Key_Agreement API
Handle multiple providers in key agreement tests
Fix some funky formatting of P-521 EC points in ecdh.vec which was
being rejected by OpenSSL; for whatever reason the CAVS file had
the affine coords with far more leading zeros than necessary.
Diffstat (limited to 'src/tests/test_pubkey.cpp')
-rw-r--r-- | src/tests/test_pubkey.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/tests/test_pubkey.cpp b/src/tests/test_pubkey.cpp index dc5cd4145..faa27f322 100644 --- a/src/tests/test_pubkey.cpp +++ b/src/tests/test_pubkey.cpp @@ -294,16 +294,29 @@ Test::Result PK_Key_Agreement_Test::run_one_test(const std::string& header, cons const std::vector<uint8_t> shared = get_req_bin(vars, "K"); const std::string kdf = get_opt_str(vars, "KDF", default_kdf(vars)); - Test::Result result(algo_name() + "/" + kdf + " key agreement"); + Test::Result result(algo_name() + "/" + kdf + + (header.empty() ? header : " " + header) + + " key agreement"); std::unique_ptr<Botan::Private_Key> privkey = load_our_key(header, vars); const std::vector<uint8_t> pubkey = load_their_key(header, vars); const size_t key_len = get_opt_sz(vars, "OutLen", 0); - Botan::PK_Key_Agreement kas(*privkey, kdf); + for(auto&& provider : possible_pk_providers()) + { + std::unique_ptr<Botan::PK_Key_Agreement> kas; - result.test_eq("agreement", kas.derive_key(key_len, pubkey).bits_of(), shared); + try + { + kas.reset(new Botan::PK_Key_Agreement(*privkey, kdf, provider)); + result.test_eq(provider, "agreement", kas->derive_key(key_len, pubkey).bits_of(), shared); + } + catch(Botan::Lookup_Error&) + { + //result.test_note("Skipping key agreement with with " + provider); + } + } return result; } |