8164639: Configure PKCS11 tests to use user-supplied NSS libraries
authorjjiang
Wed, 15 Aug 2018 18:41:18 +0800
changeset 51460 97e361fe3433
parent 51459 7339b9e38182
child 51461 58d7aa066071
8164639: Configure PKCS11 tests to use user-supplied NSS libraries Summary: Provide system property "test.nss.lib.paths" for specifying a set of absolute paths to the custom NSS lib directories Reviewed-by: weijun, rhalade
test/jdk/ProblemList.txt
test/jdk/sun/security/pkcs11/Cipher/JNICheck.java
test/jdk/sun/security/pkcs11/Cipher/ReinitCipher.java
test/jdk/sun/security/pkcs11/Cipher/TestPKCS5PaddingError.java
test/jdk/sun/security/pkcs11/Cipher/TestRSACipher.java
test/jdk/sun/security/pkcs11/Cipher/TestRSACipherWrap.java
test/jdk/sun/security/pkcs11/Cipher/TestRawRSACipher.java
test/jdk/sun/security/pkcs11/Cipher/TestSymmCiphers.java
test/jdk/sun/security/pkcs11/Cipher/TestSymmCiphersNoPad.java
test/jdk/sun/security/pkcs11/Config/ReadConfInUTF16Env.sh
test/jdk/sun/security/pkcs11/KeyAgreement/SupportedDHKeys.java
test/jdk/sun/security/pkcs11/KeyAgreement/TestDH.java
test/jdk/sun/security/pkcs11/KeyAgreement/TestInterop.java
test/jdk/sun/security/pkcs11/KeyAgreement/TestShort.java
test/jdk/sun/security/pkcs11/KeyAgreement/UnsupportedDHKeys.java
test/jdk/sun/security/pkcs11/KeyGenerator/DESParity.java
test/jdk/sun/security/pkcs11/KeyGenerator/TestKeyGenerator.java
test/jdk/sun/security/pkcs11/KeyPairGenerator/TestDH2048.java
test/jdk/sun/security/pkcs11/KeyStore/Basic.sh
test/jdk/sun/security/pkcs11/KeyStore/ClientAuth.sh
test/jdk/sun/security/pkcs11/KeyStore/SecretKeysBasic.sh
test/jdk/sun/security/pkcs11/KeyStore/Solaris.sh
test/jdk/sun/security/pkcs11/Mac/MacKAT.java
test/jdk/sun/security/pkcs11/Mac/MacSameTest.java
test/jdk/sun/security/pkcs11/Mac/ReinitMac.java
test/jdk/sun/security/pkcs11/MessageDigest/ByteBuffers.java
test/jdk/sun/security/pkcs11/MessageDigest/DigestKAT.java
test/jdk/sun/security/pkcs11/MessageDigest/ReinitDigest.java
test/jdk/sun/security/pkcs11/MessageDigest/TestCloning.java
test/jdk/sun/security/pkcs11/PKCS11Test.java
test/jdk/sun/security/pkcs11/Provider/Absolute.java
test/jdk/sun/security/pkcs11/Provider/ConfigQuotedString.sh
test/jdk/sun/security/pkcs11/Provider/Login.sh
test/jdk/sun/security/pkcs11/README
test/jdk/sun/security/pkcs11/SampleTest.java
test/jdk/sun/security/pkcs11/Secmod/AddPrivateKey.java
test/jdk/sun/security/pkcs11/Secmod/AddTrustedCert.java
test/jdk/sun/security/pkcs11/Secmod/Crypto.java
test/jdk/sun/security/pkcs11/Secmod/GetPrivateKey.java
test/jdk/sun/security/pkcs11/Secmod/JksSetPrivateKey.java
test/jdk/sun/security/pkcs11/Secmod/LoadKeystore.java
test/jdk/sun/security/pkcs11/Secmod/TestNssDbSqlite.java
test/jdk/sun/security/pkcs11/Secmod/TrustAnchors.java
test/jdk/sun/security/pkcs11/SecureRandom/Basic.java
test/jdk/sun/security/pkcs11/SecureRandom/TestDeserialization.java
test/jdk/sun/security/pkcs11/Serialize/SerializeProvider.java
test/jdk/sun/security/pkcs11/Signature/ByteBuffers.java
test/jdk/sun/security/pkcs11/Signature/ReinitSignature.java
test/jdk/sun/security/pkcs11/Signature/TestDSA.java
test/jdk/sun/security/pkcs11/Signature/TestDSAKeyLength.java
test/jdk/sun/security/pkcs11/Signature/TestRSAKeyLength.java
test/jdk/sun/security/pkcs11/ec/ReadCertificates.java
test/jdk/sun/security/pkcs11/ec/ReadPKCS12.java
test/jdk/sun/security/pkcs11/ec/TestCurves.java
test/jdk/sun/security/pkcs11/ec/TestECDH.java
test/jdk/sun/security/pkcs11/ec/TestECDH2.java
test/jdk/sun/security/pkcs11/ec/TestECDSA.java
test/jdk/sun/security/pkcs11/ec/TestECDSA2.java
test/jdk/sun/security/pkcs11/ec/TestECGenSpec.java
test/jdk/sun/security/pkcs11/ec/TestKeyFactory.java
test/jdk/sun/security/pkcs11/fips/ClientJSSEServerJSSE.java
test/jdk/sun/security/pkcs11/fips/TrustManagerTest.java
test/jdk/sun/security/pkcs11/nss/lib/macosx-x86_64/libfreebl3.dylib
test/jdk/sun/security/pkcs11/nss/lib/macosx-x86_64/libnspr4.dylib
test/jdk/sun/security/pkcs11/nss/lib/macosx-x86_64/libnss3.dylib
test/jdk/sun/security/pkcs11/nss/lib/macosx-x86_64/libnssckbi.dylib
test/jdk/sun/security/pkcs11/nss/lib/macosx-x86_64/libnssdbm3.dylib
test/jdk/sun/security/pkcs11/nss/lib/macosx-x86_64/libnssutil3.dylib
test/jdk/sun/security/pkcs11/nss/lib/macosx-x86_64/libplc4.dylib
test/jdk/sun/security/pkcs11/nss/lib/macosx-x86_64/libplds4.dylib
test/jdk/sun/security/pkcs11/nss/lib/macosx-x86_64/libsoftokn3.dylib
test/jdk/sun/security/pkcs11/nss/lib/macosx-x86_64/libsqlite3.dylib
test/jdk/sun/security/pkcs11/nss/lib/macosx-x86_64/libssl3.dylib
test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/freebl3.chk
test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/freebl3.dll
test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/nspr4.dll
test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/nspr4.lib
test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/nss3.dll
test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/nss3.lib
test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/nssckbi.dll
test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/nssdbm3.chk
test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/nssdbm3.dll
test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/nssutil3.dll
test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/nssutil3.lib
test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/plc4.dll
test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/plc4.lib
test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/plds4.dll
test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/plds4.lib
test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/softokn3.chk
test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/softokn3.dll
test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/sqlite3.dll
test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/ssl3.dll
test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/ssl3.lib
test/jdk/sun/security/pkcs11/nss/lib/windows-i586/freebl3.chk
test/jdk/sun/security/pkcs11/nss/lib/windows-i586/freebl3.dll
test/jdk/sun/security/pkcs11/nss/lib/windows-i586/nspr4.dll
test/jdk/sun/security/pkcs11/nss/lib/windows-i586/nspr4.lib
test/jdk/sun/security/pkcs11/nss/lib/windows-i586/nss3.dll
test/jdk/sun/security/pkcs11/nss/lib/windows-i586/nss3.lib
test/jdk/sun/security/pkcs11/nss/lib/windows-i586/nssckbi.dll
test/jdk/sun/security/pkcs11/nss/lib/windows-i586/nssdbm3.chk
test/jdk/sun/security/pkcs11/nss/lib/windows-i586/nssdbm3.dll
test/jdk/sun/security/pkcs11/nss/lib/windows-i586/nssutil3.dll
test/jdk/sun/security/pkcs11/nss/lib/windows-i586/nssutil3.lib
test/jdk/sun/security/pkcs11/nss/lib/windows-i586/plc4.dll
test/jdk/sun/security/pkcs11/nss/lib/windows-i586/plc4.lib
test/jdk/sun/security/pkcs11/nss/lib/windows-i586/plds4.dll
test/jdk/sun/security/pkcs11/nss/lib/windows-i586/plds4.lib
test/jdk/sun/security/pkcs11/nss/lib/windows-i586/softokn3.chk
test/jdk/sun/security/pkcs11/nss/lib/windows-i586/softokn3.dll
test/jdk/sun/security/pkcs11/nss/lib/windows-i586/sqlite3.dll
test/jdk/sun/security/pkcs11/nss/lib/windows-i586/ssl3.dll
test/jdk/sun/security/pkcs11/nss/lib/windows-i586/ssl3.lib
test/jdk/sun/security/pkcs11/rsa/KeyWrap.java
test/jdk/sun/security/pkcs11/rsa/TestCACerts.java
test/jdk/sun/security/pkcs11/rsa/TestKeyFactory.java
test/jdk/sun/security/pkcs11/rsa/TestSignatures.java
test/jdk/sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java
test/jdk/sun/security/pkcs11/tls/TestKeyMaterial.java
test/jdk/sun/security/pkcs11/tls/TestLeadingZeroesP11.java
test/jdk/sun/security/pkcs11/tls/TestMasterSecret.java
test/jdk/sun/security/pkcs11/tls/TestPRF.java
test/jdk/sun/security/pkcs11/tls/TestPremaster.java
--- a/test/jdk/ProblemList.txt	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/ProblemList.txt	Wed Aug 15 18:41:18 2018 +0800
@@ -639,7 +639,7 @@
 sun/security/pkcs11/KeyGenerator/DESParity.java                 8204203 windows-all
 sun/security/pkcs11/KeyGenerator/TestKeyGenerator.java          8204203 windows-all
 sun/security/pkcs11/KeyPairGenerator/TestDH2048.java            8204203 windows-all
