mirror of
https://github.com/espressif/esp-idf.git
synced 2026-09-22 13:01:16 +03:00
test(mbedtls): fix in-place AES-CTR PSRAM test on targets without AES hardware
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.
This commit is contained in:
@@ -1952,7 +1952,11 @@ void aes_psram_one_buf_ctr_test(void)
|
||||
uint8_t nonce[16];
|
||||
uint8_t key[16];
|
||||
psa_status_t status;
|
||||
#if CONFIG_MBEDTLS_HARDWARE_AES
|
||||
size_t SZ = TEST_AES_CTR_DATA_LEN;
|
||||
#else
|
||||
size_t SZ = TEST_AES_CTR_DATA_LEN - (TEST_AES_CTR_DATA_LEN % 16);
|
||||
#endif
|
||||
size_t ALIGNMENT_SIZE_BYTES = 32;
|
||||
memset(nonce, 0x2F, 16);
|
||||
memset(key, 0x1E, 16);
|
||||
|
||||
Reference in New Issue
Block a user