Re: [PATCH 1/2] crypto: hisilicon/sec2 - fix for aead icv error
From: Herbert Xu
Date: Sat Oct 05 2024 - 01:02:08 EST
On Sun, Sep 29, 2024 at 07:26:29PM +0800, Chenghai Huang wrote:
> When the AEAD algorithm is used for encryption or decryption,
> the input authentication length varies, the hardware needs to
> obtain the input length to pass the integrity check verification.
> Currently, the driver uses a fixed authentication length,which
> causes decryption failure, so the length configuration is modified.
> In addition, the step of setting the auth length is unnecessary,
> so it was deleted from the setkey function.
>
> Fixes: 2f072d75d1ab ("crypto: hisilicon - Add aead support on SEC2")
> Signed-off-by: Wenkai Lin <linwenkai6@xxxxxxxxxxxxx>
> Signed-off-by: Chenghai Huang <huangchenghai2@xxxxxxxxxx>
> ---
> drivers/crypto/hisilicon/sec2/sec.h | 2 +-
> drivers/crypto/hisilicon/sec2/sec_crypto.c | 114 ++++++++-------------
> drivers/crypto/hisilicon/sec2/sec_crypto.h | 11 --
> 3 files changed, 42 insertions(+), 85 deletions(-)
>
> diff --git a/drivers/crypto/hisilicon/sec2/sec.h b/drivers/crypto/hisilicon/sec2/sec.h
> index 410c83712e28..bd75e5b4c777 100644
> --- a/drivers/crypto/hisilicon/sec2/sec.h
> +++ b/drivers/crypto/hisilicon/sec2/sec.h
> @@ -36,6 +36,7 @@ struct sec_aead_req {
> dma_addr_t out_mac_dma;
> u8 *a_ivin;
> dma_addr_t a_ivin_dma;
> + size_t authsize;
> struct aead_request *aead_req;
> };
>
> @@ -90,7 +91,6 @@ struct sec_auth_ctx {
> dma_addr_t a_key_dma;
> u8 *a_key;
> u8 a_key_len;
> - u8 mac_len;
> u8 a_alg;
> bool fallback;
> struct crypto_shash *hash_tfm;
This makes no sense. The authsize is an attribute of the tfm,
not the request. Why are you moving it from the tfm context into
the request?
Cheers,
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt