From: Enzo Matsumiya <ematsumiya@suse.de>
To: linux-cifs@vger.kernel.org
Cc: smfrench@gmail.com, pc@cjr.nz, ronniesahlberg@gmail.com,
nspmangalore@gmail.com, tom@talpey.com, metze@samba.org
Subject: [PATCH v3 7/8] cifs: show signing algorithm name in DebugData
Date: Wed, 28 Sep 2022 22:56:36 -0300 [thread overview]
Message-ID: <20220929015637.14400-8-ematsumiya@suse.de> (raw)
In-Reply-To: <20220929015637.14400-1-ematsumiya@suse.de>
Add smb2_signing_algo_str() helper in smb2glob.h
Show the algorithm name in DebugData, when signing is enabled.
Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
---
fs/cifs/cifs_debug.c | 7 +++++--
fs/cifs/smb2glob.h | 10 ++++++++++
fs/cifs/smb2pdu.c | 4 ++--
3 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index c05477e28cff..86a5fb93f07f 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -13,6 +13,7 @@
#include <linux/uaccess.h>
#include "cifspdu.h"
#include "cifsglob.h"
+#include "smb2glob.h"
#include "cifsproto.h"
#include "cifs_debug.h"
#include "cifsfs.h"
@@ -354,7 +355,8 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
else if (server->compress_algorithm == SMB3_COMPRESS_LZ77_HUFF)
seq_printf(m, " COMPRESS_LZ77_HUFF");
if (server->sign)
- seq_printf(m, " signed");
+ seq_printf(m, " signed (%s)",
+ smb2_signing_algo_str(server->signing_algorithm));
if (server->posix_ext_supported)
seq_printf(m, " posix");
if (server->nosharesock)
@@ -405,7 +407,8 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
if (ses->session_flags & SMB2_SESSION_FLAG_ENCRYPT_DATA)
seq_puts(m, " encrypted");
if (ses->sign)
- seq_puts(m, " signed");
+ seq_printf(m, " signed (%s)",
+ smb2_signing_algo_str(server->signing_algorithm));
seq_printf(m, "\n\tUser: %d Cred User: %d",
from_kuid(&init_user_ns, ses->linux_uid),
diff --git a/fs/cifs/smb2glob.h b/fs/cifs/smb2glob.h
index 82e916ad167c..3a3e81b1b8cb 100644
--- a/fs/cifs/smb2glob.h
+++ b/fs/cifs/smb2glob.h
@@ -41,4 +41,14 @@
#define END_OF_CHAIN 4
#define RELATED_REQUEST 8
+static inline const char *smb2_signing_algo_str(u16 algo)
+{
+ switch (algo) {
+ case SIGNING_ALG_HMAC_SHA256: return "HMAC-SHA256";
+ case SIGNING_ALG_AES_CMAC: return "AES-CMAC";
+ case SIGNING_ALG_AES_GMAC: return "AES-GMAC";
+ default: return "unknown algorithm";
+ }
+}
+
#endif /* _SMB2_GLOB_H */
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 6c1d58492b18..6c22ead51feb 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -725,8 +725,8 @@ static void decode_signing_ctx(struct TCP_Server_Info *server,
server->signing_negotiated = true;
server->signing_algorithm = le16_to_cpu(pctxt->SigningAlgorithms[0]);
- cifs_dbg(FYI, "signing algorithm %d chosen\n",
- server->signing_algorithm);
+ cifs_dbg(FYI, "negotiated signing algorithm '%s'\n",
+ smb2_signing_algo_str(server->signing_algorithm));
}
--
2.35.3
next prev parent reply other threads:[~2022-09-29 1:57 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-29 1:56 [PATCH v3 0/8] cifs: introduce support for AES-GMAC signing Enzo Matsumiya
2022-09-29 1:56 ` [PATCH v3 1/8] smb3: rename encryption/decryption TFMs Enzo Matsumiya
2022-09-29 5:18 ` Steve French
2022-09-29 1:56 ` [PATCH v3 2/8] cifs: secmech: use shash_desc directly, remove sdesc Enzo Matsumiya
2022-09-29 1:56 ` [PATCH v3 3/8] cifs: allocate ephemeral secmechs only on demand Enzo Matsumiya
2022-09-29 5:23 ` Steve French
2022-09-29 1:56 ` [PATCH v3 4/8] cifs: create sign/verify secmechs, don't leave keys in memory Enzo Matsumiya
2022-09-29 1:56 ` [PATCH v3 5/8] cifs: introduce AES-GMAC signing support for SMB 3.1.1 Enzo Matsumiya
2022-09-29 5:14 ` Stefan Metzmacher
2022-09-29 14:16 ` Enzo Matsumiya
2022-09-29 5:22 ` Steve French
2022-09-29 1:56 ` [PATCH v3 6/8] cifs: deprecate 'enable_negotiate_signing' module param Enzo Matsumiya
2022-09-29 5:22 ` Steve French
2022-09-29 14:18 ` Enzo Matsumiya
2022-09-29 1:56 ` Enzo Matsumiya [this message]
2022-09-29 1:56 ` [PATCH v3 8/8] cifs: use MAX_CIFS_SMALL_BUFFER_SIZE-8 as padding buffer Enzo Matsumiya
2022-09-29 5:45 ` Stefan Metzmacher
2022-09-29 15:17 ` Enzo Matsumiya
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=20220929015637.14400-8-ematsumiya@suse.de \
--to=ematsumiya@suse.de \
--cc=linux-cifs@vger.kernel.org \
--cc=metze@samba.org \
--cc=nspmangalore@gmail.com \
--cc=pc@cjr.nz \
--cc=ronniesahlberg@gmail.com \
--cc=smfrench@gmail.com \
--cc=tom@talpey.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;
as well as URLs for NNTP newsgroup(s).