Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Jia Jie Ho <jiajie.ho@starfivetech.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S . Miller" <davem@davemloft.net>,
	<linux-crypto@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] crypto: starfive - Pad adata with zeroes
Date: Thu, 16 Nov 2023 13:39:57 +0800	[thread overview]
Message-ID: <2905f518-95a9-88d4-031c-291ef0373391@starfivetech.com> (raw)
In-Reply-To: <ZVWcLJOoLdElVsDd@gondor.apana.org.au>

On 16/11/2023 12:35 pm, Herbert Xu wrote:
> On Thu, Nov 16, 2023 at 10:17:52AM +0800, Jia Jie Ho wrote:
>>
>> diff --git a/drivers/crypto/starfive/jh7110-aes.c b/drivers/crypto/starfive/jh7110-aes.c
>> index 9378e6682f0e..e0fe599f8192 100644
>> --- a/drivers/crypto/starfive/jh7110-aes.c
>> +++ b/drivers/crypto/starfive/jh7110-aes.c
>> @@ -500,7 +500,7 @@ static int starfive_aes_prepare_req(struct skcipher_request *req,
>>  	scatterwalk_start(&cryp->out_walk, rctx->out_sg);
>>  
>>  	if (cryp->assoclen) {
>> -		rctx->adata = kzalloc(ALIGN(cryp->assoclen, AES_BLOCK_SIZE), GFP_KERNEL);
>> +		rctx->adata = kzalloc(cryp->assoclen + AES_BLOCK_SIZE, GFP_KERNEL);
> 
> Please explain why you're changing the allocation size here.
> 

Hi Herbert,

The hardware requires aad padded with zeroes up to 15 bytes in some cases.
This extra size and zeroing is meant for the padding and prevents driver 
accessing uninitialized memory region.

> This needs to go into the patch description.
> 

I'll update the v2 commit message if you're good with this implementation.
Thanks for reviewing this.

Jia Jie


  reply	other threads:[~2023-11-16  5:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-16  2:17 [PATCH] crypto: starfive - Pad adata with zeroes Jia Jie Ho
2023-11-16  4:35 ` Herbert Xu
2023-11-16  5:39   ` Jia Jie Ho [this message]
2023-11-17  3:57     ` Herbert Xu

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=2905f518-95a9-88d4-031c-291ef0373391@starfivetech.com \
    --to=jiajie.ho@starfivetech.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@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