mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
feat: enable AES GCM support for ESP32-S31
This commit is contained in:
@@ -1126,7 +1126,7 @@ int esp_aes_process_dma(esp_aes_context *ctx, const unsigned char *input, unsign
|
||||
crypto_dma_desc_num = dma_desc_get_required_num(block_bytes, DMA_DESCRIPTOR_BUFFER_MAX_SIZE_16B_ALIGNED);
|
||||
|
||||
/* Allocate both in and out descriptors to save a malloc/free per function call */
|
||||
block_desc = heap_caps_aligned_calloc(8, crypto_dma_desc_num * 2, sizeof(crypto_dma_desc_t), MALLOC_CAP_DMA);
|
||||
block_desc = heap_caps_aligned_calloc(DMA_DESC_MEM_ALIGN_SIZE, crypto_dma_desc_num * 2, sizeof(crypto_dma_desc_t), MALLOC_CAP_DMA);
|
||||
if (block_desc == NULL) {
|
||||
mbedtls_platform_zeroize(output, len);
|
||||
ESP_LOGE(TAG, "Failed to allocate memory");
|
||||
@@ -1299,7 +1299,7 @@ int esp_aes_process_dma_gcm(esp_aes_context *ctx, const unsigned char *input, un
|
||||
crypto_dma_desc_num = dma_desc_get_required_num(block_bytes, DMA_DESCRIPTOR_BUFFER_MAX_SIZE_4B_ALIGNED);
|
||||
|
||||
/* Allocate both in and out descriptors to save a malloc/free per function call, add 1 for length descriptor */
|
||||
block_desc = heap_caps_calloc((crypto_dma_desc_num * 2) + 1, sizeof(crypto_dma_desc_t), MALLOC_CAP_DMA);
|
||||
block_desc = heap_caps_aligned_calloc(DMA_DESC_MEM_ALIGN_SIZE, (crypto_dma_desc_num * 2) + 1, sizeof(crypto_dma_desc_t), MALLOC_CAP_DMA);
|
||||
if (block_desc == NULL) {
|
||||
mbedtls_platform_zeroize(output, len);
|
||||
ESP_LOGE(TAG, "Failed to allocate memory");
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
|
||||
#if SOC_GDMA_SUPPORTED
|
||||
#include "hal/gdma_ll.h"
|
||||
#elif (SOC_AES_CRYPTO_DMA) || (SOC_SHA_CRYPTO_DMA)
|
||||
#include "hal/crypto_dma_ll.h"
|
||||
#endif /* SOC_GDMA_SUPPORTED */
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -38,7 +40,7 @@ typedef dma_descriptor_align8_t crypto_dma_desc_t;
|
||||
#endif /* (SOC_GDMA_TRIG_PERIPH_AES0_BUS == SOC_GDMA_BUS_AHB) || (SOC_GDMA_TRIG_PERIPH_AES0_BUS == SOC_GDMA_BUS_AHB) */
|
||||
|
||||
#elif (SOC_AES_CRYPTO_DMA) || (SOC_SHA_CRYPTO_DMA)
|
||||
#define DMA_DESC_MEM_ALIGN_SIZE GDMA_LL_AHB_DESC_ALIGNMENT
|
||||
#define DMA_DESC_MEM_ALIGN_SIZE CRYPTO_DMA_LL_DESC_ALIGNMENT
|
||||
typedef dma_descriptor_align4_t crypto_dma_desc_t;
|
||||
|
||||
#endif /* (SOC_AES_GDMA) && (SOC_SHA_GDMA) */
|
||||
|
||||
Reference in New Issue
Block a user