summary refs log tree commit diff
path: root/crypto/src
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2014-03-12 18:13:12 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2014-03-12 18:13:12 +0700
commit4b5cf5479807fc2652888be79fca4ab659662306 (patch)
treeea348719135acaa53a393f632ad31975e2c16de9 /crypto/src
parentAllow subclasses to override the ECMultiplier used for base-point multiplication (diff)
downloadBouncyCastle.NET-ed25519-4b5cf5479807fc2652888be79fca4ab659662306.tar.xz
All subclasses to control the choice of width to use
Diffstat (limited to 'crypto/src')
-rw-r--r--crypto/src/math/ec/multiplier/FixedPointCombMultiplier.cs8
1 files changed, 6 insertions, 2 deletions
diff --git a/crypto/src/math/ec/multiplier/FixedPointCombMultiplier.cs b/crypto/src/math/ec/multiplier/FixedPointCombMultiplier.cs
index 48ce4a56c..e3da3f7c2 100644
--- a/crypto/src/math/ec/multiplier/FixedPointCombMultiplier.cs
+++ b/crypto/src/math/ec/multiplier/FixedPointCombMultiplier.cs
@@ -21,8 +21,7 @@ namespace Org.BouncyCastle.Math.EC.Multiplier
                 throw new InvalidOperationException("fixed-point comb doesn't support scalars larger than the curve order");
             }
 
-            // TODO Call method to let subclasses select width
-            int width = size > 257 ? 6 : 5;
+            int width = GetWidthForCombSize(size);
 
             FixedPointPreCompInfo info = FixedPointUtilities.Precompute(p, width);
             ECPoint[] lookupTable = info.PreComp;
@@ -50,5 +49,10 @@ namespace Org.BouncyCastle.Math.EC.Multiplier
 
             return R;
         }
+
+        protected virtual int GetWidthForCombSize(int combSize)
+        {
+            return combSize > 257 ? 6 : 5;
+        }
     }
 }