-sun/security/pkcs11/KeyStore/SecretKeysBasic.sh                 8204203 windows-all
+sun/security/pkcs11/KeyStore/SecretKeysBasic.sh                 8204203,8209398 generic-all
 sun/security/pkcs11/Mac/MacKAT.java                             8204203 windows-all
 sun/security/pkcs11/Mac/MacSameTest.java                        8204203 windows-all
 sun/security/pkcs11/Mac/ReinitMac.java                          8204203 windows-all
--- a/test/jdk/sun/security/pkcs11/Cipher/JNICheck.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/Cipher/JNICheck.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8063700
+ * @library /test/lib
  * @run main/othervm -Xcheck:jni JNICheck
  */
 
--- a/test/jdk/sun/security/pkcs11/Cipher/ReinitCipher.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/Cipher/ReinitCipher.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 4856966
  * @summary
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @key randomness
  * @modules jdk.crypto.cryptoki
  * @run main/othervm ReinitCipher
--- a/test/jdk/sun/security/pkcs11/Cipher/TestPKCS5PaddingError.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/Cipher/TestPKCS5PaddingError.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 6687725
  * @summary Test internal PKCS5Padding impl with various error conditions.
  * @author Valerie Peng
- * @library ..
+ * @library /test/lib ..
  * @modules jdk.crypto.cryptoki
  * @run main/othervm TestPKCS5PaddingError
  * @run main/othervm TestPKCS5PaddingError sm
--- a/test/jdk/sun/security/pkcs11/Cipher/TestRSACipher.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/Cipher/TestRSACipher.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 4898468 6994008
  * @summary basic test for RSA cipher
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @key randomness
  * @modules jdk.crypto.cryptoki
  * @run main/othervm TestRSACipher
--- a/test/jdk/sun/security/pkcs11/Cipher/TestRSACipherWrap.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/Cipher/TestRSACipherWrap.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 6572331 6994008
  * @summary basic test for RSA cipher key wrapping functionality
  * @author Valerie Peng
- * @library ..
+ * @library /test/lib ..
  * @modules jdk.crypto.cryptoki
  * @run main/othervm TestRSACipherWrap
  * @run main/othervm TestRSACipherWrap sm
--- a/test/jdk/sun/security/pkcs11/Cipher/TestRawRSACipher.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/Cipher/TestRawRSACipher.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 6994008
  * @summary basic test for RSA/ECB/NoPadding cipher
  * @author Valerie Peng
- * @library ..
+ * @library /test/lib ..
  * @key randomness
  * @modules jdk.crypto.cryptoki
  * @run main/othervm TestRawRSACipher
--- a/test/jdk/sun/security/pkcs11/Cipher/TestSymmCiphers.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/Cipher/TestSymmCiphers.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 4898461 6604496
  * @summary basic test for symmetric ciphers with padding
  * @author Valerie Peng
- * @library ..
+ * @library /test/lib ..
  * @key randomness
  * @modules jdk.crypto.cryptoki
  * @run main/othervm TestSymmCiphers
--- a/test/jdk/sun/security/pkcs11/Cipher/TestSymmCiphersNoPad.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/Cipher/TestSymmCiphersNoPad.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 4898484 6604496 8001284
  * @summary basic test for symmetric ciphers with no padding
  * @author Valerie Peng
- * @library ..
+ * @library /test/lib ..
  * @key randomness
  * @modules jdk.crypto.cryptoki
  * @run main/othervm TestSymmCiphersNoPad
--- a/test/jdk/sun/security/pkcs11/Config/ReadConfInUTF16Env.sh	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/Config/ReadConfInUTF16Env.sh	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2017, 2018, 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
@@ -24,6 +24,7 @@
 # @test
 # @bug 8187023
 # @summary Pkcs11 config file should be assumed in ISO-8859-1
+# @library /test/lib
 # @build ReadConfInUTF16Env
 # @run shell ReadConfInUTF16Env.sh
 
--- a/test/jdk/sun/security/pkcs11/KeyAgreement/SupportedDHKeys.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/KeyAgreement/SupportedDHKeys.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -25,7 +25,7 @@
  * @test
  * @bug 8072452
  * @summary Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
- * @library ..
+ * @library /test/lib ..
  * @modules jdk.crypto.cryptoki
  * @run main/othervm SupportedDHKeys
  * @run main/othervm SupportedDHKeys sm
--- a/test/jdk/sun/security/pkcs11/KeyAgreement/TestDH.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/KeyAgreement/TestDH.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 4921804 6324825
  * @summary Verify that DH works properly
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @modules jdk.crypto.cryptoki
  * @run main/othervm -Djdk.crypto.KeyAgreement.legacyKDF=true TestDH
  * @run main/othervm -Djdk.crypto.KeyAgreement.legacyKDF=true TestDH sm
--- a/test/jdk/sun/security/pkcs11/KeyAgreement/TestInterop.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/KeyAgreement/TestInterop.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, 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
@@ -25,7 +25,7 @@
  * @test
  * @bug 7146728
  * @summary Interop test for DH with secret that has a leading 0x00 byte
- * @library ..
+ * @library /test/lib ..
  * @modules jdk.crypto.cryptoki
  * @run main/othervm TestInterop
  * @run main/othervm TestInterop sm
--- a/test/jdk/sun/security/pkcs11/KeyAgreement/TestShort.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/KeyAgreement/TestShort.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 4942494 7146728
  * @summary KAT test for DH (normal and with secret that has leading a 0x00 byte)
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @modules jdk.crypto.cryptoki
  * @run main/othervm TestShort
  * @run main/othervm TestShort sm
--- a/test/jdk/sun/security/pkcs11/KeyAgreement/UnsupportedDHKeys.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/KeyAgreement/UnsupportedDHKeys.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -25,7 +25,7 @@
  * @test
  * @bug 8072452
  * @summary Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
