Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/quite/humla-spongycastle.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/main/java/org/bouncycastle/math/ec/LongArray.java')
-rw-r--r--core/src/main/java/org/bouncycastle/math/ec/LongArray.java34
1 files changed, 28 insertions, 6 deletions
diff --git a/core/src/main/java/org/bouncycastle/math/ec/LongArray.java b/core/src/main/java/org/bouncycastle/math/ec/LongArray.java
index ad3e6225..4b972fc6 100644
--- a/core/src/main/java/org/bouncycastle/math/ec/LongArray.java
+++ b/core/src/main/java/org/bouncycastle/math/ec/LongArray.java
@@ -521,35 +521,52 @@ class LongArray
long[] c1 = new long[cLen];
long[] c2 = new long[cLen];
long[] c3 = new long[cLen];
+ long[] c10 = new long[cLen];
+ long[] c32 = new long[cLen];
- long bit1 = 1L << 48;
+ long bit3 = 1L << 48;
for (;;)
{
- long bit2 = bit1 >>> 16, bit3 = bit2 >>> 16, bit4 = bit3 >>> 16;
+ long bit2 = bit3 >>> 16, bit1 = bit2 >>> 16, bit0 = bit1 >>> 16;
+ long bit32 = bit3 | bit2, bit10 = bit1 | bit0;
for (int aPos = 0; aPos < aLen; ++aPos)
{
long aVal = a[aPos];
- if ((aVal & bit1) != 0)
+
+ if ((aVal & bit32) == bit32)
+ {
+ addShiftedByWordsQuick(c32, aPos, b);
+ }
+ else
+ if ((aVal & bit3) != 0)
{
addShiftedByWordsQuick(c3, aPos, b);
}
+ else
if ((aVal & bit2) != 0)
{
addShiftedByWordsQuick(c2, aPos, b);
}
- if ((aVal & bit3) != 0)
+
+ if ((aVal & bit10) == bit10)
+ {
+ addShiftedByWordsQuick(c10, aPos, b);
+ }
+ else
+ if ((aVal & bit1) != 0)
{
addShiftedByWordsQuick(c1, aPos, b);
}
- if ((aVal & bit4) != 0)
+ else
+ if ((aVal & bit0) != 0)
{
addShiftedByWordsQuick(c0, aPos, b);
}
}
- if ((bit1 <<= 1) == 0L)
+ if ((bit3 <<= 1) == 0L)
{
break;
}
@@ -557,6 +574,11 @@ class LongArray
shiftLeftQuick(b);
}
+ addQuick(c3, c32, cLen);
+ addQuick(c2, c32, cLen);
+ addQuick(c1, c10, cLen);
+ addQuick(c0, c10, cLen);
+
addShiftedByBitsQuick(c0, c1, cLen, 16);
addShiftedByBitsQuick(c0, c2, cLen, 32);
addShiftedByBitsQuick(c0, c3, cLen, 48);