Skip to content

Commit 5211e2c

Browse files
committed
crypto: tegra - Fix CMAC intermediate result handling
jira LE-4159 Rebuild_History Non-Buildable kernel-5.14.0-570.41.1.el9_6 commit-author Akhil R <akhilrajeev@nvidia.com> commit ce390d6 Saving and restoring of the intermediate results are needed if there is context switch caused by another ongoing request on the same engine. This is therefore not only to support import/export functionality. Hence, save and restore the intermediate result for every non-first task. 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 ce390d6) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent 1f66a0f commit 5211e2c

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1547,23 +1547,16 @@ static int tegra_cmac_do_update(struct ahash_request *req)
15471547
rctx->residue.size = nresidue;
15481548

15491549
/*
1550-
* If this is not the first 'update' call, paste the previous copied
1550+
* If this is not the first task, paste the previous copied
15511551
* intermediate results to the registers so that it gets picked up.
1552-
* This is to support the import/export functionality.
15531552
*/
15541553
if (!(rctx->task & SHA_FIRST))
15551554
tegra_cmac_paste_result(ctx->se, rctx);
15561555

15571556
cmdlen = tegra_cmac_prep_cmd(ctx, rctx);
15581557
ret = tegra_se_host1x_submit(se, se->cmdbuf, cmdlen);
15591558

1560-
/*
1561-
* If this is not the final update, copy the intermediate results
1562-
* from the registers so that it can be used in the next 'update'
1563-
* call. This is to support the import/export functionality.
1564-
*/
1565-
if (!(rctx->task & SHA_FINAL))
1566-
tegra_cmac_copy_result(ctx->se, rctx);
1559+
tegra_cmac_copy_result(ctx->se, rctx);
15671560

15681561
dma_free_coherent(ctx->se->dev, rctx->datbuf.size,
15691562
rctx->datbuf.buf, rctx->datbuf.addr);
@@ -1600,6 +1593,13 @@ static int tegra_cmac_do_final(struct ahash_request *req)
16001593
rctx->total_len += rctx->residue.size;
16011594
rctx->config = tegra234_aes_cfg(SE_ALG_CMAC, 0);
16021595

1596+
/*
1597+
* If this is not the first task, paste the previous copied
1598+
* intermediate results to the registers so that it gets picked up.
1599+
*/
1600+
if (!(rctx->task & SHA_FIRST))
1601+
tegra_cmac_paste_result(ctx->se, rctx);
1602+
16031603
/* Prepare command and submit */
16041604
cmdlen = tegra_cmac_prep_cmd(ctx, rctx);
16051605
ret = tegra_se_host1x_submit(se, se->cmdbuf, cmdlen);

0 commit comments

Comments
 (0)