Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Namjae Jeon <linkinjeon@kernel.org>
Cc: linux-cifs@vger.kernel.org, Steve French <smfrench@gmail.com>,
	Sergey Senozhatsky <senozhatsky@chromium.org>,
	Tom Talpey <tom@talpey.com>,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] ksmbd: Use HMAC-SHA256 library for message signing and key generation
Date: Thu, 16 Oct 2025 10:54:33 -0700	[thread overview]
Message-ID: <20251016175433.GB1575@sol> (raw)
In-Reply-To: <CAKYAXd8Zwnr2bv85_xEekjOHvSqC7dtfZw+ETZnv1s_d+ZRyiw@mail.gmail.com>

On Thu, Oct 16, 2025 at 02:00:37PM +0900, Namjae Jeon wrote:
> [snip]
> > @@ -8876,22 +8865,21 @@ void smb2_set_sign_rsp(struct ksmbd_work *work)
> >         struct kvec *iov;
> >         int n_vec = 1;
> >
> >         hdr = ksmbd_resp_buf_curr(work);
> >         hdr->Flags |= SMB2_FLAGS_SIGNED;
> > -       memset(hdr->Signature, 0, SMB2_SIGNATURE_SIZE);
> By deleting this line, the following error occurs.
> 
> [162118.260693] CIFS: VFS: sign fail cmd 0x3 message id 0x3
> [162118.260707] CIFS: VFS: \\10.177.110.57 SMB signature verification
> returned error = -13
> [162118.261473] CIFS: VFS: sign fail cmd 0xb message id 0x4
> [162118.261482] CIFS: VFS: \\10.177.110.57 SMB signature verification
> returned error = -13
> [162118.262437] CIFS: VFS: sign fail cmd 0x3 message id 0x5
> [162118.262449] CIFS: VFS: \\10.177.110.57 SMB signature verification
> returned error = -13
> [162118.262892] CIFS: VFS: sign fail cmd 0x5 message id 0x6
> [162118.262900] CIFS: VFS: \\10.177.110.57 SMB signature verification
> returned error = -13
> [162118.263301] CIFS: VFS: sign fail cmd 0x10 message id 0x7
> [162118.263314] CIFS: VFS: \\10.177.110.57 SMB signature verification
> returned error = -13
> [162118.263724] CIFS: VFS: sign fail cmd 0x10 message id 0x8
> [162118.263736] CIFS: VFS: \\10.177.110.57 SMB signature verification
> returned error = -13
> [162118.264142] CIFS: VFS: sign fail cmd 0x6 message id 0x9
> [162118.264154] CIFS: VFS: \\10.177.110.57 SMB signature verification
> returned error = -13
> [162118.264591] CIFS: VFS: sign fail cmd 0x5 message id 0xa
> [162118.264603] CIFS: VFS: \\10.177.110.57 SMB signature verification
> returned error = -13
> [162118.264912] CIFS: VFS: sign fail cmd 0x6 message id 0xb
> [162118.264925] CIFS: VFS: \\10.177.110.57 SMB signature verification
> returned error = -13
> [162118.265244] CIFS: VFS: sign fail cmd 0x5 message id 0xc
> [162118.265257] CIFS: VFS: \\10.177.110.57 SMB signature verification
> returned error = -13
> [162119.831575] CIFS: VFS: \\10.177.110.57\homes2 SMB signature
> verification returned error = -13
> 
> I have directly restored this line manually and then applied this
> patch to #ksmbd-for-next-next.
> Thanks!

Thanks for catching that!  It looked like zeroizing 'hdr->Signature' was
only needed for when ksmbd_sign_smb2_pdu() failed.  But it must be part
of the HMAC input data as well, i.e. 'hdr' must point to the same memory
as one of the iovecs.  So restoring the line is fine.  Thanks,

- Eric

  reply	other threads:[~2025-10-16 17:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-14 23:17 [PATCH 0/3] ksmbd: More crypto library conversions Eric Biggers
2025-10-14 23:17 ` [PATCH 1/3] ksmbd: Use SHA-512 library for SMB3.1.1 preauth hash Eric Biggers
2025-10-14 23:17 ` [PATCH 2/3] ksmbd: Use HMAC-SHA256 library for message signing and key generation Eric Biggers
2025-10-16  5:00   ` Namjae Jeon
2025-10-16 17:54     ` Eric Biggers [this message]
2025-10-14 23:17 ` [PATCH 3/3] ksmbd: Use HMAC-MD5 library for NTLMv2 Eric Biggers
2025-10-16  5:03 ` [PATCH 0/3] ksmbd: More crypto library conversions Namjae Jeon

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=20251016175433.GB1575@sol \
    --to=ebiggers@kernel.org \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=senozhatsky@chromium.org \
    --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