diff options
author | lloyd <[email protected]> | 2010-03-13 05:59:40 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-03-13 05:59:40 +0000 |
commit | 7e4dbc6a15e62a91127a93478e190621ec1edf77 (patch) | |
tree | 46b0d282c02a966b103d69e1882bb0e655a86fb6 /src/math/numbertheory/point_gfp.cpp | |
parent | b6851ef0eecf0910e310d27da6afe3bd926bfc8a (diff) |
More monty_mult cleanups
Diffstat (limited to 'src/math/numbertheory/point_gfp.cpp')
-rw-r--r-- | src/math/numbertheory/point_gfp.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/math/numbertheory/point_gfp.cpp b/src/math/numbertheory/point_gfp.cpp index 25b267822..980bbdc3e 100644 --- a/src/math/numbertheory/point_gfp.cpp +++ b/src/math/numbertheory/point_gfp.cpp @@ -43,9 +43,6 @@ BigInt PointGFp::monty_mult(const BigInt& a, const BigInt& b) const word p_dash = curve.get_p_dash(); - BigInt result; - result.grow_to(2*p_size+1); - SecureVector<word> t; t.grow_to(2*p_size+1); @@ -66,9 +63,10 @@ BigInt PointGFp::monty_mult(const BigInt& a, const BigInt& b) bigint_simple_mul(t, a2.data(), a2.sig_words(), b2.data(), b2.sig_words()); } - bigint_monty_redc(&t[0], t.size(), p.data(), p_size, p_dash); - - copy_mem(&result[0], &t[p_size], p_size); + BigInt result; + std::swap(result.get_reg(), t); + bigint_monty_redc(result.get_reg(), result.size(), p.data(), p_size, p_dash); + result >>= p_size*BOTAN_MP_WORD_BITS; return result; } |