summary refs log tree commit diff
path: root/crypto/src/math/ec/ECCurve.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/math/ec/ECCurve.cs')
-rw-r--r--crypto/src/math/ec/ECCurve.cs7
1 files changed, 4 insertions, 3 deletions
diff --git a/crypto/src/math/ec/ECCurve.cs b/crypto/src/math/ec/ECCurve.cs

index 396d42f28..ab98af8f1 100644 --- a/crypto/src/math/ec/ECCurve.cs +++ b/crypto/src/math/ec/ECCurve.cs
@@ -114,12 +114,13 @@ namespace Org.BouncyCastle.Math.EC */ public class FpCurve : ECCurve { - private readonly BigInteger q; + private readonly BigInteger q, r; private readonly FpPoint infinity; public FpCurve(BigInteger q, BigInteger a, BigInteger b) { this.q = q; + this.r = FpFieldElement.CalculateResidue(q); this.a = FromBigInteger(a); this.b = FromBigInteger(b); this.infinity = new FpPoint(this, null, null); @@ -142,7 +143,7 @@ namespace Org.BouncyCastle.Math.EC public override ECFieldElement FromBigInteger(BigInteger x) { - return new FpFieldElement(this.q, x); + return new FpFieldElement(this.q, this.r, x); } public override ECPoint CreatePoint( @@ -179,7 +180,7 @@ namespace Org.BouncyCastle.Math.EC if (bit0 != yTilde) { // Use the other root - beta = FromBigInteger(q.Subtract(betaValue)); + beta = beta.Negate(); } return new FpPoint(this, x, beta, true);