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

   ## Summary
   
   Let crypto operations reference keys stored in the software key store by id 
instead of passing the key material with every request:
   
   * **crypto: support cipher and mac use keyid** - a session created with 
`CRD_F_KEYID` interprets the key field as a key id; the cipher, HMAC and 
plain-hash session setup paths read the key from the swkey store (up to 128 
bytes) before the existing key handling, which is unchanged for key-material 
sessions. Chained descriptors reset the key pointer per descriptor.
   * **crypto: support ecdsa and rsa use keyid** - the ECDSA sign/verify and 
RSA MOD_EXP / PKCS15-VERIFY handlers load their components from the key store 
when the request carries `CRD_F_KEYID`, on top of the existing component-index 
loading. Keys larger than the store buffer (> 64 bytes, e.g. RSA moduli) are 
written through on import; `swkey_save()` returns success for them.
   * **crypto/cryptodev: add CRYPTO_F_WRITE_PROTECTED key flag** - marks an 
imported key as write-protected (future save operations are rejected).
   
   ## Impact
   
   * New `CRD_F_KEYID` / `CRYPTO_F_WRITE_PROTECTED` flags in the existing flag 
fields; no struct or command changes. Sessions without the flag behave exactly 
as before.
   
   ## Testing
   
   Board sim:sim/crypto with `CONFIG_CRYPTO_CRYPTODEV_SOFTWARE_KEYMGMT=y` and 
an NVS-backed `/dev/nvs` (RAMMTD), with the companion test PR in nuttx-apps:
   
   ```
   nsh> keyid
   keyid lifecycle success       (allocate -> import -> delete round trip)
   aescbc keyid success          (RFC 3602 vector via key id)
   hmac keyid success            (HMAC-SHA256 via key id)
   aescmac keyid success         (NIST vector, cipher+mac both by key id)
   ecdsa keyid success           (GENERATE_SECP256R1_KEY then sign/verify by id)
   rsa keyid success             (RSA-1024 n/e/d as three key ids: 
encrypt/decrypt
                                 round trip + PKCS#1 v1.5 sign/verify)
   ```
   
   Regression: aescbc (6 vectors), hmac (35), aescmac (8), aesctr, aesxts, 
chacha20, chachapoly, dhm, ecdsa, rsa 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