• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Copyright (c) 2021 Petr Vorel <pvorel@suse.cz>
4  */
5 
6 #define TST_NO_DEFAULT_MAIN
7 
8 #define PATH_FIPS	"/proc/sys/crypto/fips_enabled"
9 
10 #include "tst_test.h"
11 #include "tst_safe_macros.h"
12 #include "tst_fips.h"
13 
tst_fips_enabled(void)14 int tst_fips_enabled(void)
15 {
16 	int fips = 0;
17 
18 	if (access(PATH_FIPS, R_OK) == 0) {
19 		SAFE_FILE_SCANF(PATH_FIPS, "%d", &fips);
20 	}
21 
22 	tst_res(TINFO, "FIPS: %s", fips ? "on" : "off");
23 	return fips;
24 }
25