diff options
author | Jack Lloyd <[email protected]> | 2018-03-19 15:15:57 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-03-19 15:15:57 -0400 |
commit | 65e5f15c61c5ed5c41e1bed4c831ae7269f13066 (patch) | |
tree | afb1494900be3cf600a2b46002ddcbf6761b9de1 /src/lib/pubkey/ec_group/curve_gfp.cpp | |
parent | d76d6711cf61c6b690d8c0fa7d69616c2645ce52 (diff) |
Avoid needless computation in base point multiply
We computed twice as many values as were used.
Diffstat (limited to 'src/lib/pubkey/ec_group/curve_gfp.cpp')
-rw-r--r-- | src/lib/pubkey/ec_group/curve_gfp.cpp | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/src/lib/pubkey/ec_group/curve_gfp.cpp b/src/lib/pubkey/ec_group/curve_gfp.cpp index fba9a419c..a8fdb2906 100644 --- a/src/lib/pubkey/ec_group/curve_gfp.cpp +++ b/src/lib/pubkey/ec_group/curve_gfp.cpp @@ -106,12 +106,6 @@ void CurveGFp_Montgomery::from_curve_rep(BigInt& z, secure_vector<word>& ws) con void CurveGFp_Montgomery::curve_mul(BigInt& z, const BigInt& x, const BigInt& y, secure_vector<word>& ws) const { - if(x.is_zero() || y.is_zero()) - { - z.clear(); - return; - } - if(ws.size() < get_ws_size()) ws.resize(get_ws_size()); @@ -138,12 +132,6 @@ void CurveGFp_Montgomery::curve_mul(BigInt& z, const BigInt& x, const BigInt& y, void CurveGFp_Montgomery::curve_sqr(BigInt& z, const BigInt& x, secure_vector<word>& ws) const { - if(x.is_zero()) - { - z.clear(); - return; - } - if(ws.size() < get_ws_size()) ws.resize(get_ws_size()); @@ -215,12 +203,6 @@ BigInt CurveGFp_NIST::invert_element(const BigInt& x, secure_vector<word>& ws) c void CurveGFp_NIST::curve_mul(BigInt& z, const BigInt& x, const BigInt& y, secure_vector<word>& ws) const { - if(x.is_zero() || y.is_zero()) - { - z.clear(); - return; - } - if(ws.size() < get_ws_size()) ws.resize(get_ws_size()); @@ -242,12 +224,6 @@ void CurveGFp_NIST::curve_mul(BigInt& z, const BigInt& x, const BigInt& y, void CurveGFp_NIST::curve_sqr(BigInt& z, const BigInt& x, secure_vector<word>& ws) const { - if(x.is_zero()) - { - z.clear(); - return; - } - if(ws.size() < get_ws_size()) ws.resize(get_ws_size()); |