aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/math/ec_gfp/point_gfp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/math/ec_gfp/point_gfp.cpp')
-rw-r--r--src/lib/math/ec_gfp/point_gfp.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/math/ec_gfp/point_gfp.cpp b/src/lib/math/ec_gfp/point_gfp.cpp
index 3d244d0f0..6bae35e5f 100644
--- a/src/lib/math/ec_gfp/point_gfp.cpp
+++ b/src/lib/math/ec_gfp/point_gfp.cpp
@@ -479,18 +479,20 @@ BigInt decompress_point(bool yMod2,
{
BigInt xpow3 = x * x * x;
+ const BigInt& p = curve.get_p();
+
BigInt g = curve.get_a() * x;
g += xpow3;
g += curve.get_b();
- g = g % curve.get_p();
+ g = g % p;
- BigInt z = ressol(g, curve.get_p());
+ BigInt z = ressol(g, p);
if(z < 0)
throw Illegal_Point("error during EC point decompression");
if(z.get_bit(0) != yMod2)
- z = curve.get_p() - z;
+ z = p - z;
return z;
}