Blame SOURCES/rh1760838-fips_default_keystore_type.patch

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