Skip to content

Commit 7702ef4

Browse files
author
Herbert Xu
committed
crypto: tegra - Use HMAC fallback when keyslots are full
JIRA: https://issues.redhat.com/browse/RHEL-89531 Upstream Status: linux.git commit f80a2e2 Author: Akhil R <akhilrajeev@nvidia.com> Date: Mon Feb 24 14:46:10 2025 +0530 crypto: tegra - Use HMAC fallback when keyslots are full The intermediate results for HMAC is stored in the allocated keyslot by the hardware. Dynamic allocation of keyslot during an operation is hence not possible. As the number of keyslots are limited in the hardware, fallback to the HMAC software implementation if keyslots are not available 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> Signed-off-by: Herbert Xu <herbert.xu@redhat.com>
1 parent cc1266a commit 7702ef4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,13 +632,18 @@ static int tegra_hmac_setkey(struct crypto_ahash *tfm, const u8 *key,
632632
unsigned int keylen)
633633
{
634634
struct tegra_sha_ctx *ctx = crypto_ahash_ctx(tfm);
635+
int ret;
635636

636637
if (aes_check_keylen(keylen))
637638
return tegra_hmac_fallback_setkey(ctx, key, keylen);
638639

640+
ret = tegra_key_submit(ctx->se, key, keylen, ctx->alg, &ctx->key_id);
641+
if (ret)
642+
return tegra_hmac_fallback_setkey(ctx, key, keylen);
643+
639644
ctx->fallback = false;
640645

641-
return tegra_key_submit(ctx->se, key, keylen, ctx->alg, &ctx->key_id);
646+
return 0;
642647
}
643648

644649
static int tegra_sha_init(struct ahash_request *req)

0 commit comments

Comments
 (0)