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 66f932983971e1c9d93c71b876a29695f6ff4099
Author: makejian <[email protected]>
AuthorDate: Wed May 21 14:25:51 2025 +0800

    crypto/cryptodev: export ivlen to support different cipher algs
    
    Add ivlen field to crypt_op and crp_ivlen to cryptop structure to support
    cipher algorithms with different IV lengths.
    
    Signed-off-by: makejian <[email protected]>
---
 crypto/cryptodev.c         | 1 +
 include/crypto/cryptodev.h | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/crypto/cryptodev.c b/crypto/cryptodev.c
index 9235cf4bb60..9ec57d9bbef 100644
--- a/crypto/cryptodev.c
+++ b/crypto/cryptodev.c
@@ -476,6 +476,7 @@ static int cryptodev_op(FAR struct csession *cse,
         }
 
       crp->crp_iv = cop->iv;
+      crp->crp_ivlen = cop->ivlen;
     }
 
   if (cop->dst)
diff --git a/include/crypto/cryptodev.h b/include/crypto/cryptodev.h
index bd4c9a0d970..762d567ff28 100644
--- a/include/crypto/cryptodev.h
+++ b/include/crypto/cryptodev.h
@@ -201,6 +201,7 @@ struct cryptop
   uint64_t crp_sid;  /* Session ID */
   int crp_ilen;      /* Input data total length */
   int crp_olen;      /* Result total length */
+  int crp_ivlen;     /* IV length */
   int crp_alloctype; /* Type of buf to allocate if needed */
   int crp_etype;     /* Error type (zero means no error).
                       * All error codes except EAGAIN
@@ -399,6 +400,7 @@ struct crypt_op
   uint16_t flags;
   unsigned len;
   unsigned olen;
+  unsigned ivlen;
   unsigned aadlen;
   caddr_t src, dst;   /* become iov[] inside kernel */
   caddr_t mac;        /* must be big enough for chosen MAC */

Reply via email to