From: Petr Vorel <pvorel@suse.cz>
To: Ashwin Dayanand Kamat <kashwindayan@vmware.com>
Cc: tkundu@vmware.com, akaher@vmware.com, vsirnapalli@vmware.com,
ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] sctp_big_chunk: Do not use md5 hmac algo if fips is enabled
Date: Wed, 21 Jun 2023 00:24:10 +0200 [thread overview]
Message-ID: <20230620222410.GA340710@pevik> (raw)
In-Reply-To: <1687280634-5906-1-git-send-email-kashwindayan@vmware.com>
Hi Ashwin,
> MD5 is not FIPS compliant. But still md5 is used as the default algorithm for sctp
> even when fips is enabled. Due to this, sctp_big_chunk testcase is failing because listen()
> system call in setup_server() is failing in fips environment.
> Fix is to not use md5 algorithm while setting up server.
> Instead use sha1 as algorithm if it's supported or else set it to none.
> Signed-Off by: Ashwin Dayanand Kamat <kashwindayan@vmware.com>
> ---
> testcases/network/sctp/sctp_big_chunk.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
> diff --git a/testcases/network/sctp/sctp_big_chunk.c b/testcases/network/sctp/sctp_big_chunk.c
> index a6a326ea2..267f1cb45 100644
> --- a/testcases/network/sctp/sctp_big_chunk.c
> +++ b/testcases/network/sctp/sctp_big_chunk.c
> @@ -133,11 +133,15 @@ static void setup_client(void)
> }
> static const char mtu_path[] = "/sys/class/net/lo/mtu";
> +static const char hmac_algo_path[] = "/proc/sys/net/sctp/cookie_hmac_alg";
> static const unsigned int max_mtu = 65535;
> static unsigned int mtu;
> static void setup(void)
> {
> + char hmac_algo[CHAR_MAX];
> + int fips_enabled = tst_fips_enabled();
> +
> if (tst_parse_int(addr_param, &addr_num, 1, INT_MAX))
> tst_brk(TBROK, "wrong address number '%s'", addr_param);
> @@ -146,8 +150,18 @@ static void setup(void)
> if (mtu < max_mtu)
> tst_brk(TCONF, "Test needs that 'lo' MTU has %d", max_mtu);
> + SAFE_FILE_SCANF(hmac_algo_path, "%s", hmac_algo);
> +
> + if (fips_enabled) {
fips_enabled is used only here => if (tst_fips_enabled()) {
> + if (!system("grep hmac\\(sha1\\) /proc/crypto"))
This would not be acceptable. We have SAFE_FILE_LINES_SCANF()
Something like would do:
SAFE_FILE_LINES_SCANF("/proc/crypto", "hmac(sha1)");
But I wonder if just setting "none" on FIPS would be enough.
Also, shouldn't this be set in setup_server() before SAFE_LISTEN(),
to be obvious what needs it?
Kind regards,
Petr
> + SAFE_FILE_PRINTF(hmac_algo_path, "%s", "sha1");
> + else
> + SAFE_FILE_PRINTF(hmac_algo_path, "%s", "none");
> + }
> +
> setup_server();
> setup_client();
> + SAFE_FILE_PRINTF(hmac_algo_path, "%s", hmac_algo);
> }
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2023-06-20 22:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-20 17:03 [LTP] [PATCH] sctp_big_chunk: Do not use md5 hmac algo if fips is enabled Ashwin Dayanand Kamat via ltp
2023-06-20 22:24 ` Petr Vorel [this message]
2023-06-20 22:26 ` Petr Vorel
2023-06-21 5:53 ` Ashwin Dayanand Kamat via ltp
2023-06-21 8:17 ` Petr Vorel
2023-06-21 12:48 ` Petr Vorel
2023-06-21 14:15 ` Ashwin Dayanand Kamat via ltp
[not found] ` <442F1FEF-AA44-4CC8-9809-6D99912CD063@vmware.com>
[not found] ` <B4BE4EDF-B94F-49F0-A624-CF2810A4E112@vmware.com>
2023-06-21 14:22 ` Ashwin Dayanand Kamat via ltp
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=20230620222410.GA340710@pevik \
--to=pvorel@suse.cz \
--cc=akaher@vmware.com \
--cc=kashwindayan@vmware.com \
--cc=ltp@lists.linux.it \
--cc=tkundu@vmware.com \
--cc=vsirnapalli@vmware.com \
/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