diff options
Diffstat (limited to 'src/pubkey/gost_3410/gost_3410.cpp')
-rw-r--r-- | src/pubkey/gost_3410/gost_3410.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/pubkey/gost_3410/gost_3410.cpp b/src/pubkey/gost_3410/gost_3410.cpp index 507ebb5a0..97e0f4a5e 100644 --- a/src/pubkey/gost_3410/gost_3410.cpp +++ b/src/pubkey/gost_3410/gost_3410.cpp @@ -153,7 +153,7 @@ bool GOST_3410_Verification_Operation::verify(const byte msg[], size_t msg_len, BigInt s(sig, sig_len / 2); BigInt r(sig + sig_len / 2, sig_len / 2); - if(r < 0 || r >= order || s < 0 || s >= order) + if(r <= 0 || r >= order || s <= 0 || s >= order) return false; e %= order; @@ -167,6 +167,9 @@ bool GOST_3410_Verification_Operation::verify(const byte msg[], size_t msg_len, PointGFp R = (z1 * base_point + z2 * public_point); + if(R.is_zero()) + return false; + return (R.get_affine_x() == r); } |