net/sctp: Make sha1 as default algorithm if fips is enabled
Subsystems (3)
PATCH v3 1/1 net/sctp: Make sha1 as default algorithm if fips is enabled
MD5 is not FIPS compliant. But still md5 was used as the default algorithm for sctp if fips was enabled.
Due to this, listen() system call in ltp tests was failing for sctp in fips environment, with below error message.
[ 6397.892677] sctp: failed to load transform for md5: -2
Fix is to not assign md5 as default algorithm for sctp if fips_enabled is true. Instead make sha1 as default algorithm. The issue fixes ltp testcase failure "cve-2018-5803 sctp_big_chunk"
---
v3:
* Resolved hunk failures.
* Changed the ratelimited notice to be more meaningful.
* Used ternary condition for if/else condtion.
v2:
* The listener can still fail if fips mode is enabled after that the netns is initialized.
* Fixed this in sctp_listen_start() as suggested by Paolo Abeni <[email protected]>
--- net/sctp/socket.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
net/sctp/socket.c +10 -0
@@ -49,6 +49,7 @@#include <linux/poll.h> #include <linux/init.h> #include <linux/slab.h> +#include <linux/fips.h> #include <linux/file.h> #include <linux/compat.h> #include <linux/rhashtable.h>
@@ -8501,6 +8502,15 @@ static int sctp_listen_start(struct sock *sk, int backlog)struct crypto_shash *tfm =NULL ;char alg[32 ]; +if (fips_enabled && !strcmp (sp->sctp_hmac_alg,"md5" )) { + sp->sctp_hmac_alg =IS_ENABLED (CONFIG_SCTP_DEFAULT_COOKIE_HMAC_SHA1 ) ? +"sha1" :NULL ; + +net_info_ratelimited ("changing the hmac algorithm to %s " +"as md5 is not supported when fips is enabled" , + sp->sctp_hmac_alg); + } +/* Allocate HMAC for generating cookie. */ if (!sp->hmac && sp->sctp_hmac_alg) {sprintf (alg,"hmac(%s)" , sp->sctp_hmac_alg);
Signature · 1 line
2.39.0
+ Xin Long
Quoted 12 lines · Ashwin Dayanand Kamat
MD5 is not FIPS compliant. But still md5 was used as the default algorithm for sctp if fips was enabled.
Due to this,listen()system call in ltp tests was failing for sctp in fips environment, with below error message.[ 6397.892677] sctp: failed to load transform for md5: -2Fix is to not assign md5 as default algorithm for sctp if
fips_enabledis true. Instead make sha1 as default algorithm. The issue fixes ltp testcase failure "cve-2018-5803sctp_big_chunk"Signed-off-by Ashwin Dayanand Kamat <[email protected]>
Quoted 10 lines
---
v3:
* Resolved hunk failures.
* Changed the ratelimited notice to be more meaningful.
* Used ternary condition for if/else condtion.
v2:
* The listener can still fail if fips mode is enabled after that the netns is initialized.
* Fixed this insctp_listen_start()as suggested by Paolo Abeni <[email protected]>
FWIIW, this seems reasonable to me.
Xin Long
maintainerQuoted 14 lines · Simon Horman
+ Xin Long
Quoted 10 lines · Ashwin Dayanand Kamat
MD5 is not FIPS compliant. But still md5 was used as the default algorithm for sctp if fips was enabled.
Due to this,listen()system call in ltp tests was failing for sctp in fips environment, with below error message.[ 6397.892677] sctp: failed to load transform for md5: -2Fix is to not assign md5 as default algorithm for sctp if
fips_enabledis true. Instead make sha1 as default algorithm. The issue fixes ltp testcase failure "cve-2018-5803sctp_big_chunk"
Hi, Ashwin,
I have the same question as Paolo about "this patch gets fips compliance _disabling_ the encryption", is it from any standard?
If not, can't you fix the ltp testcase for fips environment by sysctl? or set 'CONFIG_SCTP_DEFAULT_COOKIE_HMAC_SHA1=y' instead in config.
Sorry if I don't understand this well. You're trying to avoid SCTP code calling crypto_alloc_shash(MD5), right? What about other places where it may also do it in kernel? (where ltp just doesn't cover)
I don't think it makes sense to let SCTP have some code reply on FIPS only to make ltp testcase happy, while we can actually fix it in ltp by "sysctl".
Thanks.
Quoted 16 lines
Quoted 12 lines
Signed-off-by Ashwin Dayanand Kamat <[email protected]>---
v3:
* Resolved hunk failures.
* Changed the ratelimited notice to be more meaningful.
* Used ternary condition for if/else condtion.
v2:
* The listener can still fail if fips mode is enabled after that the netns is initialized.
* Fixed this insctp_listen_start()as suggested by Paolo Abeni <[email protected]>FWIIW, this seems reasonable to me.
Reviewed-by Simon Horman <[email protected]>
Quoted 33 lines · Xin Long
!! External Email
Quoted 14 lines · Simon Horman
+ Xin Long
Quoted 10 lines · Ashwin Dayanand Kamat
MD5 is not FIPS compliant. But still md5 was used as the default algorithm for sctp if fips was enabled.
Due to this,listen()system call in ltp tests was failing for sctp in fips environment, with below error message.[ 6397.892677] sctp: failed to load transform for md5: -2Fix is to not assign md5 as default algorithm for sctp if
fips_enabledis true. Instead make sha1 as default algorithm. The issue fixes ltp testcase failure "cve-2018-5803sctp_big_chunk"Hi, Ashwin,
I have the same question as Paolo about "this patch gets fips compliance _disabling_ the encryption", is it from any standard?
If not, can't you fix the ltp testcase for fips environment by sysctl? or set '
CONFIG_SCTP_DEFAULT_COOKIE_HMAC_SHA1=y' instead in config.Sorry if I don't understand this well. You're trying to avoid SCTP code calling
crypto_alloc_shash(MD5), right? What about other places where it may also do it in kernel? (where ltp just doesn't cover)
Quoted 6 lines
I don't think it makes sense to let SCTP have some code reply on FIPS only to make ltp testcase happy, while we can actually fix it in ltp by "sysctl".
Thanks.
Hi Xi,
Thanks for your inputs. I have sent the patches to ltp upstream to handle the fix from ltp codebase.
Regards,
Ashwin Kamat
Quoted 18 lines
Quoted 13 lines
Quoted 12 lines
Signed-off-by Ashwin Dayanand Kamat <[email protected]>---
v3:
* Resolved hunk failures.
* Changed the ratelimited notice to be more meaningful.
* Used ternary condition for if/else condtion.
v2:
* The listener can still fail if fips mode is enabled after that the netns is initialized.
* Fixed this insctp_listen_start()as suggested by Paolo Abeni <[email protected]>Quoted 3 lines
FWIIW, this seems reasonable to me.
Reviewed-by Simon Horman <[email protected]>!! External Email: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender.