From: Harald Freudenberger <freude@linux.ibm.com>
To: Torsten Duwe <duwe@lst.de>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Christian Borntraeger <borntraeger@de.ibm.com>,
linux-crypto@vger.kernel.org, linux-s390@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: s390 crypto: explicitly memzero stack key material in aes_s390.c
Date: Tue, 25 Feb 2020 15:39:46 +0100 [thread overview]
Message-ID: <5b185871-d94e-2f79-ff42-07b2a10c490c@linux.ibm.com> (raw)
In-Reply-To: <20200221165511.GB6928@lst.de>
On 21.02.20 17:55, Torsten Duwe wrote:
> From: Torsten Duwe <duwe@suse.de>
>
> s390 crypto: explicitly memzero stack key material in aes_s390.c
>
> aes_s390.c has several functions which allocate space for key material on
> the stack and leave the used keys there. It is considered good practice
> to clean these locations before the function returns.
>
> Signed-off-by: Torsten Duwe <duwe@suse.de>
> ---
> This popped up during our FIPS certification.
> It's obviously a good idea not to leave key material on the stack.
>
> --- a/arch/s390/crypto/aes_s390.c
> +++ b/arch/s390/crypto/aes_s390.c
> @@ -392,6 +392,7 @@ static int cbc_aes_crypt(struct blkciphe
> ret = blkcipher_walk_done(desc, walk, nbytes - n);
> }
> memcpy(walk->iv, param.iv, AES_BLOCK_SIZE);
> + memzero_explicit(¶m, sizeof(param));
> return ret;
> }
>
> @@ -576,6 +577,8 @@ static int xts_aes_crypt(struct blkciphe
> walk->dst.virt.addr, walk->src.virt.addr, n);
> ret = blkcipher_walk_done(desc, walk, nbytes - n);
> }
> + memzero_explicit(&pcc_param, sizeof(pcc_param));
> + memzero_explicit(&xts_param, sizeof(xts_param));
> return ret;
> }
>
>
Thanks Torsten, I've picked this patch. It will go upstream via the s390 subsystem with the next kernel merge window.
regards Harald Freudenberger
prev parent reply other threads:[~2020-02-25 14:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-21 16:55 s390 crypto: explicitly memzero stack key material in aes_s390.c Torsten Duwe
2020-02-25 14:39 ` Harald Freudenberger [this message]
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=5b185871-d94e-2f79-ff42-07b2a10c490c@linux.ibm.com \
--to=freude@linux.ibm.com \
--cc=borntraeger@de.ibm.com \
--cc=davem@davemloft.net \
--cc=duwe@lst.de \
--cc=gor@linux.ibm.com \
--cc=heiko.carstens@de.ibm.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
/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