10#include <botan/ecdh.h>
12#include <botan/numthry.h>
13#include <botan/internal/pk_ops_impl.h>
29 PK_Ops::Key_Agreement_with_KDF(kdf), m_group(key.domain()), m_rng(rng) {
30 m_l_times_priv = m_group.inverse_mod_order(m_group.get_cofactor()) * key.
private_value();
33 size_t agreed_value_size()
const override {
return m_group.get_p_bytes(); }
36 EC_Point input_point = m_group.get_cofactor() * m_group.OS2ECP(w, w_len);
37 input_point.randomize_repr(m_rng);
39 const EC_Point S = m_group.blinded_var_point_multiply(input_point, m_l_times_priv, m_rng, m_ws);
41 if(S.on_the_curve() ==
false) {
49 const EC_Group m_group;
50 BigInt m_l_times_priv;
51 RandomNumberGenerator& m_rng;
52 std::vector<BigInt> m_ws;
58 return std::make_unique<ECDH_PrivateKey>(rng,
domain());
62 std::string_view params,
63 std::string_view provider)
const {
64 if(provider ==
"base" || provider.empty()) {
65 return std::make_unique<ECDH_KA_Operation>(*
this, params, rng);
std::unique_ptr< Public_Key > public_key() const override
std::unique_ptr< PK_Ops::Key_Agreement > create_key_agreement_op(RandomNumberGenerator &rng, std::string_view params, std::string_view provider) const override
std::string algo_name() const override
std::unique_ptr< Private_Key > generate_another(RandomNumberGenerator &rng) const final
const BigInt & private_value() const
const EC_Group & domain() const
const EC_Point & public_point() const
int(* final)(unsigned char *, CTX *)
std::vector< T, secure_allocator< T > > secure_vector