Sfoglia il codice sorgente

esp_hw_support: cleanup crypto lock APIs for ESP32-C2

Mahavir Jain 3 anni fa
parent
commit
f7fc3e2d88

+ 3 - 52
components/esp_hw_support/include/soc/esp32c2/esp_crypto_lock.h

@@ -10,58 +10,9 @@
 extern "C" {
 #endif
 
-/**
- * @brief Acquire lock for HMAC cryptography peripheral
- *
- * Internally also locks the SHA peripheral, as the HMAC depends on the SHA peripheral
- */
-void esp_crypto_hmac_lock_acquire(void);
-
-/**
- * @brief Release lock for HMAC cryptography peripheral
- *
- * Internally also releases the SHA peripheral, as the HMAC depends on the SHA peripheral
- */
-void esp_crypto_hmac_lock_release(void);
-
-/**
- * @brief Acquire lock for DS cryptography peripheral
- *
- * Internally also locks the HMAC (which locks SHA), AES and MPI  peripheral, as the DS depends on these peripherals
- */
-void esp_crypto_ds_lock_acquire(void);
-
-/**
- * @brief Release lock for DS cryptography peripheral
- *
- * Internally also releases the HMAC (which locks SHA), AES and MPI  peripheral, as the DS depends on these peripherals
- */
-void esp_crypto_ds_lock_release(void);
-
-/**
- * @brief Acquire lock for the SHA and AES cryptography peripheral.
- *
- */
-void esp_crypto_sha_aes_lock_acquire(void);
-
-/**
- * @brief Release lock for the SHA and AES cryptography peripheral.
- *
- */
-void esp_crypto_sha_aes_lock_release(void);
-
-
-/**
- * @brief Acquire lock for the mpi cryptography peripheral.
- *
- */
-void esp_crypto_mpi_lock_acquire(void);
-
-/**
- * @brief Release lock for the mpi/rsa cryptography peripheral.
- *
- */
-void esp_crypto_mpi_lock_release(void);
+// Place-holder lock APIs as hardware AES is not supported in ESP32-C2
+static inline void esp_crypto_sha_aes_lock_acquire(void) {}
+static inline void esp_crypto_sha_aes_lock_release(void) {}
 
 #ifdef __cplusplus
 }

+ 0 - 1
components/esp_hw_support/port/esp32c2/CMakeLists.txt

@@ -10,7 +10,6 @@ set(srcs "cpu_util_esp32c2.c"
 
 if(NOT BOOTLOADER_BUILD)
     list(APPEND srcs "../async_memcpy_impl_gdma.c"
-                     "esp_crypto_lock.c"
                      "dport_access.c")
 endif()
 

+ 0 - 71
components/esp_hw_support/port/esp32c2/esp_crypto_lock.c

@@ -1,71 +0,0 @@
-/*
- * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-#include <sys/lock.h>
-#include <stdlib.h>
-#include "esp_crypto_lock.h"
-
-/* Lock overview:
-SHA: peripheral independent, but DMA is shared with AES
-AES: peripheral independent, but DMA is shared with SHA
-MPI/RSA: independent
-HMAC: needs SHA
-DS: needs HMAC (which needs SHA), AES and MPI
-*/
-
-#if 0 // TODO: IDF-4229
-/* Lock for DS peripheral */
-static _lock_t s_crypto_ds_lock;
-
-/* Lock for HMAC peripheral */
-static _lock_t s_crypto_hmac_lock;
-
-/* Lock for the MPI/RSA peripheral, also used by the DS peripheral */
-static _lock_t s_crypto_mpi_lock;
-
-/* Single lock for SHA and AES, sharing a reserved GDMA channel */
-static _lock_t s_crypto_sha_aes_lock;
-#endif
-
-void esp_crypto_hmac_lock_acquire(void)
-{
-    abort(); // TODO: IDF-4229
-}
-
-void esp_crypto_hmac_lock_release(void)
-{
-    abort(); // TODO: IDF-4229
-}
-
-void esp_crypto_ds_lock_acquire(void)
-{
-    abort(); // TODO: IDF-4229
-}
-
-void esp_crypto_ds_lock_release(void)
-{
-    abort(); // TODO: IDF-4229
-}
-
-void esp_crypto_sha_aes_lock_acquire(void)
-{
-    abort(); // TODO: IDF-4229
-}
-
-void esp_crypto_sha_aes_lock_release(void)
-{
-    abort(); // TODO: IDF-4229
-}
-
-void esp_crypto_mpi_lock_acquire(void)
-{
-    abort(); // TODO: IDF-4229
-}
-
-void esp_crypto_mpi_lock_release(void)
-{
-    abort(); // TODO: IDF-4229
-}

+ 0 - 2
components/mbedtls/port/esp_ds/esp_rsa_sign_alt.c

@@ -15,8 +15,6 @@
 #include "esp32h2/rom/digital_signature.h"
 #elif CONFIG_IDF_TARGET_ESP32S3
 #include "esp32s3/rom/digital_signature.h"
-#elif CONFIG_IDF_TARGET_ESP32C2
-#include "esp32c2/rom/digital_signature.h"
 #else
 #error   "Selected target does not support esp_rsa_sign_alt (for DS)"
 #endif