Skip to content

Commit 46ea029

Browse files
Akhil Rgregkh
authored andcommitted
crypto: tegra - Use HMAC fallback when keyslots are full
[ Upstream commit f80a2e2 ] 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 <[email protected]> Signed-off-by: Herbert Xu <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 057298d commit 46ea029

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
@@ -567,13 +567,18 @@ static int tegra_hmac_setkey(struct crypto_ahash *tfm, const u8 *key,
567567
unsigned int keylen)
568568
{
569569
struct tegra_sha_ctx *ctx = crypto_ahash_ctx(tfm);
570+
int ret;
570571

571572
if (aes_check_keylen(keylen))
572573
return tegra_hmac_fallback_setkey(ctx, key, keylen);
573574

575+
ret = tegra_key_submit(ctx->se, key, keylen, ctx->alg, &ctx->key_id);
576+
if (ret)
577+
return tegra_hmac_fallback_setkey(ctx, key, keylen);
578+
574579
ctx->fallback = false;
575580

576-
return tegra_key_submit(ctx->se, key, keylen, ctx->alg, &ctx->key_id);
581+
return 0;
577582
}
578583

579584
static int tegra_sha_update(struct ahash_request *req)

0 commit comments

Comments
 (0)