Blame SOURCES/rh1760838-fips_default_keystore_type.patch

5781ba
diff -r 6efbd7b35a10 src/share/classes/java/security/SystemConfigurator.java
5781ba
--- openjdk.orig/jdk/src/share/classes/java/security/SystemConfigurator.java	Thu Jan 23 18:22:31 2020 -0300
5781ba
+++ openjdk/jdk/src/share/classes/java/security/SystemConfigurator.java	Mon Mar 02 19:20:17 2020 -0300
5781ba
@@ -123,6 +123,33 @@
5781ba
                     }
5781ba
                     props.put(fipsProviderKey, fipsProviderValue);
5781ba
                 }
5781ba
+                // Add other security properties
5781ba
+                String keystoreTypeValue = (String) props.get("fips.keystore.type");
5781ba
+                if (keystoreTypeValue != null) {
5781ba
+                    String nonFipsKeystoreType = props.getProperty("keystore.type");
5781ba
+                    props.put("keystore.type", keystoreTypeValue);
5781ba
+                    if (keystoreTypeValue.equals("PKCS11")) {
5781ba
+                    	// If keystore.type is PKCS11, javax.net.ssl.keyStore
5781ba
+                    	// must be "NONE". See JDK-8238264.
5781ba
+                    	System.setProperty("javax.net.ssl.keyStore", "NONE");
5781ba
+                    }
5781ba
+                    if (System.getProperty("javax.net.ssl.trustStoreType") == null) {
5781ba
+                        // If no trustStoreType has been set, use the
5781ba
+                        // previous keystore.type under FIPS mode. In
5781ba
+                        // a default configuration, the Trust Store will
5781ba
+                        // be 'cacerts' (JKS type).
5781ba
+                        System.setProperty("javax.net.ssl.trustStoreType",
5781ba
+                                nonFipsKeystoreType);
5781ba
+                    }
5781ba
+                    if (sdebug != null) {
5781ba
+                        sdebug.println("FIPS mode default keystore.type = " +
5781ba
+                                keystoreTypeValue);
5781ba
+                        sdebug.println("FIPS mode javax.net.ssl.keyStore = " +
5781ba
+                        		System.getProperty("javax.net.ssl.keyStore", ""));
5781ba
+                        sdebug.println("FIPS mode javax.net.ssl.trustStoreType = " +
5781ba
+                                System.getProperty("javax.net.ssl.trustStoreType", ""));
5781ba
+                    }
5781ba
+                }
5781ba
                 loadedProps = true;
5781ba
             }
5781ba
         } catch (Exception e) {
5781ba
diff -r 6efbd7b35a10 src/share/lib/security/java.security-linux
5781ba
--- openjdk.orig/jdk/src/share/lib/security/java.security-linux	Thu Jan 23 18:22:31 2020 -0300
5781ba
+++ openjdk/jdk/src/share/lib/security/java.security-linux	Mon Mar 02 19:20:17 2020 -0300
5781ba
@@ -179,6 +179,11 @@
5781ba
 keystore.type=jks
5781ba
 
5781ba
 #
5781ba
+# Default keystore type used when global crypto-policies are set to FIPS.
5781ba
+#
5781ba
+fips.keystore.type=PKCS11
5781ba
+
5781ba
+#
5781ba
 # Controls compatibility mode for the JKS keystore type.
5781ba
 #
5781ba
 # When set to 'true', the JKS keystore type supports loading