summary refs log tree commit diff
path: root/crypto
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2014-01-24 19:18:21 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2014-01-24 19:18:21 +0700
commit6b5b1051ee235bd75b34e81ebb9e08a88fe5cede (patch)
tree739b56eac85317cf26866dceddbc3f40b20c0e6a /crypto
parentSome more EC point normalization (diff)
downloadBouncyCastle.NET-ed25519-6b5b1051ee235bd75b34e81ebb9e08a88fe5cede.tar.xz
Formatting
Diffstat (limited to 'crypto')
-rw-r--r--crypto/src/crypto/parameters/ECPrivateKeyParameters.cs132
-rw-r--r--crypto/test/src/math/ec/test/ECPointPerformanceTest.cs12
2 files changed, 70 insertions, 74 deletions
diff --git a/crypto/src/crypto/parameters/ECPrivateKeyParameters.cs b/crypto/src/crypto/parameters/ECPrivateKeyParameters.cs
index e6352d5d1..4d0fa1fc6 100644
--- a/crypto/src/crypto/parameters/ECPrivateKeyParameters.cs
+++ b/crypto/src/crypto/parameters/ECPrivateKeyParameters.cs
@@ -7,81 +7,81 @@ using Org.BouncyCastle.Math;
 namespace Org.BouncyCastle.Crypto.Parameters
 {
     public class ECPrivateKeyParameters
-		: ECKeyParameters
+        : ECKeyParameters
     {
-		private readonly BigInteger d;
-
-		public ECPrivateKeyParameters(
-			BigInteger			d,
-			ECDomainParameters	parameters)
-			: this("EC", d, parameters)
-		{
-		}
-
-		[Obsolete("Use version with explicit 'algorithm' parameter")]
-		public ECPrivateKeyParameters(
-			BigInteger			d,
-			DerObjectIdentifier publicKeyParamSet)
-			: base("ECGOST3410", true, publicKeyParamSet)
-		{
-			if (d == null)
-				throw new ArgumentNullException("d");
-
-			this.d = d;
-		}
-
-		public ECPrivateKeyParameters(
-			string				algorithm,
-			BigInteger			d,
-			ECDomainParameters	parameters)
-			: base(algorithm, true, parameters)
-		{
-			if (d == null)
-				throw new ArgumentNullException("d");
-
-			this.d = d;
-		}
-
-		public ECPrivateKeyParameters(
-			string				algorithm,
-			BigInteger			d,
-			DerObjectIdentifier publicKeyParamSet)
-			: base(algorithm, true, publicKeyParamSet)
-		{
-			if (d == null)
-				throw new ArgumentNullException("d");
-
-			this.d = d;
-		}
-
-		public BigInteger D
-		{
-			get { return d; }
-		}
-
-		public override bool Equals(
-			object obj)
+        private readonly BigInteger d;
+
+        public ECPrivateKeyParameters(
+            BigInteger			d,
+            ECDomainParameters	parameters)
+            : this("EC", d, parameters)
+        {
+        }
+
+        [Obsolete("Use version with explicit 'algorithm' parameter")]
+        public ECPrivateKeyParameters(
+            BigInteger			d,
+            DerObjectIdentifier publicKeyParamSet)
+            : base("ECGOST3410", true, publicKeyParamSet)
         {
-			if (obj == this)
-				return true;
+            if (d == null)
+                throw new ArgumentNullException("d");
 
-			ECPrivateKeyParameters other = obj as ECPrivateKeyParameters;
+            this.d = d;
+        }
 
-			if (other == null)
-				return false;
+        public ECPrivateKeyParameters(
+            string				algorithm,
+            BigInteger			d,
+            ECDomainParameters	parameters)
+            : base(algorithm, true, parameters)
+        {
+            if (d == null)
+                throw new ArgumentNullException("d");
 
-			return Equals(other);
+            this.d = d;
         }
 
-		protected bool Equals(
-			ECPrivateKeyParameters other)
-		{
-			return d.Equals(other.d) && base.Equals(other);
-		}
+        public ECPrivateKeyParameters(
+            string				algorithm,
+            BigInteger			d,
+            DerObjectIdentifier publicKeyParamSet)
+            : base(algorithm, true, publicKeyParamSet)
+        {
+            if (d == null)
+                throw new ArgumentNullException("d");
+
+            this.d = d;
+        }
+
+        public BigInteger D
+        {
+            get { return d; }
+        }
+
+        public override bool Equals(
+            object obj)
+        {
+            if (obj == this)
+                return true;
+
+            ECPrivateKeyParameters other = obj as ECPrivateKeyParameters;
+
+            if (other == null)
+                return false;
+
+            return Equals(other);
+        }
+
+        protected bool Equals(
+            ECPrivateKeyParameters other)
+        {
+            return d.Equals(other.d) && base.Equals(other);
+        }
 
-		public override int GetHashCode()
+        public override int GetHashCode()
         {
             return d.GetHashCode() ^ base.GetHashCode();
         }
-	}
+    }
 }
diff --git a/crypto/test/src/math/ec/test/ECPointPerformanceTest.cs b/crypto/test/src/math/ec/test/ECPointPerformanceTest.cs
index f9e89eccf..a077d1f92 100644
--- a/crypto/test/src/math/ec/test/ECPointPerformanceTest.cs
+++ b/crypto/test/src/math/ec/test/ECPointPerformanceTest.cs
@@ -135,15 +135,11 @@ namespace Org.BouncyCastle.Math.EC.Tests
             ISet oids = new HashSet();
             foreach (string name in names)
             {
-                //if (name.StartsWith("P-"))
-                //if (name.Equals("secp256r1"))
+                DerObjectIdentifier oid = ECNamedCurveTable.GetOid(name);
+                if (!oids.Contains(oid))
                 {
-                    DerObjectIdentifier oid = ECNamedCurveTable.GetOid(name);
-                    if (!oids.Contains(oid))
-                    {
-                        oids.Add(oid);
-                        RandMult(name);
-                    }
+                    oids.Add(oid);
+                    RandMult(name);
                 }
             }
         }