- * @library ..
+ * @library /test/lib ..
  * @modules jdk.crypto.cryptoki
  * @run main/othervm UnsupportedDHKeys
  * @run main/othervm UnsupportedDHKeys sm
--- a/test/jdk/sun/security/pkcs11/KeyGenerator/DESParity.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/KeyGenerator/DESParity.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 4898479
  * @summary Verify that the parity bits are set correctly
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @key randomness
  * @modules jdk.crypto.cryptoki
  * @run main/othervm DESParity
--- a/test/jdk/sun/security/pkcs11/KeyGenerator/TestKeyGenerator.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/KeyGenerator/TestKeyGenerator.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 4917233 6461727 6490213 6720456
  * @summary test the KeyGenerator
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @modules jdk.crypto.cryptoki
  * @run main/othervm TestKeyGenerator
  * @run main/othervm TestKeyGenerator sm
--- a/test/jdk/sun/security/pkcs11/KeyPairGenerator/TestDH2048.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/KeyPairGenerator/TestDH2048.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 7196382 8072452
  * @summary Ensure that DH key pairs can be generated for 512 - 8192 bits
  * @author Valerie Peng
- * @library ..
+ * @library /test/lib ..
  * @modules jdk.crypto.cryptoki
  * @run main/othervm TestDH2048
  * @run main/othervm TestDH2048 sm
--- a/test/jdk/sun/security/pkcs11/KeyStore/Basic.sh	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/KeyStore/Basic.sh	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2018, 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
@@ -23,6 +23,7 @@
 
 # @test
 # @bug 4938185
+# @library /test/lib
 # @summary KeyStore support for NSS cert/key databases
 #
 # @run shell Basic.sh
@@ -60,7 +61,8 @@
 echo TESTSRC=${TESTSRC}
 echo TESTCLASSES=${TESTCLASSES}
 echo TESTJAVA=${TESTJAVA}
-echo echo COMPILEJAVA=${COMPILEJAVA}
+echo COMPILEJAVA=${COMPILEJAVA}
+echo CPAPPEND=${CPAPPEND}
 echo ""
 
 # get command from input args -
