diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2014-03-17 15:45:27 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2014-03-17 15:45:27 +0700 |
commit | c368e7ca8460a11d02d2a85588bac51ec71b0424 (patch) | |
tree | 5ab2b0ae196cc36404170807bbc8ec52ed4b315a /crypto/test | |
parent | Take advantage of GLV (when available) in sum-of-multiplies methods (diff) | |
download | BouncyCastle.NET-ed25519-c368e7ca8460a11d02d2a85588bac51ec71b0424.tar.xz |
Port of latest Curve25519 stuff from Java build
Diffstat (limited to 'crypto/test')
-rw-r--r-- | crypto/test/src/math/ec/test/ECPointPerformanceTest.cs | 14 | ||||
-rw-r--r-- | crypto/test/src/math/ec/test/ECPointTest.cs | 15 |
2 files changed, 24 insertions, 5 deletions
diff --git a/crypto/test/src/math/ec/test/ECPointPerformanceTest.cs b/crypto/test/src/math/ec/test/ECPointPerformanceTest.cs index 04bc43716..51febaf32 100644 --- a/crypto/test/src/math/ec/test/ECPointPerformanceTest.cs +++ b/crypto/test/src/math/ec/test/ECPointPerformanceTest.cs @@ -175,17 +175,27 @@ namespace Org.BouncyCastle.Math.EC.Tests { ArrayList nameList = new ArrayList(); CollectionUtilities.AddRange(nameList, ECNamedCurveTable.Names); + CollectionUtilities.AddRange(nameList, CustomNamedCurves.Names); + string[] names = (string[])nameList.ToArray(typeof(string)); Array.Sort(names); ISet oids = new HashSet(); foreach (string name in names) { DerObjectIdentifier oid = ECNamedCurveTable.GetOid(name); - if (!oids.Contains(oid)) + if (oid == null) + { + oid = CustomNamedCurves.GetOid(name); + } + if (oid != null) { + if (oids.Contains(oid)) + continue; + oids.Add(oid); - RandMult(name); } + + RandMult(name); } } diff --git a/crypto/test/src/math/ec/test/ECPointTest.cs b/crypto/test/src/math/ec/test/ECPointTest.cs index 22227eed1..4bad914fd 100644 --- a/crypto/test/src/math/ec/test/ECPointTest.cs +++ b/crypto/test/src/math/ec/test/ECPointTest.cs @@ -1,4 +1,5 @@ using System; +using System.Collections; using NUnit.Framework; @@ -9,6 +10,7 @@ using Org.BouncyCastle.Math; using Org.BouncyCastle.Math.EC; using Org.BouncyCastle.Security; using Org.BouncyCastle.Utilities; +using Org.BouncyCastle.Utilities.Collections; namespace Org.BouncyCastle.Math.EC.Tests { @@ -506,10 +508,17 @@ namespace Org.BouncyCastle.Math.EC.Tests [Test] public void TestAddSubtractMultiplyTwiceEncoding() { - foreach (string name in ECNamedCurveTable.Names) + ArrayList names = new ArrayList(); + CollectionUtilities.AddRange(names, ECNamedCurveTable.Names); + CollectionUtilities.AddRange(names, CustomNamedCurves.Names); + + foreach (string name in names) { X9ECParameters x9ECParameters = ECNamedCurveTable.GetByName(name); - ImplAddSubtractMultiplyTwiceEncodingTestAllCoords(x9ECParameters); + if (x9ECParameters != null) + { + ImplAddSubtractMultiplyTwiceEncodingTestAllCoords(x9ECParameters); + } x9ECParameters = CustomNamedCurves.GetByName(name); if (x9ECParameters != null) @@ -521,7 +530,7 @@ namespace Org.BouncyCastle.Math.EC.Tests private void AssertPointsEqual(string message, ECPoint a, ECPoint b) { - Assert.AreEqual(a, b, message); + Assert.AreEqual(a, b, message); } } } |