aboutsummaryrefslogtreecommitdiffstats
path: root/src/pubkey
diff options
context:
space:
mode:
Diffstat (limited to 'src/pubkey')
-rw-r--r--src/pubkey/ecdh/ecdh.cpp8
-rw-r--r--src/pubkey/ecdh/ecdh.h5
2 files changed, 6 insertions, 7 deletions
diff --git a/src/pubkey/ecdh/ecdh.cpp b/src/pubkey/ecdh/ecdh.cpp
index 37dc7c392..d3688fa5c 100644
--- a/src/pubkey/ecdh/ecdh.cpp
+++ b/src/pubkey/ecdh/ecdh.cpp
@@ -11,12 +11,10 @@
namespace Botan {
-ECDH_KA_Operation::ECDH_KA_Operation(const ECDH_PrivateKey& key)
+ECDH_KA_Operation::ECDH_KA_Operation(const ECDH_PrivateKey& key) :
+ curve(key.domain().get_curve()),
+ cofactor(key.domain().get_cofactor())
{
- cofactor = key.domain().get_cofactor();
-
- curve = key.domain().get_curve();
-
l_times_priv = inverse_mod(cofactor, key.domain().get_order()) *
key.private_value();
}
diff --git a/src/pubkey/ecdh/ecdh.h b/src/pubkey/ecdh/ecdh.h
index ad7efdc13..92796d961 100644
--- a/src/pubkey/ecdh/ecdh.h
+++ b/src/pubkey/ecdh/ecdh.h
@@ -107,8 +107,9 @@ class BOTAN_DLL ECDH_KA_Operation : public PK_Ops::KA_Operation
SecureVector<byte> agree(const byte w[], u32bit w_len) const;
private:
- CurveGFp curve;
- BigInt l_times_priv, cofactor;
+ const CurveGFp& curve;
+ const BigInt& cofactor;
+ BigInt l_times_priv;
};
}