summary refs log tree commit diff
path: root/crypto/src/math/ec/custom/sec/SecP521R1Field.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/math/ec/custom/sec/SecP521R1Field.cs')
-rw-r--r--crypto/src/math/ec/custom/sec/SecP521R1Field.cs17
1 files changed, 8 insertions, 9 deletions
diff --git a/crypto/src/math/ec/custom/sec/SecP521R1Field.cs b/crypto/src/math/ec/custom/sec/SecP521R1Field.cs
index 7b2c7bada..3896e09d1 100644
--- a/crypto/src/math/ec/custom/sec/SecP521R1Field.cs
+++ b/crypto/src/math/ec/custom/sec/SecP521R1Field.cs
@@ -15,7 +15,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec
             uint c = Nat.Add(16, x, y, z) + x[16] + y[16];
             if (c > P16 || (c == P16 && Nat.Eq(16, z, P)))
             {
-                c += Nat.Inc(16, z, 0);
+                c += Nat.Inc(16, z);
                 c &= P16;
             }
             z[16] = c;
@@ -23,11 +23,10 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec
 
         public static void AddOne(uint[] x, uint[] z)
         {
-            Nat.Copy(16, x, z);
-            uint c = Nat.Inc(16, z, 0) + x[16];
+            uint c = Nat.Inc(16, x, z) + x[16];
             if (c > P16 || (c == P16 && Nat.Eq(16, z, P)))
             {
-                c += Nat.Inc(16, z, 0);
+                c += Nat.Inc(16, z);
                 c &= P16;
             }
             z[16] = c;
@@ -73,12 +72,12 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec
         {
             Debug.Assert(xx[32] >> 18 == 0);
             uint xx32 = xx[32];
-            uint c = Nat.ShiftDownBits(16, xx, 16, 9, xx32, z) >> 23;
+            uint c = Nat.ShiftDownBits(16, xx, 16, 9, xx32, z, 0) >> 23;
             c += xx32 >> 9;
             c += Nat.Add(16, z, xx, z);
             if (c > P16 || (c == P16 && Nat.Eq(16, z, P)))
             {
-                c += Nat.Inc(16, z, 0);
+                c += Nat.Inc(16, z);
                 c &= P16;
             }
             z[16] = c;
@@ -87,10 +86,10 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec
         public static void Reduce23(uint[] z)
         {
             uint z16 = z[16];
-            uint c = Nat.AddWord(16, z16 >> 9, z, 0) + (z16 & P16);
+            uint c = Nat.AddWordAt(16, z16 >> 9, z, 0) + (z16 & P16);
             if (c > P16 || (c == P16 && Nat.Eq(16, z, P)))
             {
-                c += Nat.Inc(16, z, 0);
+                c += Nat.Inc(16, z);
                 c &= P16;
             }
             z[16] = c;
@@ -122,7 +121,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec
             int c = Nat.Sub(16, x, y, z) + (int)(x[16] - y[16]);
             if (c < 0)
             {
-                c += Nat.Dec(16, z, 0);
+                c += Nat.Dec(16, z);
                 c &= P16;
             }
             z[16] = (uint)c;