diff options
author | Martin Ostertag <[email protected]> | 2019-10-02 16:12:13 +0200 |
---|---|---|
committer | Martin Ostertag <[email protected]> | 2019-10-02 16:12:13 +0200 |
commit | d0c6df27d07e20b6f5a3417693c5d937b78e05ba (patch) | |
tree | 289400adb94b1413ef583f60132417a105b86269 /src/lib | |
parent | 6bae463161e9be66e1b175cdefbabd16d1f61c98 (diff) |
fix for botan issue #2128: klocwork warning - get_affine_x() and
get_affine_y()
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/pubkey/ec_group/curve_gfp.h | 2 | ||||
-rw-r--r-- | src/lib/pubkey/ec_group/point_gfp.cpp | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/pubkey/ec_group/curve_gfp.h b/src/lib/pubkey/ec_group/curve_gfp.h index 158f7f8c8..77c04ebf3 100644 --- a/src/lib/pubkey/ec_group/curve_gfp.h +++ b/src/lib/pubkey/ec_group/curve_gfp.h @@ -163,7 +163,7 @@ class BOTAN_UNSTABLE_API CurveGFp final m_repr->from_curve_rep(x, ws); } - BigInt from_rep(const BigInt& x, secure_vector<word>& ws) const + BigInt from_rep_to_tmp(const BigInt& x, secure_vector<word>& ws) const { BigInt xt(x); m_repr->from_curve_rep(xt, ws); diff --git a/src/lib/pubkey/ec_group/point_gfp.cpp b/src/lib/pubkey/ec_group/point_gfp.cpp index 9a9667175..c78763829 100644 --- a/src/lib/pubkey/ec_group/point_gfp.cpp +++ b/src/lib/pubkey/ec_group/point_gfp.cpp @@ -504,7 +504,7 @@ BigInt PointGFp::get_affine_x() const secure_vector<word> monty_ws; if(is_affine()) - return m_curve.from_rep(m_coord_x, monty_ws); + return m_curve.from_rep_to_tmp(m_coord_x, monty_ws); BigInt z2 = m_curve.sqr_to_tmp(m_coord_z, monty_ws); z2 = m_curve.invert_element(z2, monty_ws); @@ -523,7 +523,7 @@ BigInt PointGFp::get_affine_y() const secure_vector<word> monty_ws; if(is_affine()) - return m_curve.from_rep(m_coord_y, monty_ws); + return m_curve.from_rep_to_tmp(m_coord_y, monty_ws); const BigInt z2 = m_curve.sqr_to_tmp(m_coord_z, monty_ws); const BigInt z3 = m_curve.mul_to_tmp(m_coord_z, z2, monty_ws); @@ -548,14 +548,14 @@ bool PointGFp::on_the_curve() const secure_vector<word> monty_ws; - const BigInt y2 = m_curve.from_rep(m_curve.sqr_to_tmp(m_coord_y, monty_ws), monty_ws); + const BigInt y2 = m_curve.from_rep_to_tmp(m_curve.sqr_to_tmp(m_coord_y, monty_ws), monty_ws); const BigInt x3 = m_curve.mul_to_tmp(m_coord_x, m_curve.sqr_to_tmp(m_coord_x, monty_ws), monty_ws); const BigInt ax = m_curve.mul_to_tmp(m_coord_x, m_curve.get_a_rep(), monty_ws); const BigInt z2 = m_curve.sqr_to_tmp(m_coord_z, monty_ws); if(m_coord_z == z2) // Is z equal to 1 (in Montgomery form)? { - if(y2 != m_curve.from_rep(x3 + ax + m_curve.get_b_rep(), monty_ws)) + if(y2 != m_curve.from_rep_to_tmp(x3 + ax + m_curve.get_b_rep(), monty_ws)) return false; } @@ -563,7 +563,7 @@ bool PointGFp::on_the_curve() const const BigInt ax_z4 = m_curve.mul_to_tmp(ax, m_curve.sqr_to_tmp(z2, monty_ws), monty_ws); const BigInt b_z6 = m_curve.mul_to_tmp(m_curve.get_b_rep(), m_curve.sqr_to_tmp(z3, monty_ws), monty_ws); - if(y2 != m_curve.from_rep(x3 + ax_z4 + b_z6, monty_ws)) + if(y2 != m_curve.from_rep_to_tmp(x3 + ax_z4 + b_z6, monty_ws)) return false; return true; |