Re: [PATCH 1/7] crypto: tegra: Use separate buffer for setkey
From: Herbert Xu
Date: Sat Dec 28 2024 - 06:36:41 EST
On Tue, Dec 17, 2024 at 09:42:01PM +0530, Akhil R wrote:
> The buffer which sends the commands to host1x was shared for all tasks
> in the engine. This causes a problem with the setkey() function as it
> gets called asynchronous to the crypto engine queue. Modifying the same
> cmdbuf in setkey() will corrupt the ongoing host1x task and in turn
> break the encryption/decryption operation. Hence use a separate cmdbuf
> for setkey().
>
> Fixes: 0880bb3b00c8 ("crypto: tegra - Add Tegra Security Engine driver")
> Signed-off-by: Akhil R <akhilrajeev@xxxxxxxxxx>
> ---
> drivers/crypto/tegra/tegra-se-aes.c | 16 ++++++++--------
> drivers/crypto/tegra/tegra-se-hash.c | 13 +++++++------
> drivers/crypto/tegra/tegra-se-key.c | 10 ++++++++--
> drivers/crypto/tegra/tegra-se-main.c | 16 ++++++++++++----
> drivers/crypto/tegra/tegra-se.h | 3 ++-
> 5 files changed, 37 insertions(+), 21 deletions(-)
So there is a maximum of 15 key slots? In that case you should not
be allocating them in setkey because there can be a lot more than
15 tfm's in the system.
Since the limit is so low they should only be allocated during an
encryption/decryption operation.
Cheers,
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt