Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Namjae Jeon <linkinjeon@kernel.org>
Cc: Eric Biggers <ebiggers@kernel.org>,
	Steve French <sfrench@samba.org>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	Steve French <smfrench@gmail.com>,
	Paulo Alcantara <pc@manguebit.org>,
	Ronnie Sahlberg <ronniesahlberg@gmail.com>,
	Shyam Prasad N <sprasad@microsoft.com>,
	Tom Talpey <tom@talpey.com>, Bharath SM <bharathsm@microsoft.com>,
	Sergey Senozhatsky <senozhatsky@chromium.org>,
	linux-cifs@vger.kernel.org, samba-technical@lists.samba.org
Subject: Re: [PATCH v2 2/6] smb: clear the aes_cmac_key and aes_cmac_ctx when done
Date: Tue, 11 Aug 2026 14:57:28 +0200	[thread overview]
Message-ID: <e23dc8fd-67c5-4950-a598-13ff50a40d1c@redhat.com> (raw)
In-Reply-To: <CAKYAXd_VJH8dFHofy2Jfk2172vDuU+XizXQf06w0oz81F1WDdQ@mail.gmail.com>

On 11/08/2026 12.31, Namjae Jeon wrote:
>> diff --git a/fs/smb/client/smb2transport.c b/fs/smb/client/smb2transport.c
>> index 1143ee52470a7..d23566da2ac81 100644
>> --- a/fs/smb/client/smb2transport.c
>> +++ b/fs/smb/client/smb2transport.c
>> @@ -464,8 +464,8 @@ smb3_calc_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server)
>>          unsigned char smb3_signature[SMB2_CMACAES_SIZE];
>>          struct kvec *iov = rqst->rq_iov;
>>          struct smb2_hdr *shdr = (struct smb2_hdr *)iov[0].iov_base;
>> -       struct aes_cmac_key cmac_key;
>> -       struct aes_cmac_ctx cmac_ctx;
>> +       struct aes_cmac_key cmac_key __cleanup(aes_cmac_zeroize_key);
>> +       struct aes_cmac_ctx cmac_ctx __cleanup(aes_cmac_zeroize_ctx);
>>          struct smb_rqst drqst;
>>          u8 key[SMB3_SIGN_KEY_SIZE];
> Shouldn’t we also clear the raw key with memzero_explicit(key,
> sizeof(key)) immediately after aes_cmac_preparekey() ?
> 
>          rc = aes_cmac_preparekey(&cmac_key, key, SMB2_CMACAES_SIZE);
> +        memzero_explicit(key, sizeof(key));
>          if (rc) {
>                  cifs_server_dbg(VFS, "%s: Could not set key for cmac
> aes\n", __func__);
>                  return rc;
>          }
Yes, but I was planning to do all the scrubbing for such other spots in a 
separate patch series (similar to what I've posted for the smb/server code 
already) ... this patch series here focuses on aes_cmac_zeroize_key and 
aes_cmac_zeroize_ctx only. I hope that's ok?

  Thomas


  reply	other threads:[~2026-08-11 12:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-07 12:58 [PATCH v2 0/6] crypto: Add __cleanup functions for zeroizing aes_cmac_key & aes_cmac_ctx Thomas Huth
2026-08-07 12:58 ` [PATCH v2 1/6] crypto: Provide wrapper functions for zeroizing aes_cmac_key and aes_cmac_ctx Thomas Huth
2026-08-07 12:58 ` [PATCH v2 2/6] smb: clear the aes_cmac_key and aes_cmac_ctx when done Thomas Huth
2026-08-11 10:31   ` Namjae Jeon
2026-08-11 12:57     ` Thomas Huth [this message]
2026-08-12 12:44       ` Namjae Jeon
2026-08-07 12:58 ` [PATCH v2 3/6] net/tcp-ao: clear the aes_cmac_key " Thomas Huth
2026-08-07 22:22   ` Jakub Kicinski
2026-08-08 10:38     ` Thomas Huth
2026-08-07 12:58 ` [PATCH v2 4/6] Bluetooth: SMP: " Thomas Huth
2026-08-07 12:58 ` [PATCH v2 5/6] lib/crypto: aes: Use __cleanup() for aes_cmac_key instead of memzero_explicit() Thomas Huth
2026-08-07 12:58 ` [PATCH v2 6/6] mac80211: fils_aead: " Thomas Huth
2026-08-07 13:00   ` Johannes Berg
2026-08-13  1:59 ` [PATCH v2 0/6] crypto: Add __cleanup functions for zeroizing aes_cmac_key & aes_cmac_ctx Eric Biggers

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=e23dc8fd-67c5-4950-a598-13ff50a40d1c@redhat.com \
    --to=thuth@redhat.com \
    --cc=bharathsm@microsoft.com \
    --cc=davem@davemloft.net \
    --cc=ebiggers@kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pc@manguebit.org \
    --cc=ronniesahlberg@gmail.com \
    --cc=samba-technical@lists.samba.org \
    --cc=senozhatsky@chromium.org \
    --cc=sfrench@samba.org \
    --cc=smfrench@gmail.com \
    --cc=sprasad@microsoft.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