mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-30 19:19:21 +00:00
feat(esp_security): Add a TEE-specific crypto lock layer with stub implementations
This commit is contained in:
@@ -35,13 +35,8 @@
|
||||
#include "esp_crypto_periph_clk.h"
|
||||
|
||||
#if SOC_AES_GDMA
|
||||
#if !ESP_TEE_BUILD
|
||||
#define AES_LOCK() esp_crypto_sha_aes_lock_acquire()
|
||||
#define AES_RELEASE() esp_crypto_sha_aes_lock_release()
|
||||
#else
|
||||
#define AES_LOCK()
|
||||
#define AES_RELEASE()
|
||||
#endif
|
||||
#elif SOC_AES_CRYPTO_DMA
|
||||
#define AES_LOCK() esp_crypto_dma_lock_acquire()
|
||||
#define AES_RELEASE() esp_crypto_dma_lock_release()
|
||||
|
@@ -52,14 +52,6 @@
|
||||
#endif
|
||||
#endif /* SOC_SHA_SUPPORT_DMA */
|
||||
|
||||
#if !ESP_TEE_BUILD
|
||||
#define SHA_LOCK() esp_crypto_sha_aes_lock_acquire()
|
||||
#define SHA_RELEASE() esp_crypto_sha_aes_lock_release()
|
||||
#else
|
||||
#define SHA_LOCK()
|
||||
#define SHA_RELEASE()
|
||||
#endif
|
||||
|
||||
void esp_sha_write_digest_state(esp_sha_type sha_type, void *digest_state)
|
||||
{
|
||||
sha_hal_write_digest(sha_type, digest_state);
|
||||
@@ -99,7 +91,7 @@ inline static size_t block_length(esp_sha_type type)
|
||||
void esp_sha_acquire_hardware(void)
|
||||
{
|
||||
/* Released when releasing hw with esp_sha_release_hardware() */
|
||||
SHA_LOCK();
|
||||
esp_crypto_sha_aes_lock_acquire();
|
||||
esp_crypto_sha_enable_periph_clk(true);
|
||||
}
|
||||
|
||||
@@ -107,7 +99,7 @@ void esp_sha_acquire_hardware(void)
|
||||
void esp_sha_release_hardware(void)
|
||||
{
|
||||
esp_crypto_sha_enable_periph_clk(false);
|
||||
SHA_RELEASE();
|
||||
esp_crypto_sha_aes_lock_release();
|
||||
}
|
||||
|
||||
void esp_sha_block(esp_sha_type sha_type, const void *data_block, bool is_first_block)
|
||||
|
Reference in New Issue
Block a user