summary refs log tree commit diff
path: root/crypto/src/math/ec/custom/sec/SecP256K1Field.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/math/ec/custom/sec/SecP256K1Field.cs')
-rw-r--r--crypto/src/math/ec/custom/sec/SecP256K1Field.cs26
1 files changed, 26 insertions, 0 deletions
diff --git a/crypto/src/math/ec/custom/sec/SecP256K1Field.cs b/crypto/src/math/ec/custom/sec/SecP256K1Field.cs
index 9a8915c01..a065ee790 100644
--- a/crypto/src/math/ec/custom/sec/SecP256K1Field.cs
+++ b/crypto/src/math/ec/custom/sec/SecP256K1Field.cs
@@ -97,6 +97,12 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec
             Reduce(tt, z);
         }
 
+        public static void Multiply(uint[] x, uint[] y, uint[] z, uint[] tt)
+        {
+            Nat256.Mul(x, y, tt);
+            Reduce(tt, z);
+        }
+
         public static void MultiplyAddToExt(uint[] x, uint[] y, uint[] zz)
         {
             uint c = Nat256.MulAddTo(x, y, zz);
@@ -170,6 +176,12 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec
             Reduce(tt, z);
         }
 
+        public static void Square(uint[] x, uint[] z, uint[] tt)
+        {
+            Nat256.Square(x, tt);
+            Reduce(tt, z);
+        }
+
         public static void SquareN(uint[] x, int n, uint[] z)
         {
             Debug.Assert(n > 0);
@@ -185,6 +197,20 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec
             }
         }
 
+        public static void SquareN(uint[] x, int n, uint[] z, uint[] tt)
+        {
+            Debug.Assert(n > 0);
+
+            Nat256.Square(x, tt);
+            Reduce(tt, z);
+
+            while (--n > 0)
+            {
+                Nat256.Square(z, tt);
+                Reduce(tt, z);
+            }
+        }
+
         public static void Subtract(uint[] x, uint[] y, uint[] z)
         {
             int c = Nat256.Sub(x, y, z);