Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

smb: client: show negotiated cipher in DebugData

Print the negotiated encryption cipher type in DebugData

Signed-off-by: Bharath SM <bharathsm@microsoft.com>
Acked-by: Paulo Alcantara (Red Hat) <pc@manguebit.org>
Signed-off-by: Steve French <stfrench@microsoft.com>

authored by

Bharath SM and committed by
Steve French
91be128b 72595cb6

+22 -5
+22 -5
fs/smb/client/cifs_debug.c
··· 347 347 } 348 348 } 349 349 350 + static __always_inline const char *cipher_alg_str(__le16 cipher) 351 + { 352 + switch (cipher) { 353 + case SMB2_ENCRYPTION_AES128_CCM: 354 + return "AES128-CCM"; 355 + case SMB2_ENCRYPTION_AES128_GCM: 356 + return "AES128-GCM"; 357 + case SMB2_ENCRYPTION_AES256_CCM: 358 + return "AES256-CCM"; 359 + case SMB2_ENCRYPTION_AES256_GCM: 360 + return "AES256-GCM"; 361 + default: 362 + return "UNKNOWN"; 363 + } 364 + } 365 + 350 366 static int cifs_debug_data_proc_show(struct seq_file *m, void *v) 351 367 { 352 368 struct mid_q_entry *mid_entry; ··· 555 539 else 556 540 seq_puts(m, "disabled (not supported by this server)"); 557 541 542 + /* Show negotiated encryption cipher, even if not required */ 543 + seq_puts(m, "\nEncryption: "); 544 + if (server->cipher_type) 545 + seq_printf(m, "Negotiated cipher (%s)", cipher_alg_str(server->cipher_type)); 546 + 558 547 seq_printf(m, "\n\n\tSessions: "); 559 548 i = 0; 560 549 list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) { ··· 597 576 598 577 /* dump session id helpful for use with network trace */ 599 578 seq_printf(m, " SessionId: 0x%llx", ses->Suid); 600 - if (ses->session_flags & SMB2_SESSION_FLAG_ENCRYPT_DATA) { 579 + if (ses->session_flags & SMB2_SESSION_FLAG_ENCRYPT_DATA) 601 580 seq_puts(m, " encrypted"); 602 - /* can help in debugging to show encryption type */ 603 - if (server->cipher_type == SMB2_ENCRYPTION_AES256_GCM) 604 - seq_puts(m, "(gcm256)"); 605 - } 606 581 if (ses->sign) 607 582 seq_puts(m, " signed"); 608 583