From d2c21efe437d17d375cbe81d0d2c3968cfab44c7 Mon Sep 17 00:00:00 2001 From: David Hook Date: Wed, 23 Mar 2022 15:12:05 +1100 Subject: minor corrections, updated ECPointTest --- crypto/src/crypto/parameters/RsaKeyParameters.cs | 2 +- crypto/src/math/ec/ECCurve.cs | 9 ++++++--- crypto/test/src/math/ec/test/ECPointTest.cs | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/crypto/src/crypto/parameters/RsaKeyParameters.cs b/crypto/src/crypto/parameters/RsaKeyParameters.cs index b1e1a8edf..4f8dba680 100644 --- a/crypto/src/crypto/parameters/RsaKeyParameters.cs +++ b/crypto/src/crypto/parameters/RsaKeyParameters.cs @@ -91,7 +91,7 @@ namespace Org.BouncyCastle.Crypto.Parameters return modulus.GetHashCode() ^ exponent.GetHashCode() ^ IsPrivate.GetHashCode(); } - int AsInteger(string envVariable, int defaultValue) + internal static int AsInteger(string envVariable, int defaultValue) { String v = Platform.GetEnvironmentVariable(envVariable); diff --git a/crypto/src/math/ec/ECCurve.cs b/crypto/src/math/ec/ECCurve.cs index 2b193ba06..3861dc4cb 100644 --- a/crypto/src/math/ec/ECCurve.cs +++ b/crypto/src/math/ec/ECCurve.cs @@ -700,9 +700,12 @@ namespace Org.BouncyCastle.Math.EC if (isInternal) { this.m_q = q; - knownQs.add(q); + if (!knownQs.Contains(q)) + { + knownQs.Add(q, q); + } } - else if (knownQs.contains(q)) + else if (knownQs.Contains(q)) { this.m_q = q; } @@ -718,7 +721,7 @@ namespace Org.BouncyCastle.Math.EC } if (Primes.HasAnySmallFactors(q) || !Primes.IsMRProbablePrime( - q, random, getNumberOfIterations(qBitLength, certainty))) + q, random, GetNumberOfIterations(qBitLength, certainty))) { throw new ArgumentException("Fp q value not prime"); } diff --git a/crypto/test/src/math/ec/test/ECPointTest.cs b/crypto/test/src/math/ec/test/ECPointTest.cs index e1a2b8a6a..4b17d8c0a 100644 --- a/crypto/test/src/math/ec/test/ECPointTest.cs +++ b/crypto/test/src/math/ec/test/ECPointTest.cs @@ -32,7 +32,7 @@ namespace Org.BouncyCastle.Math.EC.Tests */ public class Fp { - internal static readonly BigInteger q = new BigInteger("29"); + internal static readonly BigInteger q = new BigInteger("1063"); internal static readonly BigInteger a = new BigInteger("4"); @@ -46,7 +46,7 @@ namespace Org.BouncyCastle.Math.EC.Tests internal static readonly ECPoint infinity = curve.Infinity; - internal static readonly int[] pointSource = { 5, 22, 16, 27, 13, 6, 14, 6 }; + internal static readonly int[] pointSource = { 1, 5, 4, 10, 234, 1024, 817, 912 }; internal static ECPoint[] p = new ECPoint[pointSource.Length / 2]; -- cgit 1.4.1