From: Jakub Kicinski <kuba@kernel.org>
To: Magali Lemes <magali.lemes@canonical.com>
Cc: davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
shuah@kernel.org, vfedorenko@novek.ru,
tianjia.zhang@linux.alibaba.com, andrei.gherzan@canonical.com,
netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net 1/3] selftests: net: tls: check if FIPS mode is enabled
Date: Thu, 8 Jun 2023 19:17:12 -0700 [thread overview]
Message-ID: <20230608191712.483dfe35@kernel.org> (raw)
In-Reply-To: <20230607174302.19542-2-magali.lemes@canonical.com>
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
next prev parent reply other threads:[~2023-06-09 2:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-07 17:42 [PATCH net 0/3] Check if FIPS mode is enabled when running selftests Magali Lemes
2023-06-07 17:43 ` [PATCH net 1/3] selftests: net: tls: check if FIPS mode is enabled Magali Lemes
2023-06-09 2:17 ` Jakub Kicinski [this message]
2023-06-07 17:43 ` [PATCH net 2/3] selftests: net: vrf-xfrm-tests: change authentication and encryption algos Magali Lemes
2023-06-07 18:35 ` David Ahern
2023-06-07 17:43 ` [PATCH net 3/3] selftests: net: fcnal-test: check if FIPS mode is enabled Magali Lemes
2023-06-07 18:35 ` David Ahern
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230608191712.483dfe35@kernel.org \
--to=kuba@kernel.org \
--cc=andrei.gherzan@canonical.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=magali.lemes@canonical.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
--cc=tianjia.zhang@linux.alibaba.com \
--cc=vfedorenko@novek.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).