This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 143547128b2f0a9ba2846077b9344f5641ff4639 Author: makejian <[email protected]> AuthorDate: Tue Apr 22 21:13:11 2025 +0800 crypto/cryptodev: add encrypt op and olen for support virtio mode Add olen field to crypt_op structure and crp_olen to cryptop structure to support output length tracking in virtio crypto mode. Signed-off-by: makejian <[email protected]> --- crypto/cryptodev.c | 2 ++ include/crypto/cryptodev.h | 3 +++ 2 files changed, 5 insertions(+) diff --git a/crypto/cryptodev.c b/crypto/cryptodev.c index 2bcd8a4b4c0..9235cf4bb60 100644 --- a/crypto/cryptodev.c +++ b/crypto/cryptodev.c @@ -277,6 +277,7 @@ static int cryptof_ioctl(FAR struct file *filep, { crie.cri_alg = sop->cipher; crie.cri_klen = sop->keylen * 8; + crie.cri_op = sop->op; crie.cri_key = kmm_malloc(crie.cri_klen / 8); if (crie.cri_key == NULL) @@ -461,6 +462,7 @@ static int cryptodev_op(FAR struct csession *cse, } crp->crp_ilen = cop->len; + crp->crp_olen = cop->olen; crp->crp_buf = cop->src; crp->crp_sid = cse->sid; crp->crp_opaque = cse; diff --git a/include/crypto/cryptodev.h b/include/crypto/cryptodev.h index 9fbf8e9af31..bd4c9a0d970 100644 --- a/include/crypto/cryptodev.h +++ b/include/crypto/cryptodev.h @@ -152,6 +152,7 @@ struct cryptoini int cri_klen; /* Key length, in bits */ int cri_rnd; /* Algorithm rounds, where relevant */ int cri_sid; + int cri_op; caddr_t cri_key; /* key to use */ union { @@ -363,6 +364,7 @@ struct cryptocap struct session_op { uint32_t cipher; /* ie. CRYPTO_AES_EBC */ + uint16_t op; /* i.e. COP_ENCRYPT */ uint32_t mac; uint32_t keylen; /* cipher key */ caddr_t key; @@ -396,6 +398,7 @@ struct crypt_op uint16_t flags; unsigned len; + unsigned olen; unsigned aadlen; caddr_t src, dst; /* become iov[] inside kernel */ caddr_t mac; /* must be big enough for chosen MAC */
