diff options
author | Jack Lloyd <[email protected]> | 2018-03-01 16:43:00 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-03-01 16:43:00 -0500 |
commit | 03e3d3dac4b50a6da3cfec2971460c1182cebd9d (patch) | |
tree | 138de40cea1cbc886167fbeb41bf0748de5805ba /src/lib/pubkey/ec_group | |
parent | 23e248260ea913227a8d224f64cd9ff592ac8b6b (diff) |
Remove BigInt using functions from mp layer
Diffstat (limited to 'src/lib/pubkey/ec_group')
-rw-r--r-- | src/lib/pubkey/ec_group/curve_gfp.cpp | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/lib/pubkey/ec_group/curve_gfp.cpp b/src/lib/pubkey/ec_group/curve_gfp.cpp index 1bca04d07..caaca0a9a 100644 --- a/src/lib/pubkey/ec_group/curve_gfp.cpp +++ b/src/lib/pubkey/ec_group/curve_gfp.cpp @@ -89,9 +89,14 @@ void CurveGFp_Montgomery::curve_mul(BigInt& z, const BigInt& x, const BigInt& y, z.grow_to(output_size); z.clear(); - bigint_monty_mul(z, x, y, - m_p.data(), m_p_words, m_p_dash, - ws.data(), ws.size()); + bigint_mul(z.mutable_data(), z.size(), + x.data(), x.size(), x.sig_words(), + y.data(), y.size(), y.sig_words(), + ws.data(), ws.size()); + + bigint_monty_redc(z.mutable_data(), + m_p.data(), m_p_words, m_p_dash, + ws.data(), ws.size()); } void CurveGFp_Montgomery::curve_sqr(BigInt& z, const BigInt& x, @@ -114,8 +119,13 @@ void CurveGFp_Montgomery::curve_sqr(BigInt& z, const BigInt& x, z.grow_to(output_size); z.clear(); - bigint_monty_sqr(z, x, m_p.data(), m_p_words, m_p_dash, - ws.data(), ws.size()); + bigint_sqr(z.mutable_data(), z.size(), + x.data(), x.size(), x_sw, + ws.data(), ws.size()); + + bigint_monty_redc(z.mutable_data(), + m_p.data(), m_p_words, m_p_dash, + ws.data(), ws.size()); } class CurveGFp_NIST : public CurveGFp_Repr @@ -173,7 +183,10 @@ void CurveGFp_NIST::curve_mul(BigInt& z, const BigInt& x, const BigInt& y, z.grow_to(output_size); z.clear(); - bigint_mul(z, x, y, ws.data(), ws.size()); + bigint_mul(z.mutable_data(), z.size(), + x.data(), x.size(), x.sig_words(), + y.data(), y.size(), y.sig_words(), + ws.data(), ws.size()); this->redc(z, ws); } |