summary refs log tree commit diff
path: root/crypto/src/math/ec/Nat.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2014-02-06 10:31:12 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2014-02-06 10:31:12 +0700
commit9c89cec327d429564bd1e7b5cb92bdaae0acd8f9 (patch)
tree104baa918286eafc11b59446c73444f12a11ebc4 /crypto/src/math/ec/Nat.cs
parentAdd order/cofactor to the small test curves (diff)
downloadBouncyCastle.NET-ed25519-9c89cec327d429564bd1e7b5cb92bdaae0acd8f9.tar.xz
Initial work on the Curve25519 field implementation
Diffstat (limited to 'crypto/src/math/ec/Nat.cs')
-rw-r--r--crypto/src/math/ec/Nat.cs11
1 files changed, 11 insertions, 0 deletions
diff --git a/crypto/src/math/ec/Nat.cs b/crypto/src/math/ec/Nat.cs
index 821d5065d..91d86b674 100644
--- a/crypto/src/math/ec/Nat.cs
+++ b/crypto/src/math/ec/Nat.cs
@@ -365,6 +365,17 @@ namespace Org.BouncyCastle.Math.EC
             return c >> 31;
         }
 
+        public static uint ShiftUpBit(int len, uint[] x, int xOff, uint c, uint[] z)
+        {
+            for (int i = 0; i < len; ++i)
+            {
+                uint next = x[xOff + i];
+                z[i] = (next << 1) | (c >> 31);
+                c = next;
+            }
+            return c >> 31;
+        }
+
         public static uint ShiftUpBits(int len, uint[] z, int bits, uint c)
         {
             Debug.Assert(bits > 0 && bits < 32);