mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-18 03:23:53 -04:00
crypto: hisilicon/sec - fix auth key size error
The authentication algorithm supports a maximum of 128-byte keys.
The allocated key memory is insufficient.
Fixes: 2f072d75d1 ("crypto: hisilicon - Add aead support on SEC2")
Signed-off-by: Kai Ye <yekai13@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
@@ -620,7 +620,7 @@ static int sec_auth_init(struct sec_ctx *ctx)
|
||||
{
|
||||
struct sec_auth_ctx *a_ctx = &ctx->a_ctx;
|
||||
|
||||
a_ctx->a_key = dma_alloc_coherent(ctx->dev, SEC_MAX_KEY_SIZE,
|
||||
a_ctx->a_key = dma_alloc_coherent(ctx->dev, SEC_MAX_AKEY_SIZE,
|
||||
&a_ctx->a_key_dma, GFP_KERNEL);
|
||||
if (!a_ctx->a_key)
|
||||
return -ENOMEM;
|
||||
@@ -632,8 +632,8 @@ static void sec_auth_uninit(struct sec_ctx *ctx)
|
||||
{
|
||||
struct sec_auth_ctx *a_ctx = &ctx->a_ctx;
|
||||
|
||||
memzero_explicit(a_ctx->a_key, SEC_MAX_KEY_SIZE);
|
||||
dma_free_coherent(ctx->dev, SEC_MAX_KEY_SIZE,
|
||||
memzero_explicit(a_ctx->a_key, SEC_MAX_AKEY_SIZE);
|
||||
dma_free_coherent(ctx->dev, SEC_MAX_AKEY_SIZE,
|
||||
a_ctx->a_key, a_ctx->a_key_dma);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user