Skip to content

Commit f0f63c7

Browse files
authored
Merge pull request #878 from KostasTsiounis/check_fips_mode
Only check and set FIPS mode in FIPS profiles
2 parents 936e588 + 0b7b636 commit f0f63c7

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java

+11-5
Original file line numberDiff line numberDiff line change
@@ -571,11 +571,17 @@ private static void setProperties(Properties props) {
571571
propsMapping.put("jdk.tls.legacyAlgorithms", restricts.jdkTlsLegacyAlgorithms);
572572
propsMapping.put("jdk.certpath.disabledAlgorithms", restricts.jdkCertpathDisabledAlgorithms);
573573
propsMapping.put("jdk.security.legacyAlgorithms", restricts.jdkSecurityLegacyAlgorithms);
574-
String fipsMode = System.getProperty("com.ibm.fips.mode");
575-
if (fipsMode == null) {
576-
System.setProperty("com.ibm.fips.mode", restricts.jdkFipsMode);
577-
} else if (!fipsMode.equals(restricts.jdkFipsMode)) {
578-
printStackTraceAndExit("Property com.ibm.fips.mode is incompatible with semeru.customprofile and semeru.fips properties");
574+
575+
if (restricts.descIsFIPS) {
576+
if (restricts.jdkFipsMode == null) {
577+
printStackTraceAndExit(profileID + ".fips.mode property is not set in FIPS profile");
578+
}
579+
String fipsMode = System.getProperty("com.ibm.fips.mode");
580+
if (fipsMode == null) {
581+
System.setProperty("com.ibm.fips.mode", restricts.jdkFipsMode);
582+
} else if (!fipsMode.equals(restricts.jdkFipsMode)) {
583+
printStackTraceAndExit("Property com.ibm.fips.mode is incompatible with semeru.customprofile and semeru.fips properties");
584+
}
579585
}
580586

581587
if (userEnabledFIPS && !allowSetProperties) {

0 commit comments

Comments
 (0)