mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Chenghai Huang <huangchenghai2@huawei.com>
Cc: davem@davemloft.net, linux-kernel@vger.kernel.org,
	linux-crypto@vger.kernel.org, liulongfang@huawei.com,
	shenyang39@huawei.com, qianweili@huawei.com,
	linwenkai6@hisilicon.com, wangzhou1@hisilicon.com
Subject: Re: [PATCH 1/2] crypto: hisilicon/sec2 - fix for aead icv error
Date: Sat, 5 Oct 2024 13:01:48 +0800	[thread overview]
Message-ID: <ZwDIPF58yX8r7bQO@gondor.apana.org.au> (raw)
In-Reply-To: <20240929112630.863282-2-huangchenghai2@huawei.com>

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@hisilicon.com>
> Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
> ---
>  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@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

  reply	other threads:[~2024-10-05  5:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-29 11:26 [PATCH 0/2] crypto: hisilicon - fix the authsize and icv problems of aead in sec Chenghai Huang
2024-09-29 11:26 ` [PATCH 1/2] crypto: hisilicon/sec2 - fix for aead icv error Chenghai Huang
2024-10-05  5:01   ` Herbert Xu [this message]
2024-09-29 11:26 ` [PATCH 2/2] crypto: hisilicon/sec2 - fix for aead invalid authsize Chenghai Huang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZwDIPF58yX8r7bQO@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=davem@davemloft.net \
    --cc=huangchenghai2@huawei.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linwenkai6@hisilicon.com \
    --cc=liulongfang@huawei.com \
    --cc=qianweili@huawei.com \
    --cc=shenyang39@huawei.com \
    --cc=wangzhou1@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®