jdk/test/sun/security/pkcs11/ec/TestCurves.java
changeset 35379 1e8e336ef66b
parent 32138 23830562d3d1
child 41915 ffd2dc160173
--- a/jdk/test/sun/security/pkcs11/ec/TestCurves.java	Tue Jan 26 09:25:53 2016 +0000
+++ b/jdk/test/sun/security/pkcs11/ec/TestCurves.java	Tue Jan 26 13:32:07 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,53 +29,46 @@
  * @library ..
  * @modules jdk.crypto.pkcs11/sun.security.pkcs11.wrapper
  * @compile -XDignore.symbol.file TestCurves.java
- * @run main TestCurves
+ * @run main/othervm TestCurves
+ * @run main/othervm TestCurves sm
  * @key randomness
  */
 
-import java.util.*;
-
-import java.security.*;
-import java.security.spec.*;
-
-import javax.crypto.*;
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.security.Provider;
+import java.security.ProviderException;
+import java.security.Signature;
+import java.security.spec.ECParameterSpec;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
+import javax.crypto.KeyAgreement;
 
 public class TestCurves extends PKCS11Test {
 
     public static void main(String[] args) throws Exception {
-        main(new TestCurves());
+        main(new TestCurves(), args);
     }
 
+    @Override
     public void main(Provider p) throws Exception {
         if (p.getService("KeyAgreement", "ECDH") == null) {
             System.out.println("Not supported by provider, skipping");
             return;
         }
 
-        if (isNSS(p) && getNSSVersion() >= 3.11 && getNSSVersion() < 3.12) {
-            System.out.println("NSS 3.11 has a DER issue that recent " +
-                    "version do not.");
+        if (isBadNSSVersion(p)) {
             return;
         }
 
-        /*
-         * Use Solaris SPARC 11.2 or later to avoid an intermittent failure
-         * when running SunPKCS11-Solaris (8044554)
-         */
-        if (p.getName().equals("SunPKCS11-Solaris") &&
-            System.getProperty("os.name").equals("SunOS") &&
-            System.getProperty("os.arch").equals("sparcv9") &&
-            System.getProperty("os.version").compareTo("5.11") <= 0 &&
-            getDistro().compareTo("11.2") < 0) {
-
-            System.out.println("SunPKCS11-Solaris provider requires " +
-                "Solaris SPARC 11.2 or later, skipping");
+        if (isBadSolarisSparc(p)) {
             return;
         }
 
         // Check if this is sparc for later failure avoidance.
         boolean sparc = false;
-        if (System.getProperty("os.arch").equals("sparcv9")) {
+        if (props.getProperty("os.arch").equals("sparcv9")) {
             sparc = true;
             System.out.println("This is a sparcv9");
         }
@@ -84,7 +77,7 @@
         byte[] data = new byte[2048];
         random.nextBytes(data);
 
-        Vector<ECParameterSpec> curves = getKnownCurves(p);
+        List<ECParameterSpec> curves = getKnownCurves(p);
         for (ECParameterSpec params : curves) {
             System.out.println("Testing " + params + "...");
             KeyPairGenerator kpg = KeyPairGenerator.getInstance("EC", p);