[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<SJ1PR12MB63394D2C8C5329DE4B9B937FC03E2@SJ1PR12MB6339.namprd12.prod.outlook.com>
Date: Tue, 2 Apr 2024 12:36:41 +0000
From: Akhil R <akhilrajeev@...dia.com>
To: Herbert Xu <herbert@...dor.apana.org.au>
CC: "davem@...emloft.net" <davem@...emloft.net>, "robh@...nel.org"
<robh@...nel.org>, "krzysztof.kozlowski+dt@...aro.org"
<krzysztof.kozlowski+dt@...aro.org>, "conor+dt@...nel.org"
<conor+dt@...nel.org>, "thierry.reding@...il.com" <thierry.reding@...il.com>,
Jon Hunter <jonathanh@...dia.com>, "catalin.marinas@....com"
<catalin.marinas@....com>, "will@...nel.org" <will@...nel.org>, Mikko
Perttunen <mperttunen@...dia.com>, "airlied@...il.com" <airlied@...il.com>,
"daniel@...ll.ch" <daniel@...ll.ch>, "linux-crypto@...r.kernel.org"
<linux-crypto@...r.kernel.org>, "devicetree@...r.kernel.org"
<devicetree@...r.kernel.org>, "linux-tegra@...r.kernel.org"
<linux-tegra@...r.kernel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, "dri-devel@...ts.freedesktop.org"
<dri-devel@...ts.freedesktop.org>
Subject: RE: [PATCH v6 3/5] crypto: tegra: Add Tegra Security Engine driver
> On Tue, Mar 19, 2024 at 01:53:04PM +0530, Akhil R wrote:
> >
> > +struct tegra_sha_reqctx {
> > + struct ahash_request fallback_req;
>
> This doesn't work because ahash_request is dynamically sized.
> So you'll end up clobbering the rest of the struct if a fallback ends up being used.
>
> You should place the fallback_req at the end of the reqctx and set the reqsize
> based on the fallback reqsize.
>
Should I set the reqsize as below in sha_cra_init()? Seeing this in other crypto drivers.
crypto_ahash_set_reqsize(ahash_tfm,
sizeof(struct tegra_sha_reqctx) +
crypto_ahash_reqsize(ctx->fallback_tfm));
Regards,
Akhil
Powered by blists - more mailing lists