# HG changeset patch # User bgopularam # Date 1453310517 28800 # Node ID 12dabfdd19973caf7edd4ccaf0e5a265f749ecc8 # Parent 30eaec7fded0be77dafcb61f52f7e2fe770e588d 8133085: Avoid creating instances of security providers when possible Reviewed-by: mullan diff -r 30eaec7fded0 -r 12dabfdd1997 jdk/test/com/sun/crypto/provider/Cipher/DES/PerformanceTest.java --- a/jdk/test/com/sun/crypto/provider/Cipher/DES/PerformanceTest.java Wed Jan 20 08:33:40 2016 -0800 +++ b/jdk/test/com/sun/crypto/provider/Cipher/DES/PerformanceTest.java Wed Jan 20 09:21:57 2016 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -33,7 +33,6 @@ import java.io.*; import javax.crypto.*; import javax.crypto.spec.*; -import com.sun.crypto.provider.*; public class PerformanceTest { @@ -81,8 +80,6 @@ byte[] in; - SunJCE jce = new SunJCE(); - Security.addProvider(jce); col = new StringBuffer(); printHeadings(); diff -r 30eaec7fded0 -r 12dabfdd1997 jdk/test/javax/net/ssl/TLS/TestJSSE.java --- a/jdk/test/javax/net/ssl/TLS/TestJSSE.java Wed Jan 20 08:33:40 2016 -0800 +++ b/jdk/test/javax/net/ssl/TLS/TestJSSE.java Wed Jan 20 09:21:57 2016 -0800 @@ -1,5 +1,5 @@ /** - * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 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 under @@ -111,8 +111,6 @@ out.println(" Testing - https://" + LOCAL_IP + ":" + testPort); out.println(" Testing - Protocol : " + testProtocols); out.println(" Testing - Cipher : " + testCipher); - Provider p = new sun.security.ec.SunEC(); - Security.insertProviderAt(p, 1); try { CipherTestUtils.main(new JSSEFactory(LOCAL_IP, testPort, testProtocols, @@ -132,8 +130,6 @@ out.println(" Testing Protocol: " + testProtocol); out.println(" Testing Cipher: " + testCipher); out.println(" Testing Port: " + testPort); - Provider p = new sun.security.ec.SunEC(); - Security.insertProviderAt(p, 1); try { CipherTestUtils.main(new JSSEFactory(null, testPort, testProtocol, testCipher, "Server JSSE"), diff -r 30eaec7fded0 -r 12dabfdd1997 jdk/test/sun/security/pkcs11/fips/ImportKeyStore.java --- a/jdk/test/sun/security/pkcs11/fips/ImportKeyStore.java Wed Jan 20 08:33:40 2016 -0800 +++ b/jdk/test/sun/security/pkcs11/fips/ImportKeyStore.java Wed Jan 20 09:21:57 2016 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -48,7 +48,8 @@ public static void main(String[] args) throws Exception { String nssCfg = "--name=NSS\nnssSecmodDirectory=.\n "; // "attributes(*,CKO_PRIVATE_KEY,CKK_DSA) = { CKA_NETSCAPE_DB = 0h00 }"; - Provider p = new sun.security.pkcs11.SunPKCS11(nssCfg); + Provider p = Security.getProvider("SunPKCS11"); + p.configure(nssCfg); KeyStore ks = KeyStore.getInstance("PKCS11", p); ks.load(null, "test12".toCharArray());