Skip to content

Commit c7bbc2b

Browse files
committed
crypto: tegra - Set IV to NULL explicitly for AES ECB
jira LE-4159 Rebuild_History Non-Buildable kernel-5.14.0-570.41.1.el9_6 commit-author Akhil R <akhilrajeev@nvidia.com> commit bde5582 It may happen that the variable req->iv may have stale values or zero sized buffer by default and may end up getting used during encryption/decryption. This inturn may corrupt the results or break the operation. Set the req->iv variable to NULL explicitly for algorithms like AES-ECB where IV is not used. Fixes: 0880bb3 ("crypto: tegra - Add Tegra Security Engine driver") Signed-off-by: Akhil R <akhilrajeev@nvidia.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit bde5582) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent 5211e2c commit c7bbc2b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/crypto/tegra/tegra-se-aes.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,9 @@ static int tegra_aes_crypt(struct skcipher_request *req, bool encrypt)
446446
if (!req->cryptlen)
447447
return 0;
448448

449+
if (ctx->alg == SE_ALG_ECB)
450+
req->iv = NULL;
451+
449452
rctx->encrypt = encrypt;
450453
rctx->config = tegra234_aes_cfg(ctx->alg, encrypt);
451454
rctx->crypto_config = tegra234_aes_crypto_cfg(ctx->alg, encrypt);

0 commit comments

Comments
 (0)