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

smb3.1.1: rename nonces used for GCM and CCM encryption

Now that 256 bit encryption can be negotiated, update
names of the nonces to match the updated official protocol
documentation (e.g. AES_GCM_NONCE instead of AES_128GCM_NONCE)
since they apply to both 128 bit and 256 bit encryption.

Signed-off-by: Steve French <stfrench@microsoft.com>
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>

+6 -6
+4 -4
fs/cifs/smb2ops.c
··· 3821 3821 tr_hdr->OriginalMessageSize = cpu_to_le32(orig_len); 3822 3822 tr_hdr->Flags = cpu_to_le16(0x01); 3823 3823 if (cipher_type == SMB2_ENCRYPTION_AES128_GCM) 3824 - get_random_bytes(&tr_hdr->Nonce, SMB3_AES128GCM_NONCE); 3824 + get_random_bytes(&tr_hdr->Nonce, SMB3_AES_GCM_NONCE); 3825 3825 else 3826 - get_random_bytes(&tr_hdr->Nonce, SMB3_AES128CCM_NONCE); 3826 + get_random_bytes(&tr_hdr->Nonce, SMB3_AES_CCM_NONCE); 3827 3827 memcpy(&tr_hdr->SessionId, &shdr->SessionId, 8); 3828 3828 } 3829 3829 ··· 3993 3993 } 3994 3994 3995 3995 if (server->cipher_type == SMB2_ENCRYPTION_AES128_GCM) 3996 - memcpy(iv, (char *)tr_hdr->Nonce, SMB3_AES128GCM_NONCE); 3996 + memcpy(iv, (char *)tr_hdr->Nonce, SMB3_AES_GCM_NONCE); 3997 3997 else { 3998 3998 iv[0] = 3; 3999 - memcpy(iv + 1, (char *)tr_hdr->Nonce, SMB3_AES128CCM_NONCE); 3999 + memcpy(iv + 1, (char *)tr_hdr->Nonce, SMB3_AES_CCM_NONCE); 4000 4000 } 4001 4001 4002 4002 aead_request_set_crypt(req, sg, sg, crypt_len, iv);
+2 -2
fs/cifs/smb2pdu.h
··· 128 128 __le16 StructureSize2; /* size of wct area (varies, request specific) */ 129 129 } __packed; 130 130 131 - #define SMB3_AES128CCM_NONCE 11 132 - #define SMB3_AES128GCM_NONCE 12 131 + #define SMB3_AES_CCM_NONCE 11 132 + #define SMB3_AES_GCM_NONCE 12 133 133 134 134 /* Transform flags (for 3.0 dialect this flag indicates CCM */ 135 135 #define TRANSFORM_FLAG_ENCRYPTED 0x0001