mirror of
https://github.com/espressif/esp-idf.git
synced 2026-09-22 13:01:16 +03:00
With MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS enabled, an in-place psa_cipher_update() reaches the selected cipher implementation without defensive buffer copies. The ESP AES PSA driver accepts an in-place update of any length for CTR (PSA classifies CTR as a stream cipher, so the driver's block_length is 1), but on targets without the AES peripheral (e.g. ESP32-C61) the operation falls back to the mbedtls builtin cipher layer, which rejects in-place updates whose length is not a multiple of the block size (MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA, surfacing as PSA_ERROR_INVALID_ARGUMENT). Round the in-place test length down to a block multiple when CONFIG_MBEDTLS_HARDWARE_AES is not set; partial-block PSRAM coverage is retained through the separate-buffer alignment tests.