From 853bff88c5db2a7852f7e5afd7e65503db9ab578 Mon Sep 17 00:00:00 2001 From: "harshal.patil" Date: Mon, 6 Nov 2023 17:27:14 +0530 Subject: [PATCH] change(mbedtls/sha): replace Cache ROM APIs usage with APIs from esp_cache.h --- components/mbedtls/port/sha/dma/sha.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/components/mbedtls/port/sha/dma/sha.c b/components/mbedtls/port/sha/dma/sha.c index 26d0612589..a0453c5607 100644 --- a/components/mbedtls/port/sha/dma/sha.c +++ b/components/mbedtls/port/sha/dma/sha.c @@ -34,6 +34,7 @@ #include "esp_crypto_lock.h" #include "esp_attr.h" #include "soc/lldesc.h" +#include "esp_cache.h" #include "soc/ext_mem_defs.h" #include "soc/periph_defs.h" @@ -48,16 +49,6 @@ #include "soc/soc_caps.h" #include "esp_sha_dma_priv.h" -#if CONFIG_IDF_TARGET_ESP32S2 -#include "esp32s2/rom/cache.h" -#elif CONFIG_IDF_TARGET_ESP32S3 -#include "esp32s3/rom/cache.h" -#elif CONFIG_IDF_TARGET_ESP32C3 -#include "esp32s3/rom/cache.h" -#elif CONFIG_IDF_TARGET_ESP32C2 -#include "esp32c2/rom/cache.h" -#endif - #if SOC_SHA_GDMA #define SHA_LOCK() esp_crypto_sha_aes_lock_acquire() #define SHA_RELEASE() esp_crypto_sha_aes_lock_release() @@ -189,10 +180,10 @@ int esp_sha_dma(esp_sha_type sha_type, const void *input, uint32_t ilen, #if (CONFIG_SPIRAM && SOC_PSRAM_DMA_CAPABLE) if (esp_ptr_external_ram(input)) { - Cache_WriteBack_Addr((uint32_t)input, ilen); + esp_cache_msync((void *)input, ilen, ESP_CACHE_MSYNC_FLAG_DIR_C2M | ESP_CACHE_MSYNC_FLAG_UNALIGNED); } if (esp_ptr_external_ram(buf)) { - Cache_WriteBack_Addr((uint32_t)buf, buf_len); + esp_cache_msync((void *)buf, buf_len, ESP_CACHE_MSYNC_FLAG_DIR_C2M | ESP_CACHE_MSYNC_FLAG_UNALIGNED); } #endif