aboutsummaryrefslogtreecommitdiffstats
path: root/src/pubkey/ecdh
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-03-19 18:21:34 +0000
committerlloyd <[email protected]>2010-03-19 18:21:34 +0000
commit602fb0e763cfaa2caa62b3b239d021efc767d567 (patch)
tree062a11e60698bdad68ef28b21e34f964cbd41cc7 /src/pubkey/ecdh
parentdab16b79c89e54e9551d30dcf54ca89432932dce (diff)
Replace PointGFp::check_invaraints, which would either return silently
or throw an exception, with PointGFp::on_the_curve, which returns a bool. Update callers. This showed several cases where check_invaraints was being called multiple times, for instance when decoding a point with OS2ECP, check_invaraints was called; many callers of OS2ECP would then call check_invaraints again on the same object.
Diffstat (limited to 'src/pubkey/ecdh')
-rw-r--r--src/pubkey/ecdh/ecdh.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/pubkey/ecdh/ecdh.cpp b/src/pubkey/ecdh/ecdh.cpp
index bf8a57b3b..8d13e7f65 100644
--- a/src/pubkey/ecdh/ecdh.cpp
+++ b/src/pubkey/ecdh/ecdh.cpp
@@ -24,7 +24,9 @@ SecureVector<byte> ECDH_KA_Operation::agree(const byte w[], u32bit w_len)
PointGFp point = OS2ECP(w, w_len, curve);
PointGFp S = (cofactor * point) * l_times_priv;
- S.check_invariants();
+
+ if(!S.on_the_curve())
+ throw Internal_Error("ECDH: Agreed value was not on the curve");
return BigInt::encode_1363(S.get_affine_x(),
curve.get_p().bytes());