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,You've lost me. a_ctx->authsize is set to the value of
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);
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)Cheers,
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;