linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ronnie Sahlberg <lsahlber@redhat.com>
To: linux-cifs <linux-cifs@vger.kernel.org>
Cc: Steve French <smfrench@gmail.com>
Subject: [PATCH] cifs: disable ntlmssp key exchange if ARC4 is not available
Date: Wed, 18 Aug 2021 14:10:21 +1000	[thread overview]
Message-ID: <20210818041021.1210797-2-lsahlber@redhat.com> (raw)
In-Reply-To: <20210818041021.1210797-1-lsahlber@redhat.com>

This allows to build cifs.ko when ARC4 is not available.
It comes with the drawback that key-exchange is no longer negotiated.

Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
---
 fs/cifs/cifsencrypt.c | 10 ++++++++++
 fs/cifs/sess.c        |  6 ++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
index 7680e0a9bea3..a5cf604f1864 100644
--- a/fs/cifs/cifsencrypt.c
+++ b/fs/cifs/cifsencrypt.c
@@ -22,7 +22,9 @@
 #include <linux/random.h>
 #include <linux/highmem.h>
 #include <linux/fips.h>
+#ifdef CRYPTO_ARC4
 #include <crypto/arc4.h>
+#endif
 #include <crypto/aead.h>
 
 int __cifs_calc_signature(struct smb_rqst *rqst,
@@ -682,6 +684,13 @@ setup_ntlmv2_rsp(struct cifs_ses *ses, const struct nls_table *nls_cp)
 	return rc;
 }
 
+#ifndef CRYPTO_ARC4
+int
+calc_seckey(struct cifs_ses *ses)
+{
+	return -ENODEV;
+}
+#else
 int
 calc_seckey(struct cifs_ses *ses)
 {
@@ -712,6 +721,7 @@ calc_seckey(struct cifs_ses *ses)
 	kfree_sensitive(ctx_arc4);
 	return 0;
 }
+#endif
 
 void
 cifs_crypto_secmech_release(struct TCP_Server_Info *server)
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index 34a990e1ae44..a05ef87b0560 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -622,9 +622,10 @@ void build_ntlmssp_negotiate_blob(unsigned char *pbuffer,
 		NTLMSSP_NEGOTIATE_SEAL;
 	if (server->sign)
 		flags |= NTLMSSP_NEGOTIATE_SIGN;
+#ifdef CRYPTO_ARC4		
 	if (!server->session_estab || ses->ntlmssp->sesskey_per_smbsess)
 		flags |= NTLMSSP_NEGOTIATE_KEY_XCH;
-
+#endif
 	sec_blob->NegotiateFlags = cpu_to_le32(flags);
 
 	sec_blob->WorkstationName.BufferOffset = 0;
@@ -690,9 +691,10 @@ int build_ntlmssp_auth_blob(unsigned char **pbuffer,
 		NTLMSSP_NEGOTIATE_SEAL;
 	if (ses->server->sign)
 		flags |= NTLMSSP_NEGOTIATE_SIGN;
+#ifdef CRYPTO_ARC4		
 	if (!ses->server->session_estab || ses->ntlmssp->sesskey_per_smbsess)
 		flags |= NTLMSSP_NEGOTIATE_KEY_XCH;
-
+#endif
 	tmp = *pbuffer + sizeof(AUTHENTICATE_MESSAGE);
 	sec_blob->NegotiateFlags = cpu_to_le32(flags);
 
-- 
2.30.2


  reply	other threads:[~2021-08-18  4:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-18  4:10 Disable " Ronnie Sahlberg
2021-08-18  4:10 ` Ronnie Sahlberg [this message]
2021-08-18 13:18 ` Tom Talpey
2021-08-18 16:27   ` ronnie sahlberg
2021-08-18 16:29   ` ronnie sahlberg
2021-08-18 16:51     ` Steve French
2021-08-18 18:33       ` Tom Talpey
2021-08-18 21:04         ` ronnie sahlberg

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=20210818041021.1210797-2-lsahlber@redhat.com \
    --to=lsahlber@redhat.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=smfrench@gmail.com \
    --subject='Re: [PATCH] cifs: disable ntlmssp key exchange if ARC4 is not available' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).