diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2014-03-10 18:49:59 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2014-03-10 18:49:59 +0700 |
commit | 14fc40083d81fda4598efbf8f9fd29c71d825adb (patch) | |
tree | 7542e7901435791043fcfc5c4f346fb2ceecbf1a /crypto/src/math/ec/custom/sec/SecP256K1Field.cs | |
parent | Refactor temporary variables in reductions (diff) | |
download | BouncyCastle.NET-ed25519-14fc40083d81fda4598efbf8f9fd29c71d825adb.tar.xz |
Add MultiplyAddToExt method to fields
Diffstat (limited to 'crypto/src/math/ec/custom/sec/SecP256K1Field.cs')
-rw-r--r-- | crypto/src/math/ec/custom/sec/SecP256K1Field.cs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/crypto/src/math/ec/custom/sec/SecP256K1Field.cs b/crypto/src/math/ec/custom/sec/SecP256K1Field.cs index 42564fd4f..ba3a070a9 100644 --- a/crypto/src/math/ec/custom/sec/SecP256K1Field.cs +++ b/crypto/src/math/ec/custom/sec/SecP256K1Field.cs @@ -77,6 +77,18 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec Reduce(tt, z); } + public static void MultiplyAddToExt(uint[] x, uint[] y, uint[] zz) + { + uint c = Nat256.MulAddTo(x, y, zz); + if (c != 0 || (zz[15] == PExt15 && Nat.Gte(16, zz, PExt))) + { + if (Nat.AddTo(PExtInv.Length, PExtInv, zz) != 0) + { + Nat.IncAt(16, zz, PExtInv.Length); + } + } + } + public static void Negate(uint[] x, uint[] z) { if (Nat256.IsZero(x)) |