crypto: tegra - Fix HASH intermediate result handling
authorAkhil R <akhilrajeev@nvidia.com>
Mon, 24 Feb 2025 09:16:06 +0000 (14:46 +0530)
committerHerbert Xu <herbert@gondor.apana.org.au>
Sat, 8 Mar 2025 08:22:24 +0000 (16:22 +0800)
commitff4b7df0b511b6121f3386607f02c16fb5d41192
tree73556f7beb8e8c230fa9817a2ec3fcd619950fae
parent97ee15ea101629d2ffe21d3c5dc03b8d8be43603
crypto: tegra - Fix HASH intermediate result handling

The intermediate hash values generated during an update task were
handled incorrectly in the driver. The values have a defined format for
each algorithm. Copying and pasting from the HASH_RESULT register
balantly would not work for all the supported algorithms. This incorrect
handling causes failures when there is a context switch between multiple
operations.

To handle the expected format correctly, add a separate buffer for
storing the intermediate results for each request. Remove the previous
copy/paste functions which read/wrote to the registers directly. Instead
configure the hardware to get the intermediate result copied to the
buffer and use host1x path to restore the intermediate hash results.

Fixes: 0880bb3b00c8 ("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>
drivers/crypto/tegra/tegra-se-hash.c
drivers/crypto/tegra/tegra-se.h