Skip to content

Commit

Permalink
Merge pull request #450 from KostasTsiounis/check_fips_mode
Browse files Browse the repository at this point in the history
Only check and set FIPS mode in FIPS profiles
  • Loading branch information
keithc-ca authored Mar 7, 2025
2 parents 1e24402 + b9f75fc commit 247b88e
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -569,11 +569,17 @@ private static void setProperties(Properties props) {
propsMapping.put("jdk.tls.legacyAlgorithms", restricts.jdkTlsLegacyAlgorithms);
propsMapping.put("jdk.certpath.disabledAlgorithms", restricts.jdkCertpathDisabledAlgorithms);
propsMapping.put("jdk.security.legacyAlgorithms", restricts.jdkSecurityLegacyAlgorithms);
String fipsMode = System.getProperty("com.ibm.fips.mode");
if (fipsMode == null) {
System.setProperty("com.ibm.fips.mode", restricts.jdkFipsMode);
} else if (!fipsMode.equals(restricts.jdkFipsMode)) {
printStackTraceAndExit("Property com.ibm.fips.mode is incompatible with semeru.customprofile and semeru.fips properties");

if (restricts.descIsFIPS) {
if (restricts.jdkFipsMode == null) {
printStackTraceAndExit(profileID + ".fips.mode property is not set in FIPS profile");
}
String fipsMode = System.getProperty("com.ibm.fips.mode");
if (fipsMode == null) {
System.setProperty("com.ibm.fips.mode", restricts.jdkFipsMode);
} else if (!fipsMode.equals(restricts.jdkFipsMode)) {
printStackTraceAndExit("Property com.ibm.fips.mode is incompatible with semeru.customprofile and semeru.fips properties");
}
}

if (userEnabledFIPS && !allowSetProperties) {
Expand Down

0 comments on commit 247b88e

Please sign in to comment.