[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2905f518-95a9-88d4-031c-291ef0373391@starfivetech.com>
Date: Thu, 16 Nov 2023 13:39:57 +0800
From: Jia Jie Ho <jiajie.ho@...rfivetech.com>
To: Herbert Xu <herbert@...dor.apana.org.au>
CC: "David S . Miller" <davem@...emloft.net>,
<linux-crypto@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] crypto: starfive - Pad adata with zeroes
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
Powered by blists - more mailing lists