Linux Tegra architecture development
 help / color / mirror / Atom feed
* [PATCH] crypto: tegra - fix rctx->cryptlen in tegra_gcm_do_one_req()
@ 2026-07-19 17:13 Vladislav Dronov
  2026-07-19 17:46 ` Vladislav Dronov
  2026-07-20  1:20 ` Herbert Xu
  0 siblings, 2 replies; 5+ messages in thread
From: Vladislav Dronov @ 2026-07-19 17:13 UTC (permalink / raw)
  To: Akhil R, Herbert Xu, David S. Miller, Thierry Reding,
	Jonathan Hunter
  Cc: linux-crypto, linux-tegra, linux-kernel, vdronov

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.

Signed-off-by: Vladislav Dronov <vdronov@redhat.com>
---
 drivers/crypto/tegra/tegra-se-aes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/tegra/tegra-se-aes.c b/drivers/crypto/tegra/tegra-se-aes.c
index 9094c03e991f..920864751ac7 100644
--- a/drivers/crypto/tegra/tegra-se-aes.c
+++ b/drivers/crypto/tegra/tegra-se-aes.c
@@ -1290,7 +1290,7 @@ static int tegra_gcm_do_one_req(struct crypto_engine *engine, void *areq)
 	if (rctx->encrypt)
 		rctx->cryptlen = req->cryptlen;
 	else
-		rctx->cryptlen = req->cryptlen - ctx->authsize;
+		rctx->cryptlen = req->cryptlen - rctx->authsize;
 
 	memcpy(rctx->iv, req->iv, GCM_AES_IV_SIZE);
 	rctx->iv[3] = (1 << 24);
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-07-30  7:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-19 17:13 [PATCH] crypto: tegra - fix rctx->cryptlen in tegra_gcm_do_one_req() Vladislav Dronov
2026-07-19 17:46 ` Vladislav Dronov
2026-07-20  1:20 ` Herbert Xu
2026-07-20 22:33   ` [PATCH v2] crypto: tegra - fix rctx->cryptlen calculation " Vladislav Dronov
2026-07-30  7:40     ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox