diff options
Diffstat (limited to 'crypto/src/math/ec/custom/sec/SecT113Field.cs')
-rw-r--r-- | crypto/src/math/ec/custom/sec/SecT113Field.cs | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/crypto/src/math/ec/custom/sec/SecT113Field.cs b/crypto/src/math/ec/custom/sec/SecT113Field.cs index 3c9e0938d..56738a219 100644 --- a/crypto/src/math/ec/custom/sec/SecT113Field.cs +++ b/crypto/src/math/ec/custom/sec/SecT113Field.cs @@ -87,14 +87,14 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec public static void Multiply(ulong[] x, ulong[] y, ulong[] z) { - ulong[] tt = Nat128.CreateExt64(); + ulong[] tt = new ulong[8]; ImplMultiply(x, y, tt); Reduce(tt, z); } public static void MultiplyAddToExt(ulong[] x, ulong[] y, ulong[] zz) { - ulong[] tt = Nat128.CreateExt64(); + ulong[] tt = new ulong[8]; ImplMultiply(x, y, tt); AddExt(zz, tt, zz); } @@ -180,11 +180,12 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec g1 = ((g0 >> 57) ^ (g1 << 7)) & M57; g0 &= M57; + ulong[] u = zz; ulong[] H = new ulong[6]; - ImplMulw(f0, g0, H, 0); // H(0) 57/56 bits - ImplMulw(f1, g1, H, 2); // H(INF) 57/54 bits - ImplMulw(f0 ^ f1, g0 ^ g1, H, 4); // H(1) 57/56 bits + ImplMulw(u, f0, g0, H, 0); // H(0) 57/56 bits + ImplMulw(u, f1, g1, H, 2); // H(INF) 57/54 bits + ImplMulw(u, f0 ^ f1, g0 ^ g1, H, 4); // H(1) 57/56 bits ulong r = H[1] ^ H[2]; ulong z0 = H[0], @@ -198,12 +199,11 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec zz[3] = (z3 >> 21); } - protected static void ImplMulw(ulong x, ulong y, ulong[] z, int zOff) + protected static void ImplMulw(ulong[] u, ulong x, ulong y, ulong[] z, int zOff) { Debug.Assert(x >> 57 == 0); Debug.Assert(y >> 57 == 0); - ulong[] u = new ulong[8]; //u[0] = 0; u[1] = y; u[2] = u[1] << 1; @@ -237,8 +237,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec protected static void ImplSquare(ulong[] x, ulong[] zz) { - Interleave.Expand64To128(x[0], zz, 0); - Interleave.Expand64To128(x[1], zz, 2); + Interleave.Expand64To128(x, 0, 2, zz, 0); } } } |