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, pvorel@suse.cz
Subject: [LTP] [PATCH v2] sctp_big_chunk: Do not use md5 hmac algo if fips is enabled
Date: Thu, 22 Jun 2023 20:20:37 +0530 [thread overview]
Message-ID: <1687445437-2453-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 set it to none
Signed-Off by: Ashwin Dayanand Kamat <kashwindayan@vmware.com>
----
v2:
As per the review comments given by Petr, did below changes in v2,
* Moved the logic to sctp_server() function
* Setting none as the default algo
* make sure cookie_hmac_alg file is present before accessing it
---
testcases/network/sctp/sctp_big_chunk.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/testcases/network/sctp/sctp_big_chunk.c b/testcases/network/sctp/sctp_big_chunk.c
index a6a326ea2..31786dd39 100644
--- a/testcases/network/sctp/sctp_big_chunk.c
+++ b/testcases/network/sctp/sctp_big_chunk.c
@@ -34,6 +34,24 @@ static int addr_num = 3273;
static void setup_server(void)
{
+ const char *const cmd_modprobe[] = {"modprobe", "sctp", NULL};
+ const char hmac_algo_path[] = "/proc/sys/net/sctp/cookie_hmac_alg";
+ char hmac_algo[CHAR_MAX];
+ int hmac_algo_changed = 0;
+
+ /* Disable md5 if fips is enabled. Set it to none */
+ if (tst_fips_enabled()) {
+ if (access(hmac_algo_path, F_OK) < 0) {
+ SAFE_CMD(cmd_modprobe, NULL, NULL);
+ }
+
+ if (!access(hmac_algo_path, F_OK)) {
+ SAFE_FILE_SCANF(hmac_algo_path, "%s", hmac_algo);
+ SAFE_FILE_PRINTF(hmac_algo_path, "%s", "none");
+ hmac_algo_changed = 1;
+ }
+ }
+
loc.sin6_family = AF_INET6;
loc.sin6_addr = in6addr_loopback;
@@ -46,6 +64,9 @@ static void setup_server(void)
SAFE_LISTEN(sfd, 1);
srand(port);
+
+ if (hmac_algo_changed)
+ SAFE_FILE_PRINTF(hmac_algo_path, "%s", hmac_algo);
}
static void update_packet_field(size_t *off, void *buf, size_t buf_len)
--
2.39.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next reply other threads:[~2023-06-22 14:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-22 14:50 Ashwin Dayanand Kamat via ltp [this message]
2023-06-27 11:04 ` [LTP] [PATCH v2] sctp_big_chunk: Do not use md5 hmac algo if fips is enabled Petr Vorel
2023-06-27 11:09 ` Petr Vorel
2023-06-27 11:20 ` Petr Vorel
2023-06-27 12:58 ` Petr Vorel
2023-06-28 6:05 ` 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=1687445437-2453-1-git-send-email-kashwindayan@vmware.com \
--to=ltp@lists.linux.it \
--cc=akaher@vmware.com \
--cc=kashwindayan@vmware.com \
--cc=pvorel@suse.cz \
--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