@@ -472,6 +472,12 @@ private static void setProperties(Properties props) {
472
472
propsMapping .put ("jdk.tls.legacyAlgorithms" , restricts .jdkTlsLegacyAlgorithms );
473
473
propsMapping .put ("jdk.certpath.disabledAlgorithms" , restricts .jdkCertpathDisabledAlgorithms );
474
474
propsMapping .put ("jdk.security.legacyAlgorithm" , restricts .jdkSecurityLegacyAlgorithm );
475
+ String fipsMode = System .getProperty ("com.ibm.fips.mode" );
476
+ if (fipsMode == null ) {
477
+ System .setProperty ("com.ibm.fips.mode" , restricts .jdkFipsMode );
478
+ } else if (!fipsMode .equals (restricts .jdkFipsMode )) {
479
+ printStackTraceAndExit ("Property com.ibm.fips.mode is incompatible with semeru.customprofile and semeru.fips properties" );
480
+ }
475
481
476
482
for (Map .Entry <String , String > entry : propsMapping .entrySet ()) {
477
483
String jdkPropsName = entry .getKey ();
@@ -593,6 +599,8 @@ private static final class RestrictedSecurityProperties {
593
599
String jdkSecureRandomProvider ;
594
600
String jdkSecureRandomAlgorithm ;
595
601
602
+ String jdkFipsMode ;
603
+
596
604
// Provider with argument (provider name + optional argument).
597
605
private final List <String > providers ;
598
606
// Provider without argument.
@@ -749,6 +757,8 @@ private void initProperties() {
749
757
securityProps .getProperty (profileID + ".securerandom.provider" ));
750
758
jdkSecureRandomAlgorithm = parseProperty (
751
759
securityProps .getProperty (profileID + ".securerandom.algorithm" ));
760
+ jdkFipsMode = parseProperty (
761
+ securityProps .getProperty (profileID + ".fips.mode" ));
752
762
753
763
if (debug != null ) {
754
764
debug .println ("\t Properties of restricted security profile successfully loaded." );
@@ -1068,6 +1078,8 @@ private void printProfile(String profileToPrint) {
1068
1078
securityProps .getProperty (profileToPrint + ".desc.default" ));
1069
1079
printProperty (profileToPrint + ".desc.fips: " ,
1070
1080
securityProps .getProperty (profileToPrint + ".desc.fips" ));
1081
+ printProperty (profileToPrint + ".fips.mode: " ,
1082
+ securityProps .getProperty (profileToPrint + ".fips.mode" ));
1071
1083
printProperty (profileToPrint + ".desc.number: " ,
1072
1084
parseProperty (securityProps .getProperty (profileToPrint + ".desc.number" )));
1073
1085
printProperty (profileToPrint + ".desc.policy: " ,
0 commit comments