Skip to content

Commit 6a62eb1

Browse files
committed
changed ECPointTest to use a larger q.
1 parent c5bc01b commit 6a62eb1

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

core/src/main/java/org/bouncycastle/math/ec/ECCurve.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -716,8 +716,8 @@ else if (knownQs.contains(q) || validatedQs.contains(q))
716716
{
717717
throw new IllegalArgumentException("Fp q value out of range");
718718
}
719-
// TODO: need to fix ECPointsTest
720-
if (/* Primes.hasAnySmallFactors(q) ||*/ !Primes.isMRProbablePrime(
719+
720+
if (Primes.hasAnySmallFactors(q) || !Primes.isMRProbablePrime(
721721
q, CryptoServicesRegistrar.getSecureRandom(), getNumberOfIterations(qBitLength, certainty)))
722722
{
723723
throw new IllegalArgumentException("Fp q value not prime");

core/src/test/java/org/bouncycastle/math/ec/test/ECPointTest.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
import java.util.Random;
1111
import java.util.Set;
1212

13+
import junit.framework.Test;
14+
import junit.framework.TestCase;
15+
import junit.framework.TestSuite;
1316
import org.bouncycastle.asn1.x9.ECNamedCurveTable;
1417
import org.bouncycastle.asn1.x9.X9ECParameters;
1518
import org.bouncycastle.asn1.x9.X9ECPoint;
@@ -25,10 +28,6 @@
2528
import org.bouncycastle.util.Integers;
2629
import org.bouncycastle.util.encoders.Hex;
2730

28-
import junit.framework.Test;
29-
import junit.framework.TestCase;
30-
import junit.framework.TestSuite;
31-
3231
/**
3332
* Test class for {@link org.bouncycastle.math.ec.ECPoint ECPoint}. All
3433
* literature values are taken from "Guide to elliptic curve cryptography",
@@ -51,7 +50,7 @@ public class ECPointTest extends TestCase
5150
*/
5251
public static class Fp
5352
{
54-
private final BigInteger q = new BigInteger("29");
53+
private final BigInteger q = new BigInteger("1063");
5554

5655
private final BigInteger a = new BigInteger("4");
5756

@@ -65,7 +64,7 @@ public static class Fp
6564

6665
private final ECPoint infinity = curve.getInfinity();
6766

68-
private final int[] pointSource = { 5, 22, 16, 27, 13, 6, 14, 6 };
67+
private final int[] pointSource = { 1, 5, 4, 10, 234, 1024, 817, 912 };
6968

7069
private ECPoint[] p = new ECPoint[pointSource.length / 2];
7170

0 commit comments

Comments
 (0)