ThePassionate opened a new pull request, #22062:
URL: https://github.com/apache/nuttx/pull/22062

   ## Summary
   
   An asynchronous request path for symmetric crypto operations through 
/dev/crypto:
   
   * **crypto/cryptodev: add asynchronous path for symmetric operations** - a 
request with `COP_FLAG_CBIMM` returns immediately after being queued; the 
result is fetched later with the new `CIOCCRYPTRET` ioctl by request id. The 
submission allocates a shadow request (cryptop + descriptors + output buffers 
in one block) and sets the completion callback on it, so any backend that 
honors the `crp_callback` contract completes it - the software backend 
included. The synchronous path is untouched: requests without the flag still 
run on the stack as before.
   * **crypto/cryptodev: protect the async descriptor and add cancellation** - 
the file descriptor holds a reference plus one per in-flight request, so 
closing the descriptor while requests are queued defers the cleanup until they 
complete; a spinlock protects the shared state. A queued request can be 
cancelled with `COP_FLAG_CANCEL` (the result is discarded, a later fetch 
returns `EAGAIN`; an unknown id returns `ENOENT`).
   
   ## Impact
   
   * New ioctl (`CIOCCRYPTRET`), new `COP_FLAG_CBIMM` / `COP_FLAG_CANCEL` flags 
and a `reqid` field in `struct crypt_op`. The synchronous path and all existing 
flags are unchanged.
   * The asymmetric (CIOCKEY) path is not converted; its existing borrow-based 
async design is left for a separate change.
   
   ## Testing
   
   Board sim:sim/crypto, with the companion test PR in nuttx-apps:
   
   ```
   nsh> async
   async aes-cbc success            (single block, RFC 3602)
   async aes-cbc multiblock success (64 B / 4 blocks)
   async sha256 success             (FIPS 180-2 "abc")
   async sha256 multi-update success (256 B in 4x64 B updates)
   async aes-cmac success           (SP 800-38B ex 2, sync update + async final)
   async aes-gcm success            (SP 800-38D case 4, tag via async final)
   async aes-gmac success
   async cancel success             (cancel queued id -> EAGAIN; unknown id -> 
ENOENT)
   async concurrent success         (3 pthread workers, private fds, 10 rounds 
each)
   async test ok
   ```
   
   All expected values cross-checked against an independent host implementation 
(python cryptography). Synchronous regression: aescbc, hmac (35 vectors), 
aescmac (8), aesgcm, ecdsa, rsa, des3cbc, aesctr (incl. stream), aesxts, 
chacha20, chachapoly all pass unchanged.
   
   `tools/checkpatch.sh -c -u -m -g <base>..HEAD` passes.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to