@@ -168,16 +170,17 @@
 
 if [ "${RECOMPILE}" = "yes" ] ; then
     ${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
-	-classpath ${TESTSRC}${FS}..${PS}${TESTSRC}${FS}loader.jar \
-	-d ${TESTCLASSES} \
-	${TESTSRC}${FS}Basic.java \
-	${TESTSRC}${FS}..${FS}PKCS11Test.java
+  -classpath ${TESTSRC}${FS}..${PS}${TESTSRC}${FS}loader.jar \
+  -d ${TESTCLASSES} \
+  ${TESTSRC}${FS}..${FS}..${FS}..${FS}..${FS}..${FS}lib${FS}jdk${FS}test${FS}lib${FS}artifacts${FS}*.java \
+  ${TESTSRC}${FS}Basic.java \
+  ${TESTSRC}${FS}..${FS}PKCS11Test.java
 fi
 
 # run test
 
 ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \
-	-classpath ${TESTCLASSES}${PS}${TESTSRC}${FS}loader.jar \
+	-classpath ${TESTCLASSES}${PS}${TESTSRC}${FS}loader.jar${PS}${CPAPPEND} \
 	-DDIR=${TESTSRC}${FS}BasicData \
 	-DCUSTOM_DB_DIR=${TESTCLASSES} \
 	-DCUSTOM_P11_CONFIG=${TESTSRC}${FS}BasicData${FS}p11-${TOKEN}.txt \
--- a/test/jdk/sun/security/pkcs11/KeyStore/ClientAuth.sh	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/KeyStore/ClientAuth.sh	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2018, 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
@@ -25,7 +25,7 @@
 # @bug 4938185 7106773
 # @summary KeyStore support for NSS cert/key databases
 #          512 bits RSA key cannot work with SHA384 and SHA512
-#
+# @library /test/lib
 # @run shell ClientAuth.sh
 
 # set a few environment variables so that the shell-script can run stand-alone
@@ -47,6 +47,7 @@
 echo TESTCLASSES=${TESTCLASSES}
 echo TESTJAVA=${TESTJAVA}
 echo COMPILEJAVA=${COMPILEJAVA}
+echo CPAPPEND=${CPAPPEND}
 echo ""
 
 OS=`uname -s`
@@ -128,13 +129,14 @@
 ${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
     -classpath ${TESTSRC} \
     -d ${TESTCLASSES} \
+    ${TESTSRC}${FS}..${FS}..${FS}..${FS}..${FS}..${FS}lib${FS}jdk${FS}test${FS}lib${FS}artifacts${FS}*.java \
     ${TESTSRC}${FS}ClientAuth.java \
     ${TESTSRC}${FS}..${FS}PKCS11Test.java
 
 # run test
 echo "Run ClientAuth TLSv1 ..."
 ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \
-    -classpath ${TESTCLASSES} \
+    -classpath ${TESTCLASSES}${PS}${CPAPPEND} \
     -DDIR=${TESTSRC}${FS}ClientAuthData${FS} \
     -DCUSTOM_DB_DIR=${TESTCLASSES} \
     -DCUSTOM_P11_CONFIG=${TESTSRC}${FS}ClientAuthData${FS}p11-nss.txt \
@@ -155,7 +157,7 @@
 # run test
 echo "Run ClientAuth TLSv1.1 ..."
 ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \
-    -classpath ${TESTCLASSES} \
+    -classpath ${TESTCLASSES}${PS}${CPAPPEND} \
     -DDIR=${TESTSRC}${FS}ClientAuthData${FS} \
     -DCUSTOM_DB_DIR=${TESTCLASSES} \
     -DCUSTOM_P11_CONFIG=${TESTSRC}${FS}ClientAuthData${FS}p11-nss.txt \
@@ -176,7 +178,7 @@
 # run test with specified TLS protocol and cipher suite
 echo "Run ClientAuth TLSv1.2 TLS_DHE_RSA_WITH_AES_128_CBC_SHA"
 ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \
-    -classpath ${TESTCLASSES} \
+    -classpath ${TESTCLASSES}${PS}${CPAPPEND} \
     -DDIR=${TESTSRC}${FS}ClientAuthData${FS} \
     -DCUSTOM_DB_DIR=${TESTCLASSES} \
     -DCUSTOM_P11_CONFIG=${TESTSRC}${FS}ClientAuthData${FS}p11-nss.txt \
--- a/test/jdk/sun/security/pkcs11/KeyStore/SecretKeysBasic.sh	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/KeyStore/SecretKeysBasic.sh	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2018, 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
@@ -25,7 +25,7 @@
 # @bug 6599979
 # @summary Ensure that re-assigning the alias works
 #
-# @library ..
+# @library /test/lib ..
 # @build SecretKeysBasic
 # @run shell SecretKeysBasic.sh
 #
@@ -52,6 +52,7 @@
 echo TESTSRC=${TESTSRC}
 echo TESTCLASSES=${TESTCLASSES}
 echo TESTJAVA=${TESTJAVA}
+echo CPAPPEND=${CPAPPEND}
 echo ""
 
 #DEBUG=sunpkcs11,pkcs11keystore
@@ -130,9 +131,9 @@
     ${MKDIR} ${TESTCLASSES}${FS}pkcs11_softtoken${FS}public
 
     echo ${CP} ${TESTSRC}${FS}BasicData${FS}pkcs11_softtoken${FS}objstore_info \
-	${TESTCLASSES}${FS}pkcs11_softtoken
+    ${TESTCLASSES}${FS}pkcs11_softtoken
     ${CP} ${TESTSRC}${FS}BasicData${FS}pkcs11_softtoken${FS}objstore_info \
-	${TESTCLASSES}${FS}pkcs11_softtoken
+    ${TESTCLASSES}${FS}pkcs11_softtoken
 
     echo ${CHMOD} +w ${TESTCLASSES}${FS}pkcs11_softtoken${FS}objstore_info
     ${CHMOD} 600 ${TESTCLASSES}${FS}pkcs11_softtoken${FS}objstore_info
@@ -142,16 +143,16 @@
 # run test
 cd ${TESTSRC}
 ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \
-	-DDIR=${TESTSRC}${FS}BasicData${FS} \
+        -DDIR=${TESTSRC}${FS}BasicData${FS} \
         -classpath \
-        ${TESTCLASSES}${PS}${TESTCLASSES}${FS}..${PS}${TESTSRC}${FS}loader.jar \
+        ${TESTCLASSES}${PS}${TESTCLASSES}${FS}..${PS}${TESTSRC}${FS}loader.jar${PS}${CPAPPEND} \
         -DCUSTOM_DB_DIR=${TESTCLASSES} \
         -DCUSTOM_P11_CONFIG=${TESTSRC}${FS}BasicData${FS}p11-${token}.txt \
-	-DNO_DEFAULT=true \
-	-DNO_DEIMOS=true \
-	-DTOKEN=${token} \
-	-Djava.security.debug=${DEBUG} \
-	SecretKeysBasic
+        -DNO_DEFAULT=true \
+        -DNO_DEIMOS=true \
+        -DTOKEN=${token} \
+        -Djava.security.debug=${DEBUG} \
+        SecretKeysBasic
 
 #	-DCUSTOM_P11_CONFIG=${TESTSRC}${FS}BasicData${FS}p11-${token}.txt \
 
--- a/test/jdk/sun/security/pkcs11/KeyStore/Solaris.sh	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/KeyStore/Solaris.sh	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2018, 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
@@ -23,6 +23,7 @@
 
 # @test
 # @bug 5038659
+# @library /test/lib
 # @summary Enable PKCS#11 KeyStore for SunPKCS11-Solaris
 #
 # @run shell Solaris.sh
@@ -138,17 +139,18 @@
     cd ${TESTCLASSES}
     ${RM} *.class
     ${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
-	-classpath ${TESTSRC}${FS}..${PS}${TESTSRC}${FS}loader.jar \
-	-d ${TESTCLASSES} \
-	${TESTSRC}${FS}Basic.java \
-	${TESTSRC}${FS}..${FS}PKCS11Test.java
+    -classpath ${TESTSRC}${FS}..${PS}${TESTSRC}${FS}loader.jar \
+    -d ${TESTCLASSES} \
+    ${TESTSRC}${FS}..${FS}..${FS}..${FS}..${FS}..${FS}lib${FS}jdk${FS}test${FS}lib${FS}artifacts${FS}*.java \
+    ${TESTSRC}${FS}Basic.java \
+    ${TESTSRC}${FS}..${FS}PKCS11Test.java
 fi
 
 # run test
 
 cd ${TESTSRC}
 ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \
-	-classpath ${TESTCLASSES}${PS}${TESTSRC}${FS}loader.jar \
+	-classpath ${TESTCLASSES}${PS}${TESTSRC}${FS}loader.jar${PS}${CPAPPEND} \
 	-DDIR=${TESTSRC}${FS}BasicData${FS} \
 	-DCUSTOM_P11_CONFIG=${TESTSRC}${FS}BasicData${FS}p11-solaris.txt \
 	-DNO_DEFAULT=true \
--- a/test/jdk/sun/security/pkcs11/Mac/MacKAT.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/Mac/MacKAT.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 4846410 6313661 4963723
  * @summary Basic known-answer-test for Hmac algorithms
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @modules jdk.crypto.cryptoki
  * @run main/othervm MacKAT
  * @run main/othervm MacKAT sm
--- a/test/jdk/sun/security/pkcs11/Mac/MacSameTest.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/Mac/MacSameTest.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 8048603
  * @summary Check if doFinal and update operation result in same Mac
  * @author Yu-Ching Valerie Peng, Bill Situ, Alexander Fomin
- * @library ..
+ * @library /test/lib ..
  * @modules jdk.crypto.cryptoki
  * @run main/othervm MacSameTest
  * @run main/othervm MacSameTest sm
--- a/test/jdk/sun/security/pkcs11/Mac/ReinitMac.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/Mac/ReinitMac.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 4856966
  * @summary
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @key randomness
  * @modules jdk.crypto.cryptoki
  * @run main/othervm ReinitMac
--- a/test/jdk/sun/security/pkcs11/MessageDigest/ByteBuffers.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/MessageDigest/ByteBuffers.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 4856966
  * @summary Test the MessageDigest.update(ByteBuffer) method
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @key randomness
  * @modules jdk.crypto.cryptoki
  * @run main/othervm ByteBuffers
--- a/test/jdk/sun/security/pkcs11/MessageDigest/DigestKAT.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/MessageDigest/DigestKAT.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 4856966
  * @summary Basic known-answer-test for all our MessageDigest algorithms
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @modules jdk.crypto.cryptoki
  * @run main/othervm DigestKAT
  * @run main/othervm DigestKAT sm
--- a/test/jdk/sun/security/pkcs11/MessageDigest/ReinitDigest.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/MessageDigest/ReinitDigest.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 4856966
  * @summary
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @key randomness
  * @modules jdk.crypto.cryptoki
  * @run main/othervm ReinitDigest
--- a/test/jdk/sun/security/pkcs11/MessageDigest/TestCloning.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/MessageDigest/TestCloning.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 6414899
  * @summary Ensure the cloning functionality works.
  * @author Valerie Peng
- * @library ..
+ * @library /test/lib ..
  * @key randomness
  * @modules jdk.crypto.cryptoki
  * @run main/othervm TestCloning
--- a/test/jdk/sun/security/pkcs11/PKCS11Test.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/PKCS11Test.java	Wed Aug 15 18:41:18 2018 +0800
@@ -53,6 +53,10 @@
 import java.util.ServiceLoader;
 import java.util.Set;
 
+import jdk.test.lib.artifacts.Artifact;
+import jdk.test.lib.artifacts.ArtifactResolver;
+import jdk.test.lib.artifacts.ArtifactResolverException;
+
 public abstract class PKCS11Test {
 
     private boolean enableSM = false;
@@ -300,15 +304,8 @@
     }
 
     static String getNSSLibDir(String library) throws Exception {
-        String osName = props.getProperty("os.name");
-        if (osName.startsWith("Win")) {
-            osName = "Windows";
-        } else if (osName.equals("Mac OS X")) {
-            osName = "MacOSX";
-        }
-        String osid = osName + "-"
-                + props.getProperty("os.arch") + "-" + props.getProperty("sun.arch.data.model");
-        String[] nssLibDirs = osMap.get(osid);
+        String osid = getOsId();
+        String[] nssLibDirs = getNssLibPaths(osid);
         if (nssLibDirs == null) {
             System.out.println("Warning: unsupported OS: " + osid
                     + ", please initialize NSS librarys location firstly, skipping test");
@@ -323,6 +320,7 @@
             if (new File(dir).exists() &&
                 new File(dir + System.mapLibraryName(library)).exists()) {
                 nssLibDir = dir;
+                System.out.println("nssLibDir: " + nssLibDir);
                 System.setProperty("pkcs11test.nss.libdir", nssLibDir);
                 break;
             }
@@ -334,6 +332,18 @@
         return nssLibDir;
     }
 
+    private static String getOsId() {
+        String osName = props.getProperty("os.name");
+        if (osName.startsWith("Win")) {
+            osName = "Windows";
+        } else if (osName.equals("Mac OS X")) {
+            osName = "MacOSX";
+        }
+        String osid = osName + "-" + props.getProperty("os.arch") + "-"
+                + props.getProperty("sun.arch.data.model");
+        return osid;
+    }
+
     static boolean isBadNSSVersion(Provider p) {
         double nssVersion = getNSSVersion();
         if (isNSS(p) && nssVersion >= 3.11 && nssVersion < 3.12) {
@@ -644,34 +654,74 @@
         return false;
     }
 
-    private static final Map<String,String[]> osMap;
+    private static Map<String,String[]> osMap;
 
     // Location of the NSS libraries on each supported platform
-    static {
+    private static Map<String, String[]> getOsMap() {
+        if (osMap != null) {
+            return osMap;
+        }
+
         osMap = new HashMap<>();
-        osMap.put("SunOS-sparc-32", new String[]{"/usr/lib/mps/"});
-        osMap.put("SunOS-sparcv9-64", new String[]{"/usr/lib/mps/64/"});
-        osMap.put("SunOS-x86-32", new String[]{"/usr/lib/mps/"});
-        osMap.put("SunOS-amd64-64", new String[]{"/usr/lib/mps/64/"});
-        osMap.put("Linux-i386-32", new String[]{
-            "/usr/lib/i386-linux-gnu/", "/usr/lib32/", "/usr/lib/"});
-        osMap.put("Linux-amd64-64", new String[]{
-            "/usr/lib/x86_64-linux-gnu/", "/usr/lib/x86_64-linux-gnu/nss/",
-            "/usr/lib64/"});
-        osMap.put("Linux-ppc64-64", new String[]{"/usr/lib64/"});
-        osMap.put("Linux-ppc64le-64", new String[]{"/usr/lib64/"});
-        osMap.put("Linux-s390x-64", new String[]{"/usr/lib64/"});
-        osMap.put("Windows-x86-32", new String[]{
-            PKCS11_BASE + "/nss/lib/windows-i586/".replace('/', SEP)});
-        osMap.put("Windows-amd64-64", new String[]{
-            PKCS11_BASE + "/nss/lib/windows-amd64/".replace('/', SEP)});
-        osMap.put("MacOSX-x86_64-64", new String[]{
-            PKCS11_BASE + "/nss/lib/macosx-x86_64/"});
-        osMap.put("Linux-arm-32", new String[]{
-            "/usr/lib/arm-linux-gnueabi/nss/",
-            "/usr/lib/arm-linux-gnueabihf/nss/"});
-        osMap.put("Linux-aarch64-64", new String[]{
-            "/usr/lib/aarch64-linux-gnu/", "/usr/lib/aarch64-linux-gnu/nss/"});
+        osMap.put("SunOS-sparc-32", new String[] { "/usr/lib/mps/" });
+        osMap.put("SunOS-sparcv9-64", new String[] { "/usr/lib/mps/64/" });
+        osMap.put("SunOS-x86-32", new String[] { "/usr/lib/mps/" });
+        osMap.put("SunOS-amd64-64", new String[] { "/usr/lib/mps/64/" });
+        osMap.put("Linux-i386-32", new String[] {
+                "/usr/lib/i386-linux-gnu/",
+                "/usr/lib32/",
+                "/usr/lib/" });
+        osMap.put("Linux-amd64-64", new String[] {
+                "/usr/lib/x86_64-linux-gnu/",
+                "/usr/lib/x86_64-linux-gnu/nss/",
+                "/usr/lib64/" });
+        osMap.put("Linux-ppc64-64", new String[] { "/usr/lib64/" });
+        osMap.put("Linux-ppc64le-64", new String[] { "/usr/lib64/" });
+        osMap.put("Linux-s390x-64", new String[] { "/usr/lib64/" });
+        osMap.put("Windows-x86-32", new String[] {});
+        osMap.put("Windows-amd64-64", new String[] {});
+        osMap.put("MacOSX-x86_64-64", new String[] {});
+        osMap.put("Linux-arm-32", new String[] {
+                "/usr/lib/arm-linux-gnueabi/nss/",
+                "/usr/lib/arm-linux-gnueabihf/nss/" });
+        osMap.put("Linux-aarch64-64", new String[] {
+                "/usr/lib/aarch64-linux-gnu/",
+                "/usr/lib/aarch64-linux-gnu/nss/" });
+        return osMap;
+    }
+
+    private static String[] getNssLibPaths(String osId) {
+        String[] preferablePaths = getPreferableNssLibPaths(osId);
+        if (preferablePaths.length != 0) {
+            return preferablePaths;
+        } else {
+            return getOsMap().get(osId);
+        }
+    }
+
+    private static String[] getPreferableNssLibPaths(String osId) {
+        List<String> nssLibPaths = new ArrayList<>();
+
+        String customNssLibPaths = System.getProperty("test.nss.lib.paths");
+        if (customNssLibPaths == null) {
+            // If custom local NSS lib path is not provided,
+            // try to download NSS libs from artifactory
+            String path = fetchNssLib(osId);
+            if (path != null) {
+                nssLibPaths.add(path);
+            }
+        } else {
+            String[] paths = customNssLibPaths.split(",");
+            for (String path : paths) {
+                if (!path.endsWith(File.separator)) {
+                    nssLibPaths.add(path + File.separator);
+                } else {
+                    nssLibPaths.add(path);
+                }
+            }
+        }
+
+        return nssLibPaths.toArray(new String[nssLibPaths.size()]);
     }
 
     private final static char[] hexDigits = "0123456789abcdef".toCharArray();
@@ -797,4 +847,60 @@
         }
         return data;
     }
+
+    private static String fetchNssLib(String osId) {
+        switch (osId) {
+        case "Windows-x86-32":
+            return fetchNssLib(WINDOWS_X86.class);
+
+        case "Windows-amd64-64":
+            return fetchNssLib(WINDOWS_X64.class);
+
+        case "MacOSX-x86_64-64":
+            return fetchNssLib(MACOSX_X64.class);
+
+        default:
+            return null;
+        }
+    }
+
+    private static String fetchNssLib(Class<?> clazz) {
+        String path = null;
+        try {
+            path = ArtifactResolver.resolve(clazz).entrySet().stream()
+                    .findAny().get().getValue() + File.separator + "nsslib"
+                    + File.separator;
+        } catch (ArtifactResolverException e) {
+            Throwable cause = e.getCause();
+            if (cause == null) {
+                System.out.println("Cannot resolve artifact, "
+                        + "please check if JIB jar is present in classpath.");
+            } else {
+                throw new RuntimeException("Fetch artifact failed: " + clazz
+                        + "\nPlease make sure the artifact is available.");
+            }
+        }
+        return path;
+    }
+
+    @Artifact(
+            organization = "jpg.tests.jdk.nsslib",
+            name = "nsslib-windows_x64",
+            revision = "3.35",
+            extension = "zip")
+    private static class WINDOWS_X64 { }
+
+    @Artifact(
+            organization = "jpg.tests.jdk.nsslib",
+            name = "nsslib-windows_x86",
+            revision = "3.35",
+            extension = "zip")
+    private static class WINDOWS_X86 { }
+
+    @Artifact(
+            organization = "jpg.tests.jdk.nsslib",
+            name = "nsslib-macosx_x64",
+            revision = "3.35",
+            extension = "zip")
+    private static class MACOSX_X64 { }
 }
--- a/test/jdk/sun/security/pkcs11/Provider/Absolute.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/Provider/Absolute.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, 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
@@ -23,7 +23,7 @@
 /*
  * @test
  * @bug 7003952 7191662
- * @library ..
+ * @library /test/lib ..
  * @modules jdk.crypto.cryptoki
  * @summary load DLLs and launch executables using fully qualified path
  */
--- a/test/jdk/sun/security/pkcs11/Provider/ConfigQuotedString.sh	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/Provider/ConfigQuotedString.sh	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2018, 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
@@ -48,6 +48,7 @@
 echo TESTCLASSES=${TESTCLASSES}
 echo TESTJAVA=${TESTJAVA}
 echo COMPILEJAVA=${COMPILEJAVA}
+echo CPAPPEND=${CPAPPEND}
 echo ""
 
 # let java test exit if platform unsupported
@@ -105,13 +106,14 @@
 ${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
         -classpath ${TESTSRC}${FS}.. \
         -d ${TESTCLASSES} \
+        ${TESTSRC}${FS}..${FS}..${FS}..${FS}..${FS}..${FS}lib${FS}jdk${FS}test${FS}lib${FS}artifacts${FS}*.java \
         ${TESTSRC}${FS}ConfigQuotedString.java \
         ${TESTSRC}${FS}..${FS}PKCS11Test.java
 
 # run test
 
 ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \
-        -classpath ${TESTCLASSES} \
+        -classpath ${TESTCLASSES}${PS}${CPAPPEND} \
         -DCUSTOM_P11_CONFIG=${TESTSRC}${FS}ConfigQuotedString-nss.txt \
         -Dtest.src=${TESTSRC} \
         -Dtest.classes=${TESTCLASSES} \
--- a/test/jdk/sun/security/pkcs11/Provider/Login.sh	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/Provider/Login.sh	Wed Aug 15 18:41:18 2018 +0800
@@ -49,6 +49,7 @@
 echo TESTCLASSES=${TESTCLASSES}
 echo TESTJAVA=${TESTJAVA}
 echo COMPILEJAVA=${COMPILEJAVA}
+echo CPAPPEND=${CPAPPEND}
 echo ""
 
 # let java test exit if platform unsupported
@@ -114,13 +115,14 @@
 ${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
         -classpath ${TESTSRC}${FS}.. \
         -d ${TESTCLASSES} \
+        ${TESTSRC}${FS}..${FS}..${FS}..${FS}..${FS}..${FS}lib${FS}jdk${FS}test${FS}lib${FS}artifacts${FS}*.java \
         ${TESTSRC}${FS}Login.java \
         ${TESTSRC}${FS}..${FS}PKCS11Test.java
 
 # run test
 
 ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \
-        -classpath ${TESTCLASSES} \
+        -classpath ${TESTCLASSES}${PS}${CPAPPEND} \
         -DCUSTOM_DB_DIR=${TESTCLASSES} \
         -DCUSTOM_P11_CONFIG=${TESTSRC}${FS}Login-nss.txt \
         -DNO_DEFAULT=true \
--- a/test/jdk/sun/security/pkcs11/README	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/README	Wed Aug 15 18:41:18 2018 +0800
@@ -1,13 +1,33 @@
 This README is to keep a list facts and known workaround for the pkcs11 java tests
 perform as a result of bugs or features in NSS or other pkcs11 libraries.
 
+- How to get NSS libraries?
+The libraries come from the following sources.
+
+1. Specified by system property test.nss.lib.paths
+System property test.nss.lib.paths can specify a set of absolute paths to
+the local NSS library directories. The paths are separated by comma.
+
+2. Pre-built NSS libraries from artifactory server
+If the value of system property test.nss.lib.paths is not set, the tests will try
+to download pre-built NSS libraries from artifactory server. Currently, the
+tests only looks for libraries for Windows and MacOSX platforms on artifactory.
+Please note that JIB jar MUST be present in classpath when downloading the
+libraries.
+
+3. System NSS libraries
+If both of the above sources are not available, the tests will try to search
+for the libraries in some system paths. The paths are platform-specific. Note
+that, there is no such system path on Windows and MacOSX platforms. On these
+platforms, it has to use source 1 or 2.
+
 - NSS ECC None/Basic/Extended
 The tests detect the NSS library support for Elliptic Curves as to not
 report incorrect failures.  PKCS11 reports back CKR_DOMAIN_PARAMS_INVALID
 when the curve is not supported.
 
 - Default libsoftokn3.so
-By default PKCS11Test.java will look for libsoftokn3.so.  There are a number of
+By default PKCS11Test.java will look for libsoftokn3.so. There are a number of
 tests, particularly in Secmod, that need libnss3.so.  The method useNSS() in
 PKCS11test.java is to change the search and version checking to libnss3.
 
@@ -17,6 +37,6 @@
 read incorrectly. KeyStore/SecretKeysBasic.java tiggers this bug and
 knows to avoid it.
 
-- A number of EC tests fail because of a DER bug in NSS 3.11.  The best guess
+- A number of EC tests fail because of a DER bug in NSS 3.11. The best guess
 is Mozilla bug 480280.  Those tests that abort execution with a PASS result
 are:  TestECDH2, TestECDSA, TestECDSA2 and TestECGenSpec.
--- a/test/jdk/sun/security/pkcs11/SampleTest.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/SampleTest.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 4000000
  * @summary XXX todo
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @modules jdk.crypto.cryptoki
  */
 
--- a/test/jdk/sun/security/pkcs11/Secmod/AddPrivateKey.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/Secmod/AddPrivateKey.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 6414980
  * @summary Test that the PKCS#11 KeyStore handles RSA, DSA, and EC keys
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @modules jdk.crypto.cryptoki
  * @run main/othervm AddPrivateKey
  * @run main/othervm AddPrivateKey sm policy
@@ -63,6 +63,11 @@
     private static final byte[] DATA = generateData(DATA_LENGTH);
 
     public static void main(String[] args) throws Exception {
+        if (args.length > 1 && "sm".equals(args[0])) {
+            System.setProperty("java.security.policy",
+                    BASE + File.separator + args[1]);
+        }
+
         if (initSecmod() == false) {
             return;
         }
@@ -77,8 +82,6 @@
         Security.addProvider(p);
 
         if (args.length > 1 && "sm".equals(args[0])) {
-            System.setProperty("java.security.policy",
-                    BASE + File.separator + args[1]);
             System.setSecurityManager(new SecurityManager());
         }
 
--- a/test/jdk/sun/security/pkcs11/Secmod/AddTrustedCert.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/Secmod/AddTrustedCert.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 6298106
  * @summary make sure we can add a trusted cert to the NSS KeyStore module
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @modules jdk.crypto.cryptoki
  * @run main/othervm AddTrustedCert
  * @run main/othervm AddTrustedCert sm policy
@@ -48,6 +48,11 @@
 public class AddTrustedCert extends SecmodTest {
 
     public static void main(String[] args) throws Exception {
+        if (args.length > 1 && "sm".equals(args[0])) {
+            System.setProperty("java.security.policy",
+                    BASE + File.separator + args[1]);
+        }
+
         if (initSecmod() == false) {
             return;
         }
--- a/test/jdk/sun/security/pkcs11/Secmod/Crypto.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/Secmod/Crypto.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 6329006
  * @summary verify that NSS no-db mode works correctly
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @modules jdk.crypto.cryptoki
  * @run main/othervm Crypto
  * @run main/othervm Crypto sm policy
--- a/test/jdk/sun/security/pkcs11/Secmod/GetPrivateKey.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/Secmod/GetPrivateKey.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, 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
@@ -27,7 +27,7 @@
  * @summary make sure we can access the NSS softtoken KeyStore
  *          and use a private key
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @modules jdk.crypto.cryptoki
  * @run main/othervm GetPrivateKey
  * @run main/othervm GetPrivateKey sm policy
@@ -47,6 +47,11 @@
 public class GetPrivateKey extends SecmodTest {
 
     public static void main(String[] args) throws Exception {
+        if (args.length > 1 && "sm".equals(args[0])) {
+            System.setProperty("java.security.policy",
+                    BASE + File.separator + args[1]);
+        }
+
         if (initSecmod() == false) {
             return;
         }
@@ -58,8 +63,6 @@
         Security.addProvider(p);
 
         if (args.length > 1 && "sm".equals(args[0])) {
-            System.setProperty("java.security.policy",
-                    BASE + File.separator + args[1]);
             System.setSecurityManager(new SecurityManager());
         }
 
--- a/test/jdk/sun/security/pkcs11/Secmod/JksSetPrivateKey.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/Secmod/JksSetPrivateKey.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 6269847
  * @summary store a NSS PKCS11 PrivateKeyEntry to JKS KeyStore throws confusing NPE
  * @author Wang Weijun
- * @library ..
+ * @library /test/lib ..
  * @modules jdk.crypto.cryptoki
  * @run main/othervm JksSetPrivateKey
  * @run main/othervm JksSetPrivateKey sm policy
@@ -46,6 +46,11 @@
 public class JksSetPrivateKey extends SecmodTest {
 
     public static void main(String[] args) throws Exception {
+        if (args.length > 1 && "sm".equals(args[0])) {
+            System.setProperty("java.security.policy",
+                    BASE + File.separator + args[1]);
+        }
+
         if (initSecmod() == false) {
             return;
         }
@@ -57,8 +62,6 @@
         Security.addProvider(p);
 
         if (args.length > 1 && "sm".equals(args[0])) {
-            System.setProperty("java.security.policy",
-                    BASE + File.separator + args[1]);
             System.setSecurityManager(new SecurityManager());
         }
 
--- a/test/jdk/sun/security/pkcs11/Secmod/LoadKeystore.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/Secmod/LoadKeystore.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -25,7 +25,7 @@
  * @test
  * @bug 8048622 8134232
  * @summary Checks that PKCS#11 keystore can't be loaded with wrong password
- * @library ../
+ * @library /test/lib ../
  * @modules jdk.crypto.cryptoki
  * @run main/othervm LoadKeystore
  * @run main/othervm LoadKeystore sm policy
@@ -43,6 +43,11 @@
 public class LoadKeystore extends SecmodTest {
 
     public static void main(String[] args) throws Exception {
+        if (args.length > 1 && "sm".equals(args[0])) {
+            System.setProperty("java.security.policy",
+                    BASE + File.separator + args[1]);
+        }
+
         if (!initSecmod()) {
             return;
         }
@@ -55,8 +60,6 @@
         Security.addProvider(p);
 
         if (args.length > 1 && "sm".equals(args[0])) {
-            System.setProperty("java.security.policy",
-                    BASE + File.separator + args[1]);
             System.setSecurityManager(new SecurityManager());
         }
 
--- a/test/jdk/sun/security/pkcs11/Secmod/TestNssDbSqlite.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/Secmod/TestNssDbSqlite.java	Wed Aug 15 18:41:18 2018 +0800
@@ -28,7 +28,7 @@
  * @summary Test NSS DB Sqlite
  * @comment There is no NSS on Aix.
  * @requires os.family != "aix"
- * @library ../
+ * @library /test/lib ../
  * @modules java.base/sun.security.rsa
  *          java.base/sun.security.provider
  *          java.base/sun.security.jca
--- a/test/jdk/sun/security/pkcs11/Secmod/TrustAnchors.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/Secmod/TrustAnchors.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 6298106 6275523 6420252 8059627
  * @summary make sure we can access the NSS trust anchor module
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @modules jdk.crypto.cryptoki
  * @run main/othervm TrustAnchors
  * @run main/othervm TrustAnchors sm policy
--- a/test/jdk/sun/security/pkcs11/SecureRandom/Basic.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/SecureRandom/Basic.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 6246411
  * @summary basic test for PKCS#11 SecureRandom
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @key randomness
  * @modules jdk.crypto.cryptoki
  * @run main/othervm Basic
--- a/test/jdk/sun/security/pkcs11/SecureRandom/TestDeserialization.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/SecureRandom/TestDeserialization.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2018, 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
@@ -25,7 +25,7 @@
  * @test
  * @bug 6837847
  * @summary Ensure a deserialized PKCS#11 SecureRandom is functional.
- * @library ..
+ * @library /test/lib ..
  * @modules jdk.crypto.cryptoki
  */
 
--- a/test/jdk/sun/security/pkcs11/Serialize/SerializeProvider.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/Serialize/SerializeProvider.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 4921802
  * @summary Test that the SunPKCS11 provider can be serialized
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @modules jdk.crypto.cryptoki
  */
 
--- a/test/jdk/sun/security/pkcs11/Signature/ByteBuffers.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/Signature/ByteBuffers.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 4856966
  * @summary Test the Signature.update(ByteBuffer) method
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @key randomness
  * @modules jdk.crypto.cryptoki
  * @run main/othervm ByteBuffers
--- a/test/jdk/sun/security/pkcs11/Signature/ReinitSignature.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/Signature/ReinitSignature.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 4856966
  * @summary test that reinitializing Signatures works correctly
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @key randomness
  * @modules jdk.crypto.cryptoki
  * @run main ReinitSignature
--- a/test/jdk/sun/security/pkcs11/Signature/TestDSA.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/Signature/TestDSA.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 4856966
  * @summary basic test of SHA1withDSA and RawDSA signing/verifying
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @key randomness
  * @modules jdk.crypto.cryptoki
  * @run main/othervm TestDSA
--- a/test/jdk/sun/security/pkcs11/Signature/TestDSAKeyLength.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/Signature/TestDSAKeyLength.java	Wed Aug 15 18:41:18 2018 +0800
@@ -26,7 +26,7 @@
  * @bug 7200306 8029158
  * @summary verify that P11Signature impl will error out when initialized
  * with unsupported key sizes
- * @library ..
+ * @library /test/lib ..
  * @key randomness
  * @modules jdk.crypto.cryptoki
  * @run main/othervm TestDSAKeyLength
--- a/test/jdk/sun/security/pkcs11/Signature/TestRSAKeyLength.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/Signature/TestRSAKeyLength.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 6695485
  * @summary Make sure initSign/initVerify() check RSA key lengths
  * @author Yu-Ching Valerie Peng
- * @library ..
+ * @library /test/lib ..
  * @modules jdk.crypto.cryptoki
  * @run main/othervm TestRSAKeyLength
  * @run main/othervm TestRSAKeyLength sm
--- a/test/jdk/sun/security/pkcs11/ec/ReadCertificates.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/ec/ReadCertificates.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2018, 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
@@ -27,7 +27,7 @@
  * @summary Make sure that we can parse certificates using various named curves
  *   and verify their signatures
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @library ../../../../java/security/testlibrary
  * @modules jdk.crypto.cryptoki
  * @run main/othervm ReadCertificates
--- a/test/jdk/sun/security/pkcs11/ec/ReadPKCS12.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/ec/ReadPKCS12.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 6405536
  * @summary Verify that we can parse ECPrivateKeys from PKCS#12 and use them
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @library ../../../../java/security/testlibrary
  * @key randomness
  * @modules jdk.crypto.cryptoki
--- a/test/jdk/sun/security/pkcs11/ec/TestCurves.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/ec/TestCurves.java	Wed Aug 15 18:41:18 2018 +0800
@@ -26,7 +26,7 @@
  * @bug 6405536 6414980
  * @summary Basic consistency test for all curves using ECDSA and ECDH
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @modules jdk.crypto.cryptoki/sun.security.pkcs11.wrapper
  * @run main/othervm TestCurves
  * @run main/othervm TestCurves sm
--- a/test/jdk/sun/security/pkcs11/ec/TestECDH.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/ec/TestECDH.java	Wed Aug 15 18:41:18 2018 +0800
@@ -26,7 +26,7 @@
  * @bug 6405536
  * @summary Basic known answer test for ECDH
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @library ../../../../java/security/testlibrary
  * @modules jdk.crypto.cryptoki
  * @run main/othervm TestECDH
--- a/test/jdk/sun/security/pkcs11/ec/TestECDH2.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/ec/TestECDH2.java	Wed Aug 15 18:41:18 2018 +0800
@@ -26,7 +26,7 @@
  * @bug 6405536
  * @summary basic test of ECDSA signatures for P-256 and P-384 from the
  * example data in "Suite B Implementer's Guide to FIPS 186-3".
- * @library ..
+ * @library /test/lib ..
  * @library ../../../../java/security/testlibrary
  * @modules java.base/sun.security.util
  *          jdk.crypto.cryptoki
--- a/test/jdk/sun/security/pkcs11/ec/TestECDSA.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/ec/TestECDSA.java	Wed Aug 15 18:41:18 2018 +0800
@@ -26,7 +26,7 @@
  * @bug 6405536 8042967
  * @summary basic test of SHA1withECDSA and NONEwithECDSA signing/verifying
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @library ../../../../java/security/testlibrary
  * @key randomness
  * @modules jdk.crypto.cryptoki
--- a/test/jdk/sun/security/pkcs11/ec/TestECDSA2.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/ec/TestECDSA2.java	Wed Aug 15 18:41:18 2018 +0800
@@ -26,7 +26,7 @@
  * @bug 6405536
  * @summary basic test of ECDSA signatures for P-256 and P-384 from the
  * example data in "Suite B Implementer's Guide to FIPS 186-3".
- * @library ..
+ * @library /test/lib ..
  * @library ../../../../java/security/testlibrary
  * @modules java.base/sun.security.util
  *          jdk.crypto.cryptoki
--- a/test/jdk/sun/security/pkcs11/ec/TestECGenSpec.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/ec/TestECGenSpec.java	Wed Aug 15 18:41:18 2018 +0800
@@ -26,7 +26,7 @@
  * @bug 6405536
  * @summary Verify that we can use ECGenParameterSpec
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @modules jdk.crypto.cryptoki
  * @run main/othervm TestECGenSpec
  * @run main/othervm TestECGenSpec sm
--- a/test/jdk/sun/security/pkcs11/ec/TestKeyFactory.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/ec/TestKeyFactory.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 6405536
  * @summary Test the P11ECKeyFactory
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @modules jdk.crypto.cryptoki
  * @run main/othervm TestKeyFactory
  * @run main/othervm TestKeyFactory sm
--- a/test/jdk/sun/security/pkcs11/fips/ClientJSSEServerJSSE.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/fips/ClientJSSEServerJSSE.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2018, 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
@@ -25,7 +25,7 @@
  * @test
  * @bug 6313675 6323647 8028192
  * @summary Verify that all ciphersuites work in FIPS mode
- * @library ..
+ * @library /test/lib ..
  * @author Andreas Sterbenz
  * @modules java.base/com.sun.net.ssl.internal.ssl
  * @run main/manual ClientJSSEServerJSSE
--- a/test/jdk/sun/security/pkcs11/fips/TrustManagerTest.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/fips/TrustManagerTest.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 6323647
  * @summary Verify that the SunJSSE trustmanager works correctly in FIPS mode
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @modules java.base/com.sun.net.ssl.internal.ssl
  * @run main/othervm TrustManagerTest
  * @run main/othervm TrustManagerTest sm TrustManagerTest.policy
Binary file test/jdk/sun/security/pkcs11/nss/lib/macosx-x86_64/libfreebl3.dylib has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/macosx-x86_64/libnspr4.dylib has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/macosx-x86_64/libnss3.dylib has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/macosx-x86_64/libnssckbi.dylib has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/macosx-x86_64/libnssdbm3.dylib has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/macosx-x86_64/libnssutil3.dylib has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/macosx-x86_64/libplc4.dylib has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/macosx-x86_64/libplds4.dylib has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/macosx-x86_64/libsoftokn3.dylib has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/macosx-x86_64/libsqlite3.dylib has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/macosx-x86_64/libssl3.dylib has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/freebl3.chk has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/freebl3.dll has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/nspr4.dll has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/nspr4.lib has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/nss3.dll has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/nss3.lib has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/nssckbi.dll has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/nssdbm3.chk has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/nssdbm3.dll has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/nssutil3.dll has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/nssutil3.lib has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/plc4.dll has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/plc4.lib has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/plds4.dll has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/plds4.lib has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/softokn3.chk has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/softokn3.dll has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/sqlite3.dll has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/ssl3.dll has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-amd64/ssl3.lib has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-i586/freebl3.chk has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-i586/freebl3.dll has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-i586/nspr4.dll has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-i586/nspr4.lib has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-i586/nss3.dll has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-i586/nss3.lib has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-i586/nssckbi.dll has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-i586/nssdbm3.chk has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-i586/nssdbm3.dll has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-i586/nssutil3.dll has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-i586/nssutil3.lib has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-i586/plc4.dll has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-i586/plc4.lib has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-i586/plds4.dll has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-i586/plds4.lib has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-i586/softokn3.chk has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-i586/softokn3.dll has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-i586/sqlite3.dll has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-i586/ssl3.dll has changed
Binary file test/jdk/sun/security/pkcs11/nss/lib/windows-i586/ssl3.lib has changed
--- a/test/jdk/sun/security/pkcs11/rsa/KeyWrap.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/rsa/KeyWrap.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 6231216
  * @summary Verify key wrapping (of extractable keys) works for RSA/PKCS1
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @key randomness
  * @modules jdk.crypto.cryptoki
  * @run main/othervm KeyWrap
--- a/test/jdk/sun/security/pkcs11/rsa/TestCACerts.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/rsa/TestCACerts.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 4856966
  * @summary Test the new RSA provider can verify all the RSA certs in the cacerts file
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @library ../../../../java/security/testlibrary
  * @modules jdk.crypto.cryptoki
  * @run main/othervm TestCACerts
--- a/test/jdk/sun/security/pkcs11/rsa/TestKeyFactory.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/rsa/TestKeyFactory.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 4856966
  * @summary Test KeyFactory of the new RSA provider
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @modules jdk.crypto.cryptoki
  * @run main/othervm TestKeyFactory
  * @run main/othervm TestKeyFactory sm rsakeys.ks.policy
--- a/test/jdk/sun/security/pkcs11/rsa/TestSignatures.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/rsa/TestSignatures.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 4856966
  * @summary Test signing/verifying using all the signature algorithms
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @key randomness
  * @modules jdk.crypto.cryptoki
  * @run main/othervm TestSignatures
--- a/test/jdk/sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java	Wed Aug 15 18:41:18 2018 +0800
@@ -31,7 +31,7 @@
  * @bug 6405536
  * @summary Verify that all ciphersuites work (incl. ECC using NSS crypto)
  * @author Andreas Sterbenz
- * @library .. ../../../../javax/net/ssl/TLSCommon
+ * @library /test/lib .. ../../../../javax/net/ssl/TLSCommon
  * @library ../../../../java/security/testlibrary
  * @modules jdk.crypto.cryptoki
  * @run main/othervm -Djdk.tls.namedGroups="secp256r1,sect193r1"
--- a/test/jdk/sun/security/pkcs11/tls/TestKeyMaterial.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/tls/TestKeyMaterial.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 6316539 8136355
  * @summary Known-answer-test for TlsKeyMaterial generator
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @modules java.base/sun.security.internal.spec
  *          jdk.crypto.cryptoki
  * @run main/othervm TestKeyMaterial
--- a/test/jdk/sun/security/pkcs11/tls/TestLeadingZeroesP11.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/tls/TestLeadingZeroesP11.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -25,7 +25,7 @@
  * @test
  * @bug 8014618
  * @summary Need to strip leading zeros in TlsPremasterSecret of DHKeyAgreement
- * @library ..
+ * @library /test/lib ..
  * @author Pasi Eronen
  * @modules jdk.crypto.cryptoki
  * @run main/othervm TestLeadingZeroesP11
--- a/test/jdk/sun/security/pkcs11/tls/TestMasterSecret.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/tls/TestMasterSecret.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 6316539 8136355
  * @summary Known-answer-test for TlsMasterSecret generator
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @modules java.base/sun.security.internal.interfaces
  *          java.base/sun.security.internal.spec
  *          jdk.crypto.cryptoki
--- a/test/jdk/sun/security/pkcs11/tls/TestPRF.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/tls/TestPRF.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 6316539 6345251
  * @summary Basic known-answer-test for TlsPrf
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @modules java.base/sun.security.internal.spec
  *          jdk.crypto.cryptoki
  * @run main/othervm TestPRF
--- a/test/jdk/sun/security/pkcs11/tls/TestPremaster.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/tls/TestPremaster.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, 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
@@ -26,7 +26,7 @@
  * @bug 6316539 8136355
  * @summary Basic tests for TlsRsaPremasterSecret generator
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @modules java.base/sun.security.internal.spec
  *          jdk.crypto.cryptoki
  * @run main/othervm TestPremaster