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
9292
9393 which ping6 > /dev/null 2>&1 && ping6=$(which ping6) || ping6=$(which ping)
9494
95+# Check if FIPS mode is enabled
96+if [ -f /proc/sys/crypto/fips_enabled ]; then
97+ fips_enabled=`cat /proc/sys/crypto/fips_enabled`
98+else
99+ fips_enabled=0
100+fi
101+
95102 ################################################################################
96103 # utilities
97104
@@ -1216,7 +1223,7 @@ ipv4_tcp_novrf() · 1118 unmodified lines
12161223 run_cmd nettest -d ${NSA_DEV} -r ${a}
12171224 log_test_addr ${a} $? 1 "No server, device client, local conn"
12181225
1219− ipv4_tcp_md5_novrf
1226+ [ "$fips_enabled" = "1" ] || ipv4_tcp_md5_novrf
12201227 }
12211228
12221229 ipv4_tcp_vrf()
@@ -1270,9 +1277,11 @@ ipv4_tcp_vrf() · 47 unmodified lines
12701277 log_test_addr ${a} $? 1 "Global server, local connection"
12711278
12721279 # run MD5 tests
1273− setup_vrf_dup
1274− ipv4_tcp_md5
1275− cleanup_vrf_dup
1280+ if [ "$fips_enabled" = "0" ]; then
1281+ setup_vrf_dup
1282+ ipv4_tcp_md5
1283+ cleanup_vrf_dup
1284+ fi
12761285
12771286 #
12781287 # enable VRF global server
@@ -2772,7 +2781,7 @@ ipv6_tcp_novrf() · 1493 unmodified lines
27722781 log_test_addr ${a} $? 1 "No server, device client, local conn"
27732782 done
27742783
2775− ipv6_tcp_md5_novrf
2784+ [ "$fips_enabled" = "1" ] || ipv6_tcp_md5_novrf
27762785 }
27772786
27782787 ipv6_tcp_vrf()
@@ -2842,9 +2851,11 @@ ipv6_tcp_vrf() · 63 unmodified lines
28422851 log_test_addr ${a} $? 1 "Global server, local connection"
28432852
28442853 # run MD5 tests
2845− setup_vrf_dup
2846− ipv6_tcp_md5
2847− cleanup_vrf_dup
2854+ if [ "$fips_enabled" = "0" ]; then
2855+ setup_vrf_dup
2856+ ipv6_tcp_md5
2857+ cleanup_vrf_dup
2858+ fi
28482859
28492860 #
28502861 # enable VRF global server