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

   ## Summary
   
   Extends the Mbed TLS ALT layer so the API surface the merged kernel 
capabilities support is reachable from mbedtls: asymmetric operations, GCM with 
any IV, PBKDF2, sessions keyed by key id, and the CIOCKEY path - plus two fixes 
the extension uncovered.
   
   * **fix private member access in cmac_alt**: `CONFIG_MBEDTLS_CMAC_ALT` never 
compiled on master (20 errors reaching into private Mbed TLS 3.x members); 
rewritten to `MBEDTLS_PRIVATE()`. This is the only place the series touches 
existing files' private access.
   * **add CIOCKEY wrapper to dev_alt**: a `cryptodev_cryptk()` helper and 
`crypt_kop` context member, mirroring `cryptodev_crypt()`.
   * **reset len/src and set olen in the alt finish paths**: fixes a latent bug 
- every hash/MAC alt finish left the context length and source pointer set, so 
a second `mbedtls_md_hmac_update`/`finish` processed the same message twice (a 
16-byte CMAC input returned CMAC(M,M)). The ALT path has never worked correctly 
on master; no defconfig enables it, so nothing caught it.
   * **add ecdsa and ecdh alt implementations**: ECDSA sign/verify and ECDH 
over cryptodev, little-endian integers matching the kernel side.
   * **add gcm alt implementation**: any IV length (not just 96-bit), streaming 
`update_ad`/`update`/`finish`, and session release on finish.
   * **add PKCS#5 PBKDF2 alt implementation**: routes PBKDF2 to the kernel with 
the per-request iteration count; carries a 0004 patch that guards the fetched 
pkcs5.c with the ALT symbols (the fetched-tree convention of 0001-0003).
   * **support AES sessions keyed by key id**: the `_keyid` setkey variants 
open sessions whose key is a cryptodev key id (the key-id mechanism of 
apache/nuttx#22061); plain setkey clears `SOP_F_KEYID` so contexts cannot leak 
the mode.
   
   ## Impact
   
   All new options default n. Kernel-side prerequisites are already merged 
(CIOCKEY ops, `SOP_F_KEYID`, ECC little-endian, any-IV GCM, PBKDF2 iteration 
forwarding); this series needs no nuttx changes.
   
   ## Testing
   
   Built from a fresh checkout state (distclean + refetch + patches reapplied) 
with all twelve ALT options enabled: 0 warnings, 0 errors, and each commit 
builds standalone. Functional verification through the mbedtls API against 
reference vectors: CMAC over RFC 4493 and SP 800-38B AES-256 (including 
multi-part update/finish), GCM with 96-bit/8-byte/60-byte IVs and streaming vs 
python cryptography, PBKDF2 over RFC 6070 and SHA-256, key-id sessions 
byte-identical to direct-key sessions, ECDSA/ECDH round trips and tamper 
rejection. The standard crypto regression (12 tests) and the PKCS12 cmocka 
suite (2/2) pass unchanged - the latter exercises the wrapper-to-ALT hash path 
end to end.
   
   Out of scope but found while testing: the kernel's aad-only GCM finalize 
(empty payload) computes a wrong tag through cryptosoft - reproducible with 
direct CIOCCRYPT without any ALT involvement; that needs its own fix on the 
nuttx side.
   


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