public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Ashwin Dayanand Kamat via ltp <ltp@lists.linux.it>
To: ltp@lists.linux.it, kashwindayan@vmware.com, akaher@vmware.com,
	tkundu@vmware.com, vsirnapalli@vmware.com
Subject: [LTP] [PATCH] sctp_big_chunk: Do not use md5 hmac algo if fips is enabled
Date: Tue, 20 Jun 2023 22:33:54 +0530	[thread overview]
Message-ID: <1687280634-5906-1-git-send-email-kashwindayan@vmware.com> (raw)

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) {
+		if (!system("grep hmac\\(sha1\\) /proc/crypto"))
+			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);
 }
 
 static void run(void)
-- 
2.39.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

             reply	other threads:[~2023-06-20 17:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-20 17:03 Ashwin Dayanand Kamat via ltp [this message]
2023-06-20 22:24 ` [LTP] [PATCH] sctp_big_chunk: Do not use md5 hmac algo if fips is enabled Petr Vorel
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=1687280634-5906-1-git-send-email-kashwindayan@vmware.com \
    --to=ltp@lists.linux.it \
    --cc=akaher@vmware.com \
    --cc=kashwindayan@vmware.com \
    --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