diff options
author | Jack Lloyd <[email protected]> | 2016-01-03 13:35:46 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-01-03 13:35:46 -0500 |
commit | a1deceb37da0375c62abeca2411f5e0670a553e8 (patch) | |
tree | e12856b803ecccebdcb7412b1c21c2724286af99 /src/lib/math | |
parent | af765b82f8def8045e93db09ae6babec65bfb8e6 (diff) |
Fix PointGFp multiplication bug
There was a special case for small scalars which managed to forget
that the integer 3 also fits into two bits. Found by adding a new set
of ECC point mul tests for the NIST curves.
Diffstat (limited to 'src/lib/math')
-rw-r--r-- | src/lib/math/ec_gfp/point_gfp.cpp | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/src/lib/math/ec_gfp/point_gfp.cpp b/src/lib/math/ec_gfp/point_gfp.cpp index 93508ba55..ca6448782 100644 --- a/src/lib/math/ec_gfp/point_gfp.cpp +++ b/src/lib/math/ec_gfp/point_gfp.cpp @@ -283,24 +283,6 @@ PointGFp operator*(const BigInt& scalar, const PointGFp& point) std::vector<BigInt> ws(9); - if(scalar_bits <= 2) - { - const byte abs_val = scalar.byte_at(0); - - if(abs_val == 0) - return PointGFp::zero_of(curve); - - PointGFp result = point; - - if(abs_val == 2) - result.mult2(ws); - - if(scalar.is_negative()) - result.negate(); - - return result; - } - PointGFp R[2] = { PointGFp(curve), point }; for(size_t i = scalar_bits; i > 0; i--) |