Re: [PATCH v2 1/2] crypto: hisilicon/sec2 - fix for aead icv error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




在 2024/10/26 14:30, Herbert Xu 写道:
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,

Hi, do you want me to remove this variable and use the old way to get the authsize?

The variable is added to make code simple and to reduce some function calls.

Thanks.





[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux