@@ -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),
@@ -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 */
@@ -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));
}
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(-)