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

   ## Summary
   
   Five small fixes for the vendored mbedTLS ALT layer (crypto/mbedtls), which 
routes mbedTLS cipher and hash operations to the cryptodev (/dev/crypto) 
interface:
   
   * **AES-CBC algorithm id and IV chaining** (`aes_alt.c`): the session cipher 
was hardcoded to `CRYPTO_AES_CBC`, the AES-128-CBC id, so a session created 
with a 192/256-bit key ran the wrong algorithm and produced garbage. The id is 
now derived from the key length stored in the session (24 bytes -> 
`CRYPTO_AES_192_CBC`, 32 -> `CRYPTO_AES_256_CBC`). The IV writeback read the 
last ciphertext block from the output buffer, which holds plaintext after a 
decryption; a copy of the last input block is kept before the operation and 
written back instead. A zero length is now rejected like other 
non-block-multiple lengths.
   * **cmac update leak** (`cmac_alt.c`): `mbedtls_cipher_cmac_update()` 
returned on a `cryptodev_crypt()` failure without releasing the session and the 
context device, leaking both. The finish path already releases on every path.
   * **entropy O_NONBLOCK** (`entropy_alt.c`): open `/dev/random` without 
blocking, so a system where the entropy source lives behind a device that is 
still coming up does not hang in the open; reads still return as soon as data 
is available.
   * **DEV_RPMSG entropy dependency** (`Kconfig`): 
`MBEDTLS_ENTROPY_HARDWARE_ALT` now also depends on `DEV_RPMSG`, for systems 
where the hardware RNG is exported from another core through the rpmsg device.
   * **MBEDTLS_PLATFORM_TIME_ALT Kconfig** (`Kconfig`, `mbedtls_config.h`): 
expose the runtime platform-time replacement as an option instead of requiring 
an edit of the vendored configuration header.
   * **nxstyle cleanup**: a few long-standing style issues in `entropy_alt.c` 
and `cmac_alt.c`, needed because the checkpatch CI runs nxstyle on every file a 
PR touches. No functional change.
   
   ## Impact
   
   * Fixes and configuration only; no interface change.
   * No kernel dependency beyond current master: the tree builds against nuttx 
master 66bad554049 as is.
   
   ## Testing
   
   Board sim:crypto with `CONFIG_CRYPTO_MBEDTLS=y` (nuttx master 66bad554049): 
the full build compiles the vendored mbedTLS with the ALT sources (aes_alt.c, 
cmac_alt.c, entropy_alt.c among them) with no errors and no new warnings.
   
   `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