Skip to content

Commit bde5582

Browse files
Akhil Rherbertx
authored andcommitted
crypto: tegra - Set IV to NULL explicitly for AES ECB
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 <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent ce390d6 commit bde5582

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)