CEPH filesystem development
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Ilya Dryomov <idryomov@gmail.com>,
	Alex Markuze <amarkuze@redhat.com>,
	Viacheslav Dubeyko <slava@dubeyko.com>,
	Eric Biggers <ebiggers@kernel.org>
Cc: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>,
	ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] libceph: Re-establish the FIPS keylength check in the Ceph code
Date: Fri, 21 Aug 2026 16:43:22 +0200	[thread overview]
Message-ID: <20260821144323.776371-1-thuth@redhat.com> (raw)

When the Ceph code had been updated to use the libcrypto hmac_sha256
functions instead of the "hmac(sha256)" crypto shash driver, we lost
the FIPS key length check from  hmac_setkey() in crypto/hmac.c.
Since libcrypto won't support this FIPS check (it should be done in
the calling sites instead), add the check now to the Ceph code
instead to make this code more FIPS friendly again.

Fixes: 27c0a7b05d13a ("libceph: Use HMAC-SHA256 library instead of crypto_shash")
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 net/ceph/messenger_v2.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/ceph/messenger_v2.c b/net/ceph/messenger_v2.c
index 05f6eea299fc0..378493d5d7155 100644
--- a/net/ceph/messenger_v2.c
+++ b/net/ceph/messenger_v2.c
@@ -12,6 +12,7 @@
 #include <crypto/utils.h>
 #include <linux/bvec.h>
 #include <linux/crc32c.h>
+#include <linux/fips.h>
 #include <linux/net.h>
 #include <linux/scatterlist.h>
 #include <linux/socket.h>
@@ -721,6 +722,9 @@ static int setup_crypto(struct ceph_connection *con,
 		return 0;  /* auth_none */
 	}
 
+	if (fips_enabled && session_key_len < 112 / 8)
+		return -EKEYREJECTED;
+
 	hmac_sha256_preparekey(&con->v2.hmac_key, session_key, session_key_len);
 	con->v2.hmac_key_set = true;
 
-- 
2.55.0


             reply	other threads:[~2026-08-21 14:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-21 14:43 Thomas Huth [this message]
2026-08-21 17:53 ` [PATCH] libceph: Re-establish the FIPS keylength check in the Ceph code Eric Biggers
2026-08-21 19:36   ` Eric Biggers

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=20260821144323.776371-1-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=Slava.Dubeyko@ibm.com \
    --cc=amarkuze@redhat.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=ebiggers@kernel.org \
    --cc=idryomov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=slava@dubeyko.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