Skip to content

Commit

Permalink
Merge branch 'fix/fix_aes_dma_desc_align' into 'master'
Browse files Browse the repository at this point in the history
aes: fix aes dma desc align

Closes IDF-10458

See merge request espressif/esp-idf!32144
  • Loading branch information
mahavirj committed Jul 18, 2024
2 parents 7ec3e6c + 38bdfe1 commit 8f3f860
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions components/mbedtls/port/aes/dma/esp_aes_dma_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,8 @@ int esp_aes_process_dma(esp_aes_context *ctx, const unsigned char *input, unsign
}

#if SOC_CACHE_INTERNAL_MEM_VIA_L1CACHE
if (esp_cache_msync(output_desc, ALIGN_UP(output_dma_desc_num * sizeof(crypto_dma_desc_t), output_cache_line_size), ESP_CACHE_MSYNC_FLAG_DIR_M2C) != ESP_OK) {
size_t output_desc_cache_line_size = get_cache_line_size(output_desc);
if (esp_cache_msync(output_desc, ALIGN_UP(output_dma_desc_num * sizeof(crypto_dma_desc_t), output_desc_cache_line_size), ESP_CACHE_MSYNC_FLAG_DIR_M2C) != ESP_OK) {
ESP_LOGE(TAG, "Output DMA descriptor cache sync M2C failed");
ret = -1;
goto cleanup;
Expand Down Expand Up @@ -834,7 +835,8 @@ int esp_aes_process_dma_gcm(esp_aes_context *ctx, const unsigned char *input, un
}

#if SOC_CACHE_INTERNAL_MEM_VIA_L1CACHE
if (esp_cache_msync(output_desc, ALIGN_UP(output_dma_desc_num * sizeof(crypto_dma_desc_t), output_cache_line_size), ESP_CACHE_MSYNC_FLAG_DIR_M2C) != ESP_OK) {
size_t output_desc_cache_line_size = get_cache_line_size(output_desc);
if (esp_cache_msync(output_desc, ALIGN_UP(output_dma_desc_num * sizeof(crypto_dma_desc_t), output_desc_cache_line_size), ESP_CACHE_MSYNC_FLAG_DIR_M2C) != ESP_OK) {
ESP_LOGE(TAG, "Output DMA descriptor cache sync M2C failed");
ret = -1;
goto cleanup;
Expand Down

0 comments on commit 8f3f860

Please sign in to comment.