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(); }
35 secure_vector<uint8_t> raw_agree(
const uint8_t w[],
size_t w_len)
override {
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) {
48 const EC_Group m_group;
49 BigInt m_l_times_priv;
50 RandomNumberGenerator& m_rng;
51 std::vector<BigInt> m_ws;
57 std::string_view params,
58 std::string_view provider)
const {
59 if(provider ==
"base" || provider.empty()) {
60 return std::make_unique<ECDH_KA_Operation>(*
this, params, rng);
static secure_vector< uint8_t > encode_1363(const BigInt &n, size_t bytes)
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
const BigInt & private_value() const
const EC_Group & domain() const
const EC_Point & public_point() const
int(* final)(unsigned char *, CTX *)