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

   ## Summary
   
   Adds the rpmsg crypto transport from the Xiaomi Vela production stack: a 
cryptodev backend that forwards `/dev/crypto` sessions and in-kernel requests 
over an rpmsg endpoint to a server on the other core, which replays them 
against its locally registered crypto backends - the AMP counterpart of the 
virtio/vhost-crypto pair.
   
   * **protocol definitions** (`drivers/crypto/rpmsg_crypto.h`, 
`include/nuttx/crypto/rpmsg_crypto.h`): the request/response layout, shared 
with the virtio crypto protocol where the two coincide, plus the algorithm id 
mappings and the DER key helpers the asymmetric operations need.
   * **client** (`CONFIG_CRYPTO_RPMSG`): registers with the crypto core through 
crypto_kregister(); symmetric sessions, streaming (CRD_F_UPDATE / 
CRD_F_UPDATE_AAD), asynchronous completion (CRYPTO_F_CBIMM) and the asymmetric 
key operations (RSA, ECDSA, ECDH) run over one endpoint.
   * **server** (`CONFIG_CRYPTO_RPMSG_SERVER`): the other side of the endpoint; 
session requests become local cryptodev sessions, data requests are replayed 
through crypto_invoke()/crypto_kinvoke(); payload buffers come from a 
pre-allocated pool (`CONFIG_CRYPTO_RPMSG_DATA_POOL_COUNT`).
   
   Adapted from the Vela original: mempool_zallocate -> mempool_allocate + 
memset (upstream has no zeroing allocator), the DFX diagnostics are dropped, 
and two %lu-with-uint32_t format bugs are fixed with PRIu32. The endpoint 
priority (rpmsg_set_priority/RPMSG_PRIO_RT) stays as is - it is provided by the 
openamp endpoint-priority patch carried in tree (openamp/0018). The wire layout 
is unchanged from Vela, so a Vela image and this one interoperate.
   
   Note: the protocol header increments of the first commit (the shared 
algorithm mappings, the AKCIPHER opcodes and the DER helpers in 
`include/crypto/virtio_crypto.h`) are the same set #22170 carries for the 
virtio transport; whichever of the two merges second rebases onto the other - 
the deltas are mechanical.
   
   ## Impact
   
   No defconfig enables the new options. New Kconfig: `CRYPTO_RPMSG` (with 
`CRYPTO_RPMSG_SESSIONS_NUM`, `CRYPTO_RPMSG_CONNECT_TIMEOUT_MS`, 
`CRYPTO_RPMSG_RSA_KEYBUF_SIZE`) and `CRYPTO_RPMSG_SERVER` (with 
`CRYPTO_RPMSG_DATA_POOL_COUNT`). Consumes the merged kernel crypto capability 
interfaces (CRYPTO_OP_*/CRYPTO_KEY_TYPE_*, CRK_*, CRD_F_UPDATE_AAD, crp_iter, 
crypto_kregister()/crypto_kinvoke()).
   
   ## Testing
   
   Built with sim:crypto plus `CONFIG_RPMSG_PORT_UART=y`, 
`CONFIG_CRYPTO_RPMSG=y` and `CONFIG_CRYPTO_RPMSG_SERVER=y` (build-time .config 
changes only): both translation units compile into the image with 0 warnings, 0 
errors, and each commit of the series builds standalone. The standard crypto 
tests (aescbc, des3cbc, aesctr, aesxts, chacha20, chachapoly, hmac) pass with 
the drivers compiled in; they are inert without an rpmsg transport. Cross-core 
operation needs a real two-core setup and was not exercised on sim. 
`tools/checkpatch.sh -c -u -m -g` clean; `tools/refresh.sh --silent sim:crypto` 
shows no defconfig drift.
   


-- 
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