Skip to content

Commit 61514fb

Browse files
committed
Update EdDSA tests
1 parent 966eed3 commit 61514fb

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

core/src/test/java/org/bouncycastle/crypto/test/Ed25519Test.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ public static void main(String[] args)
3434

3535
public void performTest() throws Exception
3636
{
37+
basicSigTest();
38+
3739
for (int i = 0; i < 10; ++i)
3840
{
3941
testConsistency(Ed25519.Algorithm.Ed25519, null);
@@ -43,7 +45,6 @@ public void performTest() throws Exception
4345
testConsistency(Ed25519.Algorithm.Ed25519ph, context);
4446
}
4547

46-
basicSigTest();
4748
testRegressionInfiniteLoop();
4849
}
4950

@@ -837,9 +838,9 @@ private void testRegressionInfiniteLoop() throws Exception
837838

838839
signer.init(false, pub);
839840
signer.update(msg, 0, msg.length);
840-
if (!signer.verifySignature(sig)) {
841-
fail("signature verification failed for test vector: " + error);
842-
}
841+
boolean shouldVerify = signer.verifySignature(sig);
842+
843+
isTrue("signature verification failed for test vector: " + error, shouldVerify);
843844
}
844845
}
845846
}

core/src/test/java/org/bouncycastle/crypto/test/Ed448Test.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public void performTest() throws Exception
4141
testConsistency(Ed448.Algorithm.Ed448, context);
4242
testConsistency(Ed448.Algorithm.Ed448ph, context);
4343
}
44+
45+
testRegressionInfiniteLoop();
4446
}
4547

4648
private void basicSigTest()
@@ -1234,9 +1236,9 @@ private void testRegressionInfiniteLoop() throws Exception
12341236

12351237
signer.init(false, pub);
12361238
signer.update(msg, 0, msg.length);
1237-
if (!signer.verifySignature(sig)) {
1238-
fail("signature verification failed for test vector: " + error);
1239-
}
1239+
boolean shouldVerify = signer.verifySignature(sig);
1240+
1241+
isTrue("signature verification failed for test vector: " + error, shouldVerify);
12401242
}
12411243
}
12421244
}

0 commit comments

Comments
 (0)