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.cs12
1 files changed, 12 insertions, 0 deletions
diff --git a/crypto/src/math/ec/custom/sec/SecP521R1Field.cs b/crypto/src/math/ec/custom/sec/SecP521R1Field.cs
index 43f012b8b..f39a0daa6 100644
--- a/crypto/src/math/ec/custom/sec/SecP521R1Field.cs
+++ b/crypto/src/math/ec/custom/sec/SecP521R1Field.cs
@@ -85,6 +85,18 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec
             z[16] = c;
         }
 
+        public static void Reduce23(uint[] z)
+        {
+            uint z16 = z[16];
+            uint c = Nat.AddWord(16, z16 >> 9, z) + (z16 & P16);
+            if (c > P16 || (c == P16 && Nat.Eq(16, z, P)))
+            {
+                c += Nat.Inc(16, z, 0);
+                c &= P16;
+            }
+            z[16] = c;
+        }
+
         public static void Square(uint[] x, uint[] z)
         {
             uint[] tt = Nat.Create(34);