diff options
author | Jack Lloyd <[email protected]> | 2018-03-08 17:41:26 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-03-08 17:41:26 -0500 |
commit | b713706554b3b14226f11106d35aa7c564d387e5 (patch) | |
tree | b472cf636449955f41d616446b2e6eb1999702e0 /src/lib | |
parent | da7c94cf809cc1c84b41e9313e64634675ace2bc (diff) |
Mul into temps to avoid allocations
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/pubkey/ec_group/point_gfp.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/lib/pubkey/ec_group/point_gfp.cpp b/src/lib/pubkey/ec_group/point_gfp.cpp index f7d43bc26..1f8dc3147 100644 --- a/src/lib/pubkey/ec_group/point_gfp.cpp +++ b/src/lib/pubkey/ec_group/point_gfp.cpp @@ -151,14 +151,15 @@ void PointGFp::add_affine(const PointGFp& rhs, std::vector<BigInt>& ws_bn) T3 += p; T2 = m_coord_y; - m_curve.mul(m_coord_y, T0, T3, ws); - m_curve.mul(T3, T2, T1, ws); - m_coord_y -= T3; - if(m_coord_y.is_negative()) - m_coord_y += p; + m_curve.mul(T2, T0, T3, ws); + m_curve.mul(T3, m_coord_y, T1, ws); + T2 -= T3; + if(T2.is_negative()) + T2 += p; + m_coord_y = T2; - T3 = m_coord_z; - m_curve.mul(m_coord_z, T3, T4, ws); + m_curve.mul(T3, m_coord_z, T4, ws); + m_coord_z = T3; } // Point addition |