From 0329f5b751ef102bd6b7b7181b6e049522a887f5 Mon Sep 17 00:00:00 2001 From: Juraj Somorovsky Date: Fri, 27 Apr 2018 23:36:45 +0200 Subject: [PATCH] Some documentation and extra information (#50) * Add more information about the used Java Runtime and the tested provider version * Added some recent information about SunEC and Utimaco HSM problems --- java/com/google/security/wycheproof/TestUtil.java | 6 ++++++ java/com/google/security/wycheproof/WycheproofRunner.java | 1 + .../google/security/wycheproof/testcases/BasicTest.java | 2 +- .../com/google/security/wycheproof/testcases/EcdhTest.java | 7 ++++++- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/java/com/google/security/wycheproof/TestUtil.java b/java/com/google/security/wycheproof/TestUtil.java index 0e1160d..7202bdc 100644 --- a/java/com/google/security/wycheproof/TestUtil.java +++ b/java/com/google/security/wycheproof/TestUtil.java @@ -93,4 +93,10 @@ public class TestUtil { Provider provider = (Provider) Class.forName(className).getConstructor().newInstance(); Security.insertProviderAt(provider, 1); } + + public static void printJavaInformation() { + System.out.println("Running with: "); + System.out.println(" java.runtime.name: " + System.getProperty("java.runtime.name")); + System.out.println(" java.runtime.version: " + System.getProperty("java.runtime.version")); + } } diff --git a/java/com/google/security/wycheproof/WycheproofRunner.java b/java/com/google/security/wycheproof/WycheproofRunner.java index c53a1b6..cdea9d6 100644 --- a/java/com/google/security/wycheproof/WycheproofRunner.java +++ b/java/com/google/security/wycheproof/WycheproofRunner.java @@ -190,6 +190,7 @@ public class WycheproofRunner extends Suite { public WycheproofRunner(Class runnerClass, RunnerBuilder builder) throws InitializationError { super(runnerClass, builder); addFilter(new ExcludeTestFilter(runnerClass)); + TestUtil.printJavaInformation(); } private void addFilter(Filter filter) { diff --git a/java/com/google/security/wycheproof/testcases/BasicTest.java b/java/com/google/security/wycheproof/testcases/BasicTest.java index 43971fc..ba3ed0e 100644 --- a/java/com/google/security/wycheproof/testcases/BasicTest.java +++ b/java/com/google/security/wycheproof/testcases/BasicTest.java @@ -29,7 +29,7 @@ public class BasicTest { public void testListAllAlgorithms() { for (Provider p : Security.getProviders()) { System.out.println(); - System.out.println("Provider:" + p.getName()); + System.out.println("Provider: " + p.getName() + " " + p.getVersion()); // Using a TreeSet here, because the elements are sorted. TreeSet list = new TreeSet(); for (Object key : p.keySet()) { diff --git a/java/com/google/security/wycheproof/testcases/EcdhTest.java b/java/com/google/security/wycheproof/testcases/EcdhTest.java index d5b5e08..9bcfb1d 100644 --- a/java/com/google/security/wycheproof/testcases/EcdhTest.java +++ b/java/com/google/security/wycheproof/testcases/EcdhTest.java @@ -57,6 +57,10 @@ import org.junit.runners.JUnit4; *

Adrian Antipa, Daniel Brown, Alfred Menezes, Rene Struik, and Scott Vanstone, "Validation of * Elliptic Curve Public Keys", PKC 2003, https://www.iacr.org/archive/pkc2003/25670211/25670211.pdf * + *

Tibor Jager, Jörg Schwenk, Juraj Somorovsky, "Practical Invalid Curve Attacks on TLS-ECDH", + * ESORICS'15, https://www.nds.rub.de/research/publications/ESORICS15/ + * (describes attacks on BouncyCastle and SunEC) + * *

Bugs: CVE-2015-7940: BouncyCastle before 1.51 does not validate a point is on the * curve. BouncyCastle v.1.52 checks that the public key point is on the public key curve but does * not check whether public key and private key use the same curve. BouncyCastle v.1.53 is still @@ -64,7 +68,8 @@ import org.junit.runners.JUnit4; * used by the public key. ECDHC would then reduce the private key modulo this order, which can be * used to find the private key. * - *

SunEC had similar problem. CVE ? + *

CVE-2015-6924: Utimaco HSMs vulnerable to invalid curve attacks, which made the private key + * extraction possible. * *

CVE-2015-7940: Issue with elliptic curve addition in mixed Jacobian-affine coordinates *