History

selftests: net: fcnal-test: check if FIPS mode is enabled

There are some MD5 tests which fail when the kernel is in FIPS mode, since MD5 is not FIPS compliant. Add a check and only run those tests if FIPS mode is not enabled.

Magali Lemes committed 3 years ago

Commit d7a2fc11 parent cb43c601 file · +19 −8Browse files

Unified · Split

tools/testing/selftests/net/fcnal-test.sh+19−8
@@ -92,6 +92,13 @@ NSC_CMD="ip netns exec ${NSC}" · 91 unmodified lines
92 92
93which ping6 > /dev/null 2>&1 && ping6=$(which ping6) || ping6=$(which ping)93which ping6 > /dev/null 2>&1 && ping6=$(which ping6) || ping6=$(which ping)
94 94
95# Check if FIPS mode is enabled
96if [ -f /proc/sys/crypto/fips_enabled ]; then
97 fips_enabled=`cat /proc/sys/crypto/fips_enabled`
98else
99 fips_enabled=0
100fi
101
95################################################################################102################################################################################
96# utilities103# utilities
97 104
@@ -1216,7 +1223,7 @@ ipv4_tcp_novrf() · 1118 unmodified lines
1216 run_cmd nettest -d ${NSA_DEV} -r ${a}1223 run_cmd nettest -d ${NSA_DEV} -r ${a}
1217 log_test_addr ${a} $? 1 "No server, device client, local conn"1224 log_test_addr ${a} $? 1 "No server, device client, local conn"
1218 1225
1219 ipv4_tcp_md5_novrf1226 [ "$fips_enabled" = "1" ] || ipv4_tcp_md5_novrf
1220}1227}
1221 1228
1222ipv4_tcp_vrf()1229ipv4_tcp_vrf()
@@ -1270,9 +1277,11 @@ ipv4_tcp_vrf() · 47 unmodified lines
1270 log_test_addr ${a} $? 1 "Global server, local connection"1277 log_test_addr ${a} $? 1 "Global server, local connection"
1271 1278
1272 # run MD5 tests1279 # run MD5 tests
1273 setup_vrf_dup1280 if [ "$fips_enabled" = "0" ]; then
1274 ipv4_tcp_md51281 setup_vrf_dup
1275 cleanup_vrf_dup1282 ipv4_tcp_md5
1283 cleanup_vrf_dup
1284 fi
1276 1285
1277 #1286 #
1278 # enable VRF global server1287 # enable VRF global server
@@ -2772,7 +2781,7 @@ ipv6_tcp_novrf() · 1493 unmodified lines
2772 log_test_addr ${a} $? 1 "No server, device client, local conn"2781 log_test_addr ${a} $? 1 "No server, device client, local conn"
2773 done2782 done
2774 2783
2775 ipv6_tcp_md5_novrf2784 [ "$fips_enabled" = "1" ] || ipv6_tcp_md5_novrf
2776}2785}
2777 2786
2778ipv6_tcp_vrf()2787ipv6_tcp_vrf()
@@ -2842,9 +2851,11 @@ ipv6_tcp_vrf() · 63 unmodified lines
2842 log_test_addr ${a} $? 1 "Global server, local connection"2851 log_test_addr ${a} $? 1 "Global server, local connection"
2843 2852
2844 # run MD5 tests2853 # run MD5 tests
2845 setup_vrf_dup2854 if [ "$fips_enabled" = "0" ]; then
2846 ipv6_tcp_md52855 setup_vrf_dup
2847 cleanup_vrf_dup2856 ipv6_tcp_md5
2857 cleanup_vrf_dup
2858 fi
2848 2859
2849 #2860 #
2850 # enable VRF global server2861 # enable VRF global server