Skip to content

Commit 7a891d4

Browse files
namjaejeonsmfrench
authored andcommitted
ksmbd: fix wrong signingkey creation when encryption is AES256
MacOS and Win11 support AES256 encrytion and it is included in the cipher array of encryption context. Especially on macOS, The most preferred cipher is AES256. Connecting to ksmbd fails on newer MacOS clients that support AES256 encryption. MacOS send disconnect request after receiving final session setup response from ksmbd. Because final session setup is signed with signing key was generated incorrectly. For signging key, 'L' value should be initialized to 128 if key size is 16bytes. Cc: stable@vger.kernel.org Reported-by: Miao Lihua <441884205@qq.com> Tested-by: Miao Lihua <441884205@qq.com> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent e8d018d commit 7a891d4

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

fs/ksmbd/auth.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -727,8 +727,9 @@ static int generate_key(struct ksmbd_conn *conn, struct ksmbd_session *sess,
727727
goto smb3signkey_ret;
728728
}
729729

730-
if (conn->cipher_type == SMB2_ENCRYPTION_AES256_CCM ||
731-
conn->cipher_type == SMB2_ENCRYPTION_AES256_GCM)
730+
if (key_size == SMB3_ENC_DEC_KEY_SIZE &&
731+
(conn->cipher_type == SMB2_ENCRYPTION_AES256_CCM ||
732+
conn->cipher_type == SMB2_ENCRYPTION_AES256_GCM))
732733
rc = crypto_shash_update(CRYPTO_HMACSHA256(ctx), L256, 4);
733734
else
734735
rc = crypto_shash_update(CRYPTO_HMACSHA256(ctx), L128, 4);

0 commit comments

Comments
 (0)