From a66bee9144bdf9e72dc9ace176ff7d936a0b7bd2 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Sun, 5 May 2024 14:53:58 -0400 Subject: [PATCH] Use new EC types in ECIES --- src/lib/pubkey/ecies/ecies.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/lib/pubkey/ecies/ecies.cpp b/src/lib/pubkey/ecies/ecies.cpp index 78785ef18df..64c7d3ea638 100644 --- a/src/lib/pubkey/ecies/ecies.cpp +++ b/src/lib/pubkey/ecies/ecies.cpp @@ -66,17 +66,9 @@ class ECIES_ECDH_KA_Operation final : public PK_Ops::Key_Agreement_with_KDF { secure_vector raw_agree(const uint8_t w[], size_t w_len) override { const EC_Group& group = m_key.domain(); - - EC_Point input_point = group.OS2ECP(w, w_len); - input_point.randomize_repr(m_rng); - - const EC_Point S = group.blinded_var_point_multiply(input_point, m_key.private_value(), m_rng, m_ws); - - if(S.on_the_curve() == false) { - throw Internal_Error("ECDH agreed value was not on the curve"); - } - - return S.x_bytes(); + const EC_AffinePoint input_point(group, group.OS2ECP(w, w_len)); + const auto x = EC_Scalar::from_bigint(group, m_key.private_value()); + return input_point.mul(x, m_rng, m_ws).x_bytes(); } private: