Re: [PATCH v2] crypto: tegra - fix rctx->cryptlen calculation in tegra_gcm_do_one_req()
From: Herbert Xu
Date: Thu Jul 30 2026 - 04:04:44 EST
On Tue, Jul 21, 2026 at 12:33:31AM +0200, Vladislav Dronov wrote:
> Perform rctx->cryptlen calculation in tegra_gcm_do_one_req() the same way
> it is done in tegra_ccm_crypt_init(). The current formulae may lead to a
> crash if a caller does not call tegra_gcm_setauthsize() and so ctx->authsize
> remains zero. Then a decrypt operation with incorrect rctx->cryptlen will
> lead to a write beyound rctx->dst_sg buffer.
>
> As a follow-up cleanup delete struct tegra_aead_ctx->authsize field since
> it appears to be completely unused. Also simplify tegra_ccm_setauthsize()
> and tegra_gcm_setauthsize() functions respectively.
>
> Fixes: 0880bb3b00c8 ("crypto: tegra - Add Tegra Security Engine driver")
> Signed-off-by: Vladislav Dronov <vdronov@xxxxxxxxxx>
> ---
> drivers/crypto/tegra/tegra-se-aes.c | 22 +++-------------------
> 1 file changed, 3 insertions(+), 19 deletions(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt