diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2020-09-04 23:57:27 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2020-09-04 23:57:27 +0700 |
commit | 86a4479929bd5f3fa5ce2cabfe6a4ebb53944df4 (patch) | |
tree | 2610425aacd90c6153402495afa3ea84077c741c /crypto/src/math/ec/ECFieldElement.cs | |
parent | Remove unnecessary locking (diff) | |
download | BouncyCastle.NET-ed25519-86a4479929bd5f3fa5ce2cabfe6a4ebb53944df4.tar.xz |
'safegcd' modular inversion
Diffstat (limited to 'crypto/src/math/ec/ECFieldElement.cs')
-rw-r--r-- | crypto/src/math/ec/ECFieldElement.cs | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/crypto/src/math/ec/ECFieldElement.cs b/crypto/src/math/ec/ECFieldElement.cs index ef10dbf90..ed530b6b7 100644 --- a/crypto/src/math/ec/ECFieldElement.cs +++ b/crypto/src/math/ec/ECFieldElement.cs @@ -1,7 +1,6 @@ using System; using System.Diagnostics; -using Org.BouncyCastle.Math.Raw; using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Math.EC @@ -434,13 +433,7 @@ namespace Org.BouncyCastle.Math.EC protected virtual BigInteger ModInverse(BigInteger x) { - int bits = FieldSize; - int len = (bits + 31) >> 5; - uint[] p = Nat.FromBigInteger(bits, q); - uint[] n = Nat.FromBigInteger(bits, x); - uint[] z = Nat.Create(len); - Mod.Invert(p, n, z); - return Nat.ToBigInteger(len, z); + return BigIntegers.ModOddInverse(q, x); } protected virtual BigInteger ModMult(BigInteger x1, BigInteger x2) |