summary refs log tree commit diff
path: root/crypto/src/math/ec/multiplier/FixedPointCombMultiplier.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/math/ec/multiplier/FixedPointCombMultiplier.cs')
-rw-r--r--crypto/src/math/ec/multiplier/FixedPointCombMultiplier.cs13
1 files changed, 6 insertions, 7 deletions
diff --git a/crypto/src/math/ec/multiplier/FixedPointCombMultiplier.cs b/crypto/src/math/ec/multiplier/FixedPointCombMultiplier.cs
index 6449e1d8b..049c36f11 100644
--- a/crypto/src/math/ec/multiplier/FixedPointCombMultiplier.cs
+++ b/crypto/src/math/ec/multiplier/FixedPointCombMultiplier.cs
@@ -26,22 +26,21 @@ namespace Org.BouncyCastle.Math.EC.Multiplier
             FixedPointPreCompInfo info = FixedPointUtilities.Precompute(p);
             ECLookupTable lookupTable = info.LookupTable;
             int width = info.Width;
-
             int d = (size + width - 1) / width;
             int fullComb = d * width;
 
-            ECPoint R = c.Infinity;
-
 #if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
-            int KLen = Nat.GetLengthForBits(fullComb);
-            Span<uint> K = KLen <= 32
-                ? stackalloc uint[KLen]
-                : new uint[KLen];
+            int len = Nat.GetLengthForBits(fullComb);
+            Span<uint> K = len <= 64
+                ? stackalloc uint[len]
+                : new uint[len];
             Nat.FromBigInteger(fullComb, k, K);
 #else
             uint[] K = Nat.FromBigInteger(fullComb, k);
 #endif
 
+            ECPoint R = c.Infinity;
+
             for (int i = 1; i <= d; ++i)
             {
                 uint secretIndex = 0;