Skip to content

Commit 1ddaff4

Browse files
Akhil Rherbertx
authored andcommitted
crypto: tegra - Fix IV usage for AES ECB
Modifying the crypto_request turns out to be not the right way to handle the stale value issue with the IV. Though the IV is not used for AES ECB, it eventually get used in algorithms like LRW in the next step after AES ECB encryption/decryption. Setting req->iv to NULL breaks the implementation of such algorithms. Hence modify only the local reqctx to check for IV. Fixes: bde5582 ("crypto: tegra - Set IV to NULL explicitly for AES ECB") Signed-off-by: Akhil R <akhilrajeev@nvidia.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 0af2f6b commit 1ddaff4

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ static int tegra_aes_do_one_req(struct crypto_engine *engine, void *areq)
269269
unsigned int cmdlen, key1_id, key2_id;
270270
int ret;
271271

272-
rctx->iv = (u32 *)req->iv;
272+
rctx->iv = (ctx->alg == SE_ALG_ECB) ? NULL : (u32 *)req->iv;
273273
rctx->len = req->cryptlen;
274274
key1_id = ctx->key1_id;
275275
key2_id = ctx->key2_id;
@@ -498,9 +498,6 @@ static int tegra_aes_crypt(struct skcipher_request *req, bool encrypt)
498498
if (!req->cryptlen)
499499
return 0;
500500

501-
if (ctx->alg == SE_ALG_ECB)
502-
req->iv = NULL;
503-
504501
rctx->encrypt = encrypt;
505502

506503
return crypto_transfer_skcipher_request_to_engine(ctx->se->engine, req);

0 commit comments

Comments
 (0)