summary refs log tree commit diff
path: root/crypto/src/math/ec/custom/sec/SecP256R1Field.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2014-03-04 15:10:33 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2014-03-04 15:10:33 +0700
commitc2fe9bb1d2b4d3b8e01642068714c824a3c74581 (patch)
treee5a4712684f092946f6439e1e0e0938817313041 /crypto/src/math/ec/custom/sec/SecP256R1Field.cs
parentJust use shift methods from Nat class evverywhere (diff)
downloadBouncyCastle.NET-ed25519-c2fe9bb1d2b4d3b8e01642068714c824a3c74581.tar.xz
Remove some length-specific methods in favour of the Nat class
Add more method variations to Nat
Use customized reductions in various fields
Diffstat (limited to 'crypto/src/math/ec/custom/sec/SecP256R1Field.cs')
-rw-r--r--crypto/src/math/ec/custom/sec/SecP256R1Field.cs11
1 files changed, 5 insertions, 6 deletions
diff --git a/crypto/src/math/ec/custom/sec/SecP256R1Field.cs b/crypto/src/math/ec/custom/sec/SecP256R1Field.cs
index 9bcb0e98e..de383046d 100644
--- a/crypto/src/math/ec/custom/sec/SecP256R1Field.cs
+++ b/crypto/src/math/ec/custom/sec/SecP256R1Field.cs
@@ -26,17 +26,16 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec
 
         public static void AddExt(uint[] xx, uint[] yy, uint[] zz)
         {
-            uint c = Nat256.AddExt(xx, yy, zz);
+            uint c = Nat.Add(16, xx, yy, zz);
             if (c != 0 || Nat256.GteExt(zz, PExt))
             {
-                Nat256.SubExt(zz, PExt, zz);
+                Nat.SubFrom(16, PExt, zz);
             }
         }
 
         public static void AddOne(uint[] x, uint[] z)
         {
-            Nat256.Copy(x, z);
-            uint c = Nat256.Inc(z, 0);
+            uint c = Nat.Inc(8, x, z);
             if (c != 0 || (z[7] == P7 && Nat256.Gte(z, P)))
             {
                 Nat256.SubFrom(P, z);
@@ -217,10 +216,10 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec
 
         public static void SubtractExt(uint[] xx, uint[] yy, uint[] zz)
         {
-            int c = Nat256.SubExt(xx, yy, zz);
+            int c = Nat.Sub(16, xx, yy, zz);
             if (c != 0)
             {
-                Nat256.AddExt(zz, PExt, zz);
+                Nat.AddTo(16, PExt, zz);
             }
         }