Re: [PATCH net 1/3] selftests: net: tls: check if FIPS mode is enabled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed,  7 Jun 2023 14:43:00 -0300 Magali Lemes wrote:
>  FIXTURE(tls)
>  {
> -	int fd, cfd;
> +	int fd, cfd, fips_enabled;

put bool fips_non_compliant into the variant, and mark down
the cases which need to be skipped. There is fewer variants
than tests

>  	bool notls;
>  };
>  
> @@ -309,7 +309,22 @@ FIXTURE_SETUP(tls)
>  {
>  	struct tls_crypto_info_keys tls12;
>  	int one = 1;
> -	int ret;
> +	int ret, res;
> +	FILE *f;
> +
> +	self->fips_enabled = 0;
> +	f = fopen("/proc/sys/crypto/fips_enabled", "r");
> +	if (f) {
> +		res = fscanf(f, "%d", &self->fips_enabled);
> +		if (res != 1)
> +			ksft_print_msg("ERROR: Couldn't read /proc/sys/crypto/fips_enabled\n");
> +		fclose(f);
> +	}

Cache the fips_enabled in a static global variable, no point reading 
it every time.
-- 
pw-bot: cr



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux