Wykres commitów

32 Commity (cd47cf46dcf04e38a19c8d71dd644caa133ef38a)

Autor SHA1 Wiadomość Data
harshal.patil e8268d8b6b
feat(hal/aes): use RCC atomic block to enable/reset the AES peripheral 2024-03-13 15:22:07 +05:30
harshal.patil 2abb656ba2
feat(mbedtls/aes): Support AES-DMA operations by satisfying L1 cache alignment requirements
- Use DMA RX done interrupt status bit while waiting for DMA rx transfer
2024-03-13 15:22:07 +05:30
harshal.patil 9b15189583
change(mbedtls): replace Cache ROM APIs usage with APIs from esp_cache.h
- Only APIs used in esp_crypto_shared_gdma and aes have been replaced
- Get dcache line size using cache api instead of Kconfig
2024-03-13 15:22:07 +05:30
harshal.patil a6012c9e5a
feat(mbedtls/aes): add AES peripheral support for esp32p4 2024-03-13 15:22:06 +05:30
harshal.patil 83dd60307f
feat(mbedtls/esp_crypto_shared_gdma): support AXI-DMA in the crypto shared gdma layer
- In case of AXI-DMA, the DMA descriptors need to be 8 bytes aligned
lldesc_t do not satify this condition thus we need to replace it with
dma_descriptor_t (align(4) and align(8)) in esp_crypto_shared_gdma.

- Added new shared gdma start API that supports the dma_descriptor_t
DMA descriptor.

- Added some generic dma descriptor macros and helper functions

- replace lldesc_t with dma_descriptor_t
2024-03-13 15:22:06 +05:30
harshal.patil 2c570ed53b
change(mbedtls/aes): moved esp_aes_internal.h to be a private header
- Also enable AES-GCM test in the hal crypto test app for all targets
2024-03-13 15:22:06 +05:30
nilesh.kale aab3f604ec feat(hal/testapps): Added AES and SHA testcases with DMA support 2024-02-09 14:23:06 +05:30
harshal.patil 8ac4d9ab99
fix(mbedtls/gcm): Avoid using GCM hardware when config MBEDTLS_HARDWARE_GCM is disabled 2024-01-04 12:20:11 +05:30
harshal.patil d3be7bda05
fix(mbedtls): move interrupt allocation during initialization phase 2023-11-06 11:20:53 +05:30
nilesh.kale cf4a7bb09d feat(mbedtls): Add config for interrupt priority in AES and RSA(MPI) 2023-10-12 11:06:13 +05:30
Alexey Lapshin 71713bcdb5 fix(mbedtls): fix gcc 13.1.0 warnings 2023-10-09 12:13:02 +04:00
Mahavir Jain 9dc4b8beeb fix(aes): correct the linking of the DMA descriptors
For certain data lengths, the last input descriptor was not getting appended
correctly and hence the EOF flag in the DMA descriptor link list was
set at incorrect location. This was resulting in the peripheral being
stalled expecting more data and eventually the code used to timeout
waiting for the AES completion interrupt.

Required configs for this issue:

CONFIG_MBEDTLS_HARDWARE_AES
CONFIG_SOC_AES_SUPPORT_DMA

This observation is similar to the issue reported in:
https://github.com/espressif/esp-idf/issues/10647

To recreate this issue, start the AES-GCM DMA operation with data length
12280 bytes and this should stall the operation forever.

In this fix, we are tracing the entire descriptor list and then appending the
extra bytes descriptor at correct position (as the last node).
2023-09-04 05:35:15 +00:00
Mahavir Jain 89584cd1d0 fix(aes-gcm): correct the DMA completion wait condition for hardware GCM case
DMA operation completion must wait until the last DMA descriptor
ownership has been changed to hardware, that is hardware is completed
the write operation for entire data. Earlier for the hardware GCM case,
the first DMA descriptor was checked and it could have resulted in some
race condition for non interrupt (MBEDTLS_AES_USE_INTERRUPT disabled) case.
2023-09-04 05:35:15 +00:00
harshal.patil 990e1e9307 refactor(mbedtls): refactored the return values check in some esp-aes APIs 2023-07-12 14:41:41 +05:30
harshal.patil 38255c048a 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-12 14:41:41 +05:30
Mahavir Jain f7a01d8f90
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-05-31 14:19:58 +05:30
Mahavir Jain a9e7ccb166 Merge branch 'contrib/github_pr_10648' into 'master'
[AES] Timeout: return error dont abort (GitHub PR)

Closes IDFGH-9265

See merge request espressif/esp-idf!22266
2023-02-21 01:14:05 +08:00
Marius Vikhammer ca0f982420 aes: fix minor formatting issues 2023-02-15 12:45:29 +08:00
Chip Weinberger 91ab4b5513 [AES] Timeout: return error dont abort 2023-01-30 01:37:00 -08:00
harshal.patil 270ff95022 mbedtls/port: refactor sanity checks and their return values
Refactored and returned correct error codes for sanity checks
present in port layer esp_aes.c and esp_aes_gcm.c
2023-01-16 15:04:08 +05:30
harshal.patil 9a47f8a066 mbedtls/port: added stream_block parameter sanity check 2023-01-16 15:04:08 +05:30
Darian Leung 781d06af73 esp_hw_support: Remove compare_set.h API
This function removes the following legacy atomic CAS functions:

From compare_set.h (file removed):
- compare_and_set_native()
- compare_and_set_extram()

From portmacro.h
- uxPortCompareSet()
- uxPortCompareSetExtram()

Users should call esp_cpu_compare_and_set() instead as this function hides the details
of atomic CAS on internal and external RAM addresses.

Due to the removal of compare_set.h, some missing header includes are also fixed in this commit.
2022-07-22 00:06:06 +08:00
Mahavir Jain a94c74c26b
mbedtls: remove dependency on driver component
- keep `esp_pm` dependency conditional in mbedtls
- refactor `bt` cmakelist to keep dependencies as private

Related: IDF-1265
2022-07-18 21:10:51 +05:30
Armando c4bcf1117c esp_hw_support: move soc_memory_types.h helper functions into esp_hw_support 2022-04-08 11:46:10 +08:00
Marius Vikhammer 97e05c6f8b crypto: also apply cache writeback/invalidate for SPIRAM_USE_MEMMAP
Closes https://github.com/espressif/esp-idf/issues/7944
2021-12-08 12:09:01 +08:00
Marius Vikhammer 7fc7c49e5d 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.
2021-12-08 12:09:01 +08:00
morris 16677b0d3c global: make periph enable/disable APIs private
peripheral enable/disable usually should be managed by driver itself,
so make it as espressif private APIs, not recommended for user to use it
in application code.
However, if user want to re-write the driver or ports to other platform,
this is still possible by including the header in this way:
"esp_private/peripheral_ctrl.h"
2021-11-08 10:37:47 +08:00
Marius Vikhammer 9b4ba3d707 crypto: initial S3 Beta 3 bringup and testing for SHA/AES/RSA/flash enc 2021-05-18 11:25:41 +08:00
Marius Vikhammer fe71a8e340 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-09 09:23:05 +08:00
Angus Gratton e7563fe704 mbedtls aes dma: Fix bug where DMA would complete when the first output descriptor was done, not the last 2021-02-12 04:08:12 +00: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