Skip to content

Commit 247b88e

Browse files
authored
Merge pull request #450 from KostasTsiounis/check_fips_mode
Only check and set FIPS mode in FIPS profiles
2 parents 1e24402 + b9f75fc commit 247b88e

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
@@ -569,11 +569,17 @@ private static void setProperties(Properties props) {
569569
propsMapping.put("jdk.tls.legacyAlgorithms", restricts.jdkTlsLegacyAlgorithms);
570570
propsMapping.put("jdk.certpath.disabledAlgorithms", restricts.jdkCertpathDisabledAlgorithms);
571571
propsMapping.put("jdk.security.legacyAlgorithms", restricts.jdkSecurityLegacyAlgorithms);
572-
String fipsMode = System.getProperty("com.ibm.fips.mode");
573-
if (fipsMode == null) {
574-
System.setProperty("com.ibm.fips.mode", restricts.jdkFipsMode);
575-
} else if (!fipsMode.equals(restricts.jdkFipsMode)) {
576-
printStackTraceAndExit("Property com.ibm.fips.mode is incompatible with semeru.customprofile and semeru.fips properties");
572+
573+
if (restricts.descIsFIPS) {
574+
if (restricts.jdkFipsMode == null) {
575+
printStackTraceAndExit(profileID + ".fips.mode property is not set in FIPS profile");
576+
}
577+
String fipsMode = System.getProperty("com.ibm.fips.mode");
578+
if (fipsMode == null) {
579+
System.setProperty("com.ibm.fips.mode", restricts.jdkFipsMode);
580+
} else if (!fipsMode.equals(restricts.jdkFipsMode)) {
581+
printStackTraceAndExit("Property com.ibm.fips.mode is incompatible with semeru.customprofile and semeru.fips properties");
582+
}
577583
}
578584

579585
if (userEnabledFIPS && !allowSetProperties) {

0 commit comments

Comments
 (0)