summary refs log tree commit diff
path: root/crypto/src/math
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/math')
-rw-r--r--crypto/src/math/ec/ECAlgorithms.cs5
1 files changed, 2 insertions, 3 deletions
diff --git a/crypto/src/math/ec/ECAlgorithms.cs b/crypto/src/math/ec/ECAlgorithms.cs
index e7a7189b7..7b04fb56e 100644
--- a/crypto/src/math/ec/ECAlgorithms.cs
+++ b/crypto/src/math/ec/ECAlgorithms.cs
@@ -584,12 +584,11 @@ namespace Org.BouncyCastle.Math.EC
 
             ECPoint R = c.Infinity;
 
-            int top = fullComb - 1; 
-            for (int i = 0; i < d; ++i)
+            for (int i = 1; i <= d; ++i)
             {
                 uint secretIndexK = 0, secretIndexL = 0;
 
-                for (int j = top - i; j >= 0; j -= d)
+                for (int j = fullComb - i; j >= 0; j -= d)
                 {
                     uint secretBitK = K[j >> 5] >> (j & 0x1F);
                     secretIndexK ^= secretBitK >> 1;