Commit Graph

13 Commits

Author SHA1 Message Date
harshal.patil
a7f4bb8503 fix(mbedtls): Fixed the transmission of return values of the esp-aes APIs
- Earlier, some intermediate return values were not stored and returned,
thus incorrect return values used to get transmitted to the upper layer of APIs.

- Also, zeroised the output buffer in case of error condition.
2023-07-20 18:56:22 +05:30
Mahavir Jain
18dbdbb643
aes: fix DMA descriptor calculation for the alignment case
The number of the DMA descriptors allocated for certain length (e.g.,
8176) were not sufficient (off by 1 error). This used to result in the
dynamic memory corruption as the region was modified beyond the
allocated range.

This change fixes the DMA descriptor calculation part and allocates
sufficient DMA descriptors based on the data length alignment considerations.

Test has also been added to cover the specific scenario in the CI.

Closes https://github.com/espressif/esp-idf/issues/11310
2023-06-07 09:22:10 +05:30
harshal.patil
f138411fd7 mbedtls/port: added stream_block parameter sanity check 2023-01-25 15:40:45 +05:30
harshal.patil
119ac05b5e mbedtls: fix esp_aes_crypt_ctr writing to null stream block 2023-01-25 15:40:45 +05:30
harshal.patil
342671a943 mbedtls: added SOC_AES_SUPPORT_AES_192 check in esp_aes_gcm_setkey() 2023-01-25 15:40:45 +05:30
Marius Vikhammer
6e9d90d6e1 soc: Added support for specify the maximum descriptor length when setting up the DMA descriptor link 2022-01-06 08:11:57 +08:00
Marius Vikhammer
2a28ec3522 crypto: also apply cache writeback/invalidate for SPIRAM_USE_MEMMAP
Closes https://github.com/espressif/esp-idf/issues/7944
2022-01-06 08:11:57 +08:00
Marius Vikhammer
b957692888 crypto: allocate all DMA descriptors to DMA capable memory.
These were previously placed on the stack, but the stack could be placed in
RTC RAM which is not DMA capable.
2022-01-06 08:11:57 +08:00
Marius Vikhammer
1c9f018891 aes: fix potential unaligned access in aes-gcm 2021-11-04 10:59:53 +08:00
Angus Gratton
e6b8bc6ecb mbedtls aes dma: Fix bug where DMA would complete when the first output descriptor was done, not the last 2021-03-25 15:28:45 +11:00
Marius Vikhammer
1c8fd4041e aes/sha: use a shared lazy allocated GDMA channel for AES and SHA
Removed the old dynamically allocated GDMA channel approach.
It proved too unreliable as we couldn't not ensure consumers of the mbedtls
would properly free the channels after use.

Replaced by a single shared GDMA channel for AES and SHA, which won't be
released unless user specifically calls API for releasing it.
2021-03-10 09:40:35 +08:00
Marius Vikhammer
51169b0e0c AES/SHA: use GDMA driver instead of LL 2021-01-19 11:02:51 +08:00
Marius Vikhammer
457ce080ae AES: refactor and add HAL layer
Refactor the AES driver and add HAL, LL and caps.

Add better support for running AES-GCM fully in hardware.
2020-12-10 09:04:47 +00:00