diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2014-01-04 08:27:12 +0400 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2014-01-04 08:27:12 +0400 |
commit | e785a07ead8e4beea8c1d49aadcc255be1cf8f8b (patch) | |
tree | 93371f20aec237adbf1cffa890399527e6be18b8 | |
parent | 817be8c7009fbb6abd1ff007e015de9d3c2b7dab (diff) |
Change shiftUp to take the full incoming carry word as input
-rw-r--r-- | core/src/main/java/org/bouncycastle/math/ec/custom/sec/Nat256.java | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/core/src/main/java/org/bouncycastle/math/ec/custom/sec/Nat256.java b/core/src/main/java/org/bouncycastle/math/ec/custom/sec/Nat256.java index 2ab81a70..124bcbe3 100644 --- a/core/src/main/java/org/bouncycastle/math/ec/custom/sec/Nat256.java +++ b/core/src/main/java/org/bouncycastle/math/ec/custom/sec/Nat256.java @@ -444,15 +444,15 @@ public abstract class Nat256 return (int)c; } - public static int shiftUp(int[] x, int xLen, int bit) + public static int shiftUp(int[] x, int xLen, int c) { for (int i = 0; i < xLen; ++i) { int next = x[i]; - x[i] = (next << 1) | bit; - bit = next >>> 31; + x[i] = (next << 1) | (c >>> 31); + c = next; } - return bit; + return c >>> 31; } public static void square(int[] x, int[] zz) @@ -630,7 +630,7 @@ public abstract class Nat256 zz[14] = (int)zz_14; zz[15] = (int)zz_15; - shiftUp(zz, 16, (int)x_0 & 1); + shiftUp(zz, 16, (int)x_0 << 31); } public static int sub(int[] x, int[] y, int[] z) |