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 v2 1/2] crypto: hisilicon/sec2 - fix for aead icv error
Date: Sat, 26 Oct 2024 14:30:53 +0800	[thread overview]
Message-ID: <ZxyMnWbTkf7JEnT7@gondor.apana.org.au> (raw)
In-Reply-To: <20241018105830.169212-2-huangchenghai2@huawei.com>

On Fri, Oct 18, 2024 at 06:58:29PM +0800, Chenghai Huang wrote:
>
> @@ -911,10 +910,8 @@ static int sec_cipher_pbuf_map(struct sec_ctx *ctx, struct sec_req *req,
>  		return -EINVAL;
>  	}
>  	if (!c_req->encrypt && ctx->alg_type == SEC_AEAD) {
> -		tfm = crypto_aead_reqtfm(aead_req);
> -		authsize = crypto_aead_authsize(tfm);
> -		mac_offset = qp_ctx->res[req_id].pbuf + copy_size - authsize;
> -		memcpy(a_req->out_mac, mac_offset, authsize);
> +		mac_offset = qp_ctx->res[req_id].pbuf + copy_size - a_ctx->authsize;
> +		memcpy(a_req->out_mac, mac_offset, a_ctx->authsize);

You've lost me.  a_ctx->authsize is set to the value of
crypto_aead_authsize(tfm).  In other words nothing has changed.
What am I missing?

> @@ -2356,10 +2331,12 @@ static int sec_aead_crypto(struct aead_request *a_req, bool encrypt)
>  	struct crypto_aead *tfm = crypto_aead_reqtfm(a_req);
>  	struct sec_req *req = aead_request_ctx(a_req);
>  	struct sec_ctx *ctx = crypto_aead_ctx(tfm);
> +	struct sec_auth_ctx *a_ctx = &ctx->a_ctx;
>  	int ret;
>  
>  	req->flag = a_req->base.flags;
>  	req->aead_req.aead_req = a_req;
> +	a_ctx->authsize = crypto_aead_authsize(tfm);
>  	req->c_req.encrypt = encrypt;
>  	req->ctx = ctx;

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-26  6:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-18 10:58 [PATCH v2 0/2] crypto: hisilicon - fix the authsize and icv problems of aead in sec Chenghai Huang
2024-10-18 10:58 ` [PATCH v2 1/2] crypto: hisilicon/sec2 - fix for aead icv error Chenghai Huang
2024-10-26  6:30   ` Herbert Xu [this message]
2024-10-26  7:50     ` linwenkai (C)
2024-10-26  8:58       ` Herbert Xu
2024-10-28  2:03         ` linwenkai (C)
2024-10-28 10:35           ` Herbert Xu
2024-10-18 10:58 ` [PATCH v2 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=ZxyMnWbTkf7JEnT7@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®