@@ -428,6 +428,10 @@ static int ccm_nx_encrypt(struct aead_request *req,
unsigned int processed = 0, to_process;
int rc = -1;
+ rc = crypto_aead_copy_ad(req);
+ if (rc)
+ return rc;
+
spin_lock_irqsave(&nx_ctx->lock, irq_flags);
rc = generate_pat(desc->info, req, nx_ctx, authsize, nbytes, assoclen,
@@ -432,9 +432,14 @@ static int gcm_aes_nx_encrypt(struct aead_request *req)
{
struct nx_gcm_rctx *rctx = aead_request_ctx(req);
char *iv = rctx->iv;
+ int err;
memcpy(iv, req->iv, 12);
+ err = crypto_aead_copy_ad(req);
+ if (err)
+ return err;
+
return gcm_aes_nx_crypt(req, 1, req->assoclen);
}
@@ -455,6 +460,7 @@ static int gcm4106_aes_nx_encrypt(struct aead_request *req)
struct nx_gcm_rctx *rctx = aead_request_ctx(req);
char *iv = rctx->iv;
char *nonce = nx_ctx->priv.gcm.nonce;
+ int err;
memcpy(iv, nonce, NX_GCM4106_NONCE_LEN);
memcpy(iv + NX_GCM4106_NONCE_LEN, req->iv, 8);
@@ -462,6 +468,10 @@ static int gcm4106_aes_nx_encrypt(struct aead_request *req)
if (req->assoclen < 8)
return -EINVAL;
+ err = crypto_aead_copy_ad(req);
+ if (err)
+ return err;
+
return gcm_aes_nx_crypt(req, 1, req->assoclen - 8);
}
Invoke the crypto_aead_copy_ad function during the encryption code path to copy the AAD from the source to the destination buffer. Signed-off-by: Stephan Mueller <smueller@chronox.de> --- drivers/crypto/nx/nx-aes-ccm.c | 4 ++++ drivers/crypto/nx/nx-aes-gcm.c | 10 ++++++++++ 2 files changed, 14 insertions(+)