diff options
author | lloyd <[email protected]> | 2010-03-19 18:21:34 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-03-19 18:21:34 +0000 |
commit | 602fb0e763cfaa2caa62b3b239d021efc767d567 (patch) | |
tree | 062a11e60698bdad68ef28b21e34f964cbd41cc7 /src/pubkey/gost_3410 | |
parent | dab16b79c89e54e9551d30dcf54ca89432932dce (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/gost_3410')
-rw-r--r-- | src/pubkey/gost_3410/gost_3410.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/pubkey/gost_3410/gost_3410.cpp b/src/pubkey/gost_3410/gost_3410.cpp index e6f68526e..74b39d50b 100644 --- a/src/pubkey/gost_3410/gost_3410.cpp +++ b/src/pubkey/gost_3410/gost_3410.cpp @@ -74,14 +74,8 @@ GOST_3410_PublicKey::GOST_3410_PublicKey(const AlgorithmIdentifier& alg_id, public_key = PointGFp(domain().get_curve(), x, y); - try - { - public_key.check_invariants(); - } - catch(Illegal_Point) - { + if(!public_key.on_the_curve()) throw Internal_Error("Loaded GOST 34.10 public key failed self test"); - } } namespace { @@ -123,7 +117,9 @@ GOST_3410_Signature_Operation::sign(const byte msg[], u32bit msg_len, e = 1; PointGFp k_times_P = base_point * k; - k_times_P.check_invariants(); + + if(!k_times_P.on_the_curve()) + throw Internal_Error("GOST 34.10 k*g not on the curve"); BigInt r = k_times_P.get_affine_x() % order; |