aboutsummaryrefslogtreecommitdiffstats
path: root/src/math/numbertheory/point_gfp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/math/numbertheory/point_gfp.cpp')
-rw-r--r--src/math/numbertheory/point_gfp.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/math/numbertheory/point_gfp.cpp b/src/math/numbertheory/point_gfp.cpp
index d4c68d1dc..2e4f99796 100644
--- a/src/math/numbertheory/point_gfp.cpp
+++ b/src/math/numbertheory/point_gfp.cpp
@@ -38,15 +38,15 @@ BigInt PointGFp::monty_mult(const BigInt& a, const BigInt& b,
return 0;
const BigInt& p = curve.get_p();
- const u32bit p_size = (workspace.size() - 1) / 2;
+ const u32bit p_size = p.sig_words();
const word p_dash = curve.get_p_dash();
workspace.clear();
- bigint_simple_mul(workspace,
- a.data(), a.sig_words(),
- b.data(), b.sig_words());
+ bigint_mul(workspace, workspace.size(), 0,
+ a.data(), a.size(), a.sig_words(),
+ b.data(), b.size(), b.sig_words());
bigint_monty_redc(workspace, workspace.size(),
p.data(), p_size, p_dash);
@@ -61,19 +61,18 @@ BigInt PointGFp::monty_mult(const BigInt& a, const BigInt& b,
BigInt PointGFp::monty_sqr(const BigInt& x,
MemoryRegion<word>& workspace)
{
- //return monty_mult(x, x, workspace);
-
if(x.is_zero())
return 0;
const BigInt& p = curve.get_p();
- const u32bit p_size = (workspace.size() - 1) / 2;
+ const u32bit p_size = p.sig_words();
const word p_dash = curve.get_p_dash();
workspace.clear();
- bigint_simple_sqr(workspace, x.data(), x.sig_words());
+ bigint_sqr(workspace, workspace.size(), 0,
+ x.data(), x.size(), x.sig_words());
bigint_monty_redc(workspace, workspace.size(),
p.data(), p_size, p_dash);