forked from espressif/esp-idf
Merge branch 'feature/introduce_security_component' into 'master'
Introduce a new security component Closes IDF-9359 See merge request espressif/esp-idf!31969
This commit is contained in:
@@ -108,6 +108,7 @@
|
||||
/components/esp_psram/ @esp-idf-codeowners/peripherals @esp-idf-codeowners/system
|
||||
/components/esp_ringbuf/ @esp-idf-codeowners/system
|
||||
/components/esp_rom/ @esp-idf-codeowners/system @esp-idf-codeowners/bluetooth @esp-idf-codeowners/wifi
|
||||
/components/esp_security/ @esp-idf-codeowners/security
|
||||
/components/esp_system/ @esp-idf-codeowners/system
|
||||
/components/esp_timer/ @esp-idf-codeowners/system
|
||||
/components/esp-tls/ @esp-idf-codeowners/app-utilities
|
||||
|
@@ -10,7 +10,8 @@ endif()
|
||||
|
||||
set(requires soc)
|
||||
# only esp_hw_support/adc_share_hw_ctrl.c requires efuse component
|
||||
set(priv_requires efuse spi_flash bootloader_support)
|
||||
# TODO: remove esp_security from REQUIRES in ESP-IDF v6.0 (see IDF-10733)
|
||||
set(priv_requires efuse spi_flash bootloader_support esp_security)
|
||||
|
||||
if(${target} STREQUAL "esp32c6")
|
||||
list(APPEND priv_requires hal)
|
||||
@@ -111,26 +112,10 @@ if(NOT BOOTLOADER_BUILD)
|
||||
list(APPEND srcs "port/${target}/systimer.c")
|
||||
endif()
|
||||
|
||||
if(CONFIG_SOC_HMAC_SUPPORTED)
|
||||
list(APPEND srcs "esp_hmac.c")
|
||||
endif()
|
||||
|
||||
if(CONFIG_SOC_ETM_SUPPORTED)
|
||||
list(APPEND srcs "esp_etm.c")
|
||||
endif()
|
||||
|
||||
if(CONFIG_SOC_CRYPTO_DPA_PROTECTION_SUPPORTED)
|
||||
list(APPEND srcs "esp_dpa_protection.c")
|
||||
endif()
|
||||
|
||||
if(CONFIG_SOC_DIG_SIGN_SUPPORTED)
|
||||
list(APPEND srcs "esp_ds.c")
|
||||
endif()
|
||||
|
||||
if(CONFIG_SOC_KEY_MANAGER_SUPPORTED)
|
||||
list(APPEND srcs "esp_key_mgr.c")
|
||||
endif()
|
||||
|
||||
if(CONFIG_SOC_PAU_SUPPORTED)
|
||||
list(APPEND srcs "port/pau_regdma.c"
|
||||
"port/regdma_link.c")
|
||||
@@ -203,7 +188,4 @@ if(NOT BOOTLOADER_BUILD)
|
||||
if(CONFIG_SPIRAM)
|
||||
idf_component_optional_requires(PRIVATE esp_psram)
|
||||
endif()
|
||||
if(CONFIG_SOC_CRYPTO_DPA_PROTECTION_SUPPORTED)
|
||||
target_link_libraries(${COMPONENT_LIB} PRIVATE "-u esp_crypto_dpa_prot_include_impl")
|
||||
endif()
|
||||
endif()
|
||||
|
@@ -243,44 +243,6 @@ menu "Hardware Settings"
|
||||
orsource "./port/$IDF_TARGET/Kconfig.xtal"
|
||||
endmenu
|
||||
|
||||
menu "Crypto DPA Protection"
|
||||
depends on SOC_CRYPTO_DPA_PROTECTION_SUPPORTED
|
||||
config ESP_CRYPTO_DPA_PROTECTION_AT_STARTUP
|
||||
bool "Enable crypto DPA protection at startup"
|
||||
default y
|
||||
help
|
||||
This config controls the DPA (Differential Power Analysis) protection
|
||||
knob for the crypto peripherals. DPA protection dynamically adjusts the
|
||||
clock frequency of the crypto peripheral. DPA protection helps to make it
|
||||
difficult to perform SCA attacks on the crypto peripherals. However,
|
||||
there is also associated performance impact based on the security level
|
||||
set. Please refer to the TRM for more details.
|
||||
|
||||
choice ESP_CRYPTO_DPA_PROTECTION_LEVEL
|
||||
prompt "DPA protection level"
|
||||
depends on ESP_CRYPTO_DPA_PROTECTION_AT_STARTUP
|
||||
default ESP_CRYPTO_DPA_PROTECTION_LEVEL_LOW
|
||||
help
|
||||
Configure the DPA protection security level
|
||||
|
||||
config ESP_CRYPTO_DPA_PROTECTION_LEVEL_LOW
|
||||
bool "Security level low"
|
||||
|
||||
config ESP_CRYPTO_DPA_PROTECTION_LEVEL_MEDIUM
|
||||
bool "Security level medium"
|
||||
|
||||
config ESP_CRYPTO_DPA_PROTECTION_LEVEL_HIGH
|
||||
bool "Security level high"
|
||||
endchoice
|
||||
|
||||
config ESP_CRYPTO_DPA_PROTECTION_LEVEL
|
||||
int
|
||||
default 1 if ESP_CRYPTO_DPA_PROTECTION_LEVEL_LOW
|
||||
default 2 if ESP_CRYPTO_DPA_PROTECTION_LEVEL_MEDIUM
|
||||
default 3 if ESP_CRYPTO_DPA_PROTECTION_LEVEL_HIGH
|
||||
|
||||
endmenu
|
||||
|
||||
orsource "./port/$IDF_TARGET/Kconfig.dcdc"
|
||||
|
||||
orsource "./port/$IDF_TARGET/Kconfig.ldo"
|
||||
|
@@ -6,10 +6,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "soc/soc_caps.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef SOC_HMAC_SUPPORTED
|
||||
/**
|
||||
* @brief Acquire lock for HMAC cryptography peripheral
|
||||
*
|
||||
@@ -23,7 +26,9 @@ void esp_crypto_hmac_lock_acquire(void);
|
||||
* Internally also releases the SHA peripheral, as the HMAC depends on the SHA peripheral
|
||||
*/
|
||||
void esp_crypto_hmac_lock_release(void);
|
||||
#endif /* SOC_HMAC_SUPPORTED */
|
||||
|
||||
#ifdef SOC_DIG_SIGN_SUPPORTED
|
||||
/**
|
||||
* @brief Acquire lock for DS cryptography peripheral
|
||||
*
|
||||
@@ -37,7 +42,9 @@ void esp_crypto_ds_lock_acquire(void);
|
||||
* 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);
|
||||
#endif /* SOC_DIG_SIGN_SUPPORTED */
|
||||
|
||||
#if defined(SOC_SHA_SUPPORTED) && defined(SOC_AES_SUPPORTED)
|
||||
/**
|
||||
* @brief Acquire lock for the SHA and AES cryptography peripheral.
|
||||
*
|
||||
@@ -49,8 +56,29 @@ void esp_crypto_sha_aes_lock_acquire(void);
|
||||
*
|
||||
*/
|
||||
void esp_crypto_sha_aes_lock_release(void);
|
||||
#endif /* defined(SOC_SHA_SUPPORTED) && defined(SOC_AES_SUPPORTED) */
|
||||
|
||||
#if defined(SOC_SHA_CRYPTO_DMA) && defined(SOC_AES_CRYPTO_DMA)
|
||||
/**
|
||||
* This API should be used by all components which use the SHA, AES, HMAC and DS crypto hardware on the ESP32S2.
|
||||
* They can not be used in parallel because they use the same DMA or are calling each other.
|
||||
* E.g., HMAC uses SHA or DS uses HMAC and AES. See the ESP32S2 Technical Reference Manual for more details.
|
||||
*
|
||||
* Other unrelated components must not use it.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Acquire lock for the AES and SHA cryptography peripherals, which both use the crypto DMA.
|
||||
*/
|
||||
void esp_crypto_dma_lock_acquire(void);
|
||||
|
||||
/**
|
||||
* Release lock for the AES and SHA cryptography peripherals, which both use the crypto DMA.
|
||||
*/
|
||||
void esp_crypto_dma_lock_release(void);
|
||||
#endif /* defined(SOC_SHA_CRYPTO_DMA) && defined(SOC_AES_CRYPTO_DMA) */
|
||||
|
||||
#ifdef SOC_MPI_SUPPORTED
|
||||
/**
|
||||
* @brief Acquire lock for the mpi cryptography peripheral.
|
||||
*
|
||||
@@ -62,8 +90,9 @@ void esp_crypto_mpi_lock_acquire(void);
|
||||
*
|
||||
*/
|
||||
void esp_crypto_mpi_lock_release(void);
|
||||
#endif /* SOC_MPI_SUPPORTED */
|
||||
|
||||
|
||||
#ifdef SOC_ECC_SUPPORTED
|
||||
/**
|
||||
* @brief Acquire lock for the ECC cryptography peripheral.
|
||||
*
|
||||
@@ -75,8 +104,9 @@ void esp_crypto_ecc_lock_acquire(void);
|
||||
*
|
||||
*/
|
||||
void esp_crypto_ecc_lock_release(void);
|
||||
#endif /* SOC_ECC_SUPPORTED */
|
||||
|
||||
|
||||
#ifdef SOC_ECDSA_SUPPORTED
|
||||
/**
|
||||
* @brief Acquire lock for ECDSA cryptography peripheral
|
||||
*
|
||||
@@ -90,7 +120,9 @@ void esp_crypto_ecdsa_lock_acquire(void);
|
||||
* Internally also releases the ECC and MPI peripheral, as the ECDSA depends on these peripherals
|
||||
*/
|
||||
void esp_crypto_ecdsa_lock_release(void);
|
||||
#endif /* SOC_ECDSA_SUPPORTED */
|
||||
|
||||
#ifdef SOC_KEY_MANAGER_SUPPORTED
|
||||
/**
|
||||
* @brief Acquire lock for Key Manager peripheral
|
||||
*
|
||||
@@ -102,6 +134,7 @@ void esp_crypto_key_manager_lock_acquire(void);
|
||||
*
|
||||
*/
|
||||
void esp_crypto_key_manager_lock_release(void);
|
||||
#endif /* SOC_KEY_MANAGER_SUPPORTED */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
@@ -6,7 +6,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@@ -40,7 +40,7 @@ typedef enum {
|
||||
*
|
||||
* @note Uses the HMAC peripheral in "upstream" mode.
|
||||
*
|
||||
* @param key_id Determines which of the 6 key blocks in the efuses should be used for the HMAC calcuation.
|
||||
* @param key_id Determines which of the 6 key blocks in the efuses should be used for the HMAC calculation.
|
||||
* The corresponding purpose field of the key block in the efuse must be set to the HMAC upstream purpose value.
|
||||
* @param message the message for which to calculate the HMAC
|
||||
* @param message_len message length
|
||||
|
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Acquire lock for the mpi cryptography peripheral.
|
||||
*
|
||||
*/
|
||||
void esp_crypto_mpi_lock_acquire(void);
|
||||
|
||||
/**
|
||||
* @brief Release lock for the mpi cryptography peripheral.
|
||||
*
|
||||
*/
|
||||
void esp_crypto_mpi_lock_release(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Acquire lock for the ECC cryptography peripheral.
|
||||
*
|
||||
*/
|
||||
void esp_crypto_ecc_lock_acquire(void);
|
||||
|
||||
/**
|
||||
* @brief Release lock for the ECC cryptography peripheral.
|
||||
*
|
||||
*/
|
||||
void esp_crypto_ecc_lock_release(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
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);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@@ -1,94 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
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);
|
||||
|
||||
/**
|
||||
* @brief Acquire lock for the ECC cryptography peripheral.
|
||||
*
|
||||
*/
|
||||
void esp_crypto_ecc_lock_acquire(void);
|
||||
|
||||
/**
|
||||
* @brief Release lock for the ECC cryptography peripheral.
|
||||
*
|
||||
*/
|
||||
void esp_crypto_ecc_lock_release(void);
|
||||
|
||||
/**
|
||||
* @brief Acquire lock for ECDSA cryptography peripheral
|
||||
*
|
||||
* Internally also locks the ECC and MPI peripheral, as the ECDSA depends on these peripherals
|
||||
*/
|
||||
void esp_crypto_ecdsa_lock_acquire(void);
|
||||
|
||||
/**
|
||||
* @brief Release lock for ECDSA cryptography peripheral
|
||||
*
|
||||
* Internally also releases the ECC and MPI peripheral, as the ECDSA depends on these peripherals
|
||||
*/
|
||||
void esp_crypto_ecdsa_lock_release(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
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);
|
||||
|
||||
/**
|
||||
* @brief Acquire lock for the ECC cryptography peripheral.
|
||||
*
|
||||
*/
|
||||
void esp_crypto_ecc_lock_acquire(void);
|
||||
|
||||
/**
|
||||
* @brief Release lock for the ECC cryptography peripheral.
|
||||
*
|
||||
*/
|
||||
void esp_crypto_ecc_lock_release(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void esp_crypto_ecc_lock_acquire(void);
|
||||
|
||||
/**
|
||||
* @brief Release lock for the ECC cryptography peripheral.
|
||||
*
|
||||
*/
|
||||
void esp_crypto_ecc_lock_release(void);
|
||||
|
||||
/**
|
||||
* @brief Acquire lock for ECDSA cryptography peripheral
|
||||
*
|
||||
* Internally also locks the ECC and MPI peripheral, as the ECDSA depends on these peripherals
|
||||
*/
|
||||
void esp_crypto_ecdsa_lock_acquire(void);
|
||||
|
||||
/**
|
||||
* @brief Release lock for ECDSA cryptography peripheral
|
||||
*
|
||||
* Internally also releases the ECC and MPI peripheral, as the ECDSA depends on these peripherals
|
||||
*/
|
||||
void esp_crypto_ecdsa_lock_release(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@@ -1,96 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
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);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Acquire lock for the ECC cryptography peripheral.
|
||||
*
|
||||
*/
|
||||
void esp_crypto_ecc_lock_acquire(void);
|
||||
|
||||
/**
|
||||
* @brief Release lock for the ECC cryptography peripheral.
|
||||
*
|
||||
*/
|
||||
void esp_crypto_ecc_lock_release(void);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Acquire lock for ECDSA cryptography peripheral
|
||||
*
|
||||
* Internally also locks the ECC and MPI peripheral, as the ECDSA depends on these peripherals
|
||||
*/
|
||||
void esp_crypto_ecdsa_lock_acquire(void);
|
||||
|
||||
/**
|
||||
* @brief Release lock for ECDSA cryptography peripheral
|
||||
*
|
||||
* Internally also releases the ECC and MPI peripheral, as the ECDSA depends on these peripherals
|
||||
*/
|
||||
void esp_crypto_ecdsa_lock_release(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This API should be used by all components which use the SHA, AES, HMAC and DS crypto hardware on the ESP32S2.
|
||||
* They can not be used in parallel because they use the same DMA or are calling each other.
|
||||
* E.g., HMAC uses SHA or DS uses HMAC and AES. See the ESP32S2 Technical Reference Manual for more details.
|
||||
*
|
||||
* Other unrelated components must not use it.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Acquire lock for the AES and SHA cryptography peripherals, which both use the crypto DMA.
|
||||
*/
|
||||
void esp_crypto_dma_lock_acquire(void);
|
||||
|
||||
/**
|
||||
* Release lock for the AES and SHA cryptography peripherals, which both use the crypto DMA.
|
||||
*/
|
||||
void esp_crypto_dma_lock_release(void);
|
||||
|
||||
/**
|
||||
* Acquire lock for the MPI/RSA cryptography peripheral
|
||||
*/
|
||||
void esp_crypto_mpi_lock_acquire(void);
|
||||
|
||||
/**
|
||||
* Release lock for the MPI/RSA cryptography peripheral
|
||||
*/
|
||||
void esp_crypto_mpi_lock_release(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This API should be used by all components which use the SHA, AES, HMAC and DS crypto hardware on the ESP32S3.
|
||||
* Not all of them can be used in parallel because they use the same underlying module.
|
||||
* E.g., HMAC uses SHA or DS uses HMAC and AES. See the ESP32S3 Technical Reference Manual for more details.
|
||||
*
|
||||
* Other unrelated components must not use it.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Acquire lock for Digital Signature(DS) cryptography peripheral
|
||||
*
|
||||
* Internally also takes the HMAC lock, as the DS depends on the HMAC peripheral
|
||||
*/
|
||||
void esp_crypto_ds_lock_acquire(void);
|
||||
|
||||
/**
|
||||
* @brief Release lock for Digital Signature(DS) cryptography peripheral
|
||||
*
|
||||
* Internally also releases the HMAC lock, as the DS depends on the HMAC peripheral
|
||||
*/
|
||||
void esp_crypto_ds_lock_release(void);
|
||||
|
||||
/**
|
||||
* @brief Acquire lock for HMAC cryptography peripheral
|
||||
*
|
||||
* Internally also takes the SHA & AES lock, 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 & AES lock, as the HMAC depends on the SHA peripheral
|
||||
*/
|
||||
void esp_crypto_hmac_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);
|
||||
|
||||
/**
|
||||
* Acquire lock for the MPI/RSA cryptography peripheral
|
||||
*/
|
||||
void esp_crypto_mpi_lock_acquire(void);
|
||||
|
||||
/**
|
||||
* Release lock for the MPI/RSA cryptography peripheral
|
||||
*/
|
||||
void esp_crypto_mpi_lock_release(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@@ -10,7 +10,6 @@ set(srcs
|
||||
|
||||
if(NOT BOOTLOADER_BUILD)
|
||||
list(APPEND srcs "cache_sram_mmu.c"
|
||||
"esp_crypto_lock.c"
|
||||
"sar_periph_ctrl.c")
|
||||
endif()
|
||||
|
||||
|
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <sys/lock.h>
|
||||
|
||||
#include "esp_crypto_lock.h"
|
||||
|
||||
/* Lock overview:
|
||||
MPI/RSA: independent
|
||||
*/
|
||||
|
||||
/* Lock for the MPI/RSA peripheral */
|
||||
|
||||
static _lock_t s_crypto_mpi_lock;
|
||||
|
||||
void esp_crypto_mpi_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_mpi_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_mpi_lock_release(void)
|
||||
{
|
||||
_lock_release(&s_crypto_mpi_lock);
|
||||
}
|
@@ -7,8 +7,7 @@ set(srcs "rtc_clk_init.c"
|
||||
|
||||
if(NOT BOOTLOADER_BUILD)
|
||||
|
||||
list(APPEND srcs "esp_crypto_lock.c"
|
||||
"sar_periph_ctrl.c")
|
||||
list(APPEND srcs "sar_periph_ctrl.c")
|
||||
|
||||
endif()
|
||||
|
||||
|
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <sys/lock.h>
|
||||
|
||||
#include "esp_crypto_lock.h"
|
||||
|
||||
/* Lock overview:
|
||||
ECC: independent
|
||||
*/
|
||||
|
||||
/* Lock for ECC peripheral */
|
||||
static _lock_t s_crypto_ecc_lock;
|
||||
|
||||
void esp_crypto_ecc_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_ecc_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_ecc_lock_release(void)
|
||||
{
|
||||
_lock_release(&s_crypto_ecc_lock);
|
||||
}
|
@@ -7,8 +7,7 @@ set(srcs "rtc_clk_init.c"
|
||||
)
|
||||
|
||||
if(NOT BOOTLOADER_BUILD)
|
||||
list(APPEND srcs "esp_crypto_lock.c"
|
||||
"sar_periph_ctrl.c")
|
||||
list(APPEND srcs "sar_periph_ctrl.c")
|
||||
|
||||
# init constructor for wifi
|
||||
list(APPEND srcs "adc2_init_cal.c")
|
||||
|
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <sys/lock.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
|
||||
*/
|
||||
|
||||
/* 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;
|
||||
|
||||
void esp_crypto_hmac_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_hmac_lock);
|
||||
esp_crypto_sha_aes_lock_acquire();
|
||||
}
|
||||
|
||||
void esp_crypto_hmac_lock_release(void)
|
||||
{
|
||||
esp_crypto_sha_aes_lock_release();
|
||||
_lock_release(&s_crypto_hmac_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_ds_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_ds_lock);
|
||||
esp_crypto_hmac_lock_acquire();
|
||||
esp_crypto_mpi_lock_acquire();
|
||||
}
|
||||
|
||||
void esp_crypto_ds_lock_release(void)
|
||||
{
|
||||
esp_crypto_mpi_lock_release();
|
||||
esp_crypto_hmac_lock_release();
|
||||
_lock_release(&s_crypto_ds_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_sha_aes_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_sha_aes_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_sha_aes_lock_release(void)
|
||||
{
|
||||
_lock_release(&s_crypto_sha_aes_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_mpi_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_mpi_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_mpi_lock_release(void)
|
||||
{
|
||||
_lock_release(&s_crypto_mpi_lock);
|
||||
}
|
@@ -7,8 +7,7 @@ set(srcs "rtc_clk_init.c"
|
||||
)
|
||||
|
||||
if(NOT BOOTLOADER_BUILD)
|
||||
list(APPEND srcs "sar_periph_ctrl.c"
|
||||
"esp_crypto_lock.c")
|
||||
list(APPEND srcs "sar_periph_ctrl.c")
|
||||
endif()
|
||||
|
||||
add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}")
|
||||
|
@@ -1,104 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <sys/lock.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
|
||||
ECC: independent
|
||||
HMAC: needs SHA
|
||||
DS: needs HMAC (which needs SHA), AES and MPI
|
||||
*/
|
||||
|
||||
/* 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;
|
||||
|
||||
/* Lock for ECC peripheral */
|
||||
static _lock_t s_crypto_ecc_lock;
|
||||
|
||||
/* Lock for ECDSA peripheral */
|
||||
static _lock_t s_crypto_ecdsa_lock;
|
||||
|
||||
void esp_crypto_hmac_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_hmac_lock);
|
||||
esp_crypto_sha_aes_lock_acquire();
|
||||
}
|
||||
|
||||
void esp_crypto_hmac_lock_release(void)
|
||||
{
|
||||
esp_crypto_sha_aes_lock_release();
|
||||
_lock_release(&s_crypto_hmac_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_ds_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_ds_lock);
|
||||
esp_crypto_hmac_lock_acquire();
|
||||
esp_crypto_mpi_lock_acquire();
|
||||
}
|
||||
|
||||
void esp_crypto_ds_lock_release(void)
|
||||
{
|
||||
esp_crypto_mpi_lock_release();
|
||||
esp_crypto_hmac_lock_release();
|
||||
_lock_release(&s_crypto_ds_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_sha_aes_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_sha_aes_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_sha_aes_lock_release(void)
|
||||
{
|
||||
_lock_release(&s_crypto_sha_aes_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_mpi_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_mpi_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_mpi_lock_release(void)
|
||||
{
|
||||
_lock_release(&s_crypto_mpi_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_ecc_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_ecc_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_ecc_lock_release(void)
|
||||
{
|
||||
_lock_release(&s_crypto_ecc_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_ecdsa_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_ecdsa_lock);
|
||||
esp_crypto_ecc_lock_acquire();
|
||||
}
|
||||
|
||||
void esp_crypto_ecdsa_lock_release(void)
|
||||
{
|
||||
esp_crypto_ecc_lock_release();
|
||||
_lock_release(&s_crypto_ecdsa_lock);
|
||||
}
|
@@ -9,8 +9,7 @@ set(srcs "rtc_clk_init.c"
|
||||
)
|
||||
|
||||
if(NOT BOOTLOADER_BUILD)
|
||||
list(APPEND srcs "sar_periph_ctrl.c"
|
||||
"esp_crypto_lock.c")
|
||||
list(APPEND srcs "sar_periph_ctrl.c")
|
||||
|
||||
endif()
|
||||
|
||||
|
@@ -1,89 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <sys/lock.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
|
||||
ECC: independent
|
||||
HMAC: needs SHA
|
||||
DS: needs HMAC (which needs SHA), AES and MPI
|
||||
*/
|
||||
|
||||
/* 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;
|
||||
|
||||
/* Lock for ECC peripheral */
|
||||
static _lock_t s_crypto_ecc_lock;
|
||||
|
||||
void esp_crypto_hmac_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_hmac_lock);
|
||||
esp_crypto_sha_aes_lock_acquire();
|
||||
}
|
||||
|
||||
void esp_crypto_hmac_lock_release(void)
|
||||
{
|
||||
esp_crypto_sha_aes_lock_release();
|
||||
_lock_release(&s_crypto_hmac_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_ds_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_ds_lock);
|
||||
esp_crypto_hmac_lock_acquire();
|
||||
esp_crypto_mpi_lock_acquire();
|
||||
}
|
||||
|
||||
void esp_crypto_ds_lock_release(void)
|
||||
{
|
||||
esp_crypto_mpi_lock_release();
|
||||
esp_crypto_hmac_lock_release();
|
||||
_lock_release(&s_crypto_ds_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_sha_aes_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_sha_aes_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_sha_aes_lock_release(void)
|
||||
{
|
||||
_lock_release(&s_crypto_sha_aes_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_mpi_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_mpi_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_mpi_lock_release(void)
|
||||
{
|
||||
_lock_release(&s_crypto_mpi_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_ecc_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_ecc_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_ecc_lock_release(void)
|
||||
{
|
||||
_lock_release(&s_crypto_ecc_lock);
|
||||
}
|
@@ -9,8 +9,7 @@ set(srcs "rtc_clk_init.c"
|
||||
)
|
||||
|
||||
if(NOT BOOTLOADER_BUILD)
|
||||
list(APPEND srcs "sar_periph_ctrl.c"
|
||||
"esp_crypto_lock.c")
|
||||
list(APPEND srcs "sar_periph_ctrl.c")
|
||||
|
||||
if(CONFIG_ESP_SYSTEM_MEMPROT_FEATURE)
|
||||
list(APPEND srcs "esp_memprot.c" "../esp_memprot_conv.c")
|
||||
|
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <sys/lock.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
|
||||
ECC: independent
|
||||
HMAC: needs SHA
|
||||
DS: needs HMAC (which needs SHA), AES and MPI
|
||||
*/
|
||||
|
||||
/* Lock for ECC peripheral */
|
||||
static _lock_t s_crypto_ecc_lock;
|
||||
|
||||
/* Lock for ECDSA peripheral */
|
||||
static _lock_t s_crypto_ecdsa_lock;
|
||||
|
||||
void esp_crypto_ecc_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_ecc_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_ecc_lock_release(void)
|
||||
{
|
||||
_lock_release(&s_crypto_ecc_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_ecdsa_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_ecdsa_lock);
|
||||
esp_crypto_ecc_lock_acquire();
|
||||
}
|
||||
|
||||
void esp_crypto_ecdsa_lock_release(void)
|
||||
{
|
||||
esp_crypto_ecc_lock_release();
|
||||
_lock_release(&s_crypto_ecdsa_lock);
|
||||
}
|
@@ -8,8 +8,7 @@ set(srcs "rtc_clk_init.c"
|
||||
)
|
||||
|
||||
if(NOT BOOTLOADER_BUILD)
|
||||
list(APPEND srcs "sar_periph_ctrl.c"
|
||||
"esp_crypto_lock.c")
|
||||
list(APPEND srcs "sar_periph_ctrl.c")
|
||||
endif()
|
||||
|
||||
add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}")
|
||||
|
@@ -1,107 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <sys/lock.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
|
||||
ECC: independent
|
||||
HMAC: needs SHA
|
||||
DS: needs HMAC (which needs SHA), AES and MPI
|
||||
ECDSA: needs ECC and MPI
|
||||
*/
|
||||
|
||||
/* 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;
|
||||
|
||||
/* Lock for ECC peripheral */
|
||||
static _lock_t s_crypto_ecc_lock;
|
||||
|
||||
/* Lock for ECDSA peripheral */
|
||||
static _lock_t s_crypto_ecdsa_lock;
|
||||
|
||||
void esp_crypto_hmac_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_hmac_lock);
|
||||
esp_crypto_sha_aes_lock_acquire();
|
||||
}
|
||||
|
||||
void esp_crypto_hmac_lock_release(void)
|
||||
{
|
||||
esp_crypto_sha_aes_lock_release();
|
||||
_lock_release(&s_crypto_hmac_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_ds_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_ds_lock);
|
||||
esp_crypto_hmac_lock_acquire();
|
||||
esp_crypto_mpi_lock_acquire();
|
||||
}
|
||||
|
||||
void esp_crypto_ds_lock_release(void)
|
||||
{
|
||||
esp_crypto_mpi_lock_release();
|
||||
esp_crypto_hmac_lock_release();
|
||||
_lock_release(&s_crypto_ds_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_sha_aes_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_sha_aes_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_sha_aes_lock_release(void)
|
||||
{
|
||||
_lock_release(&s_crypto_sha_aes_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_mpi_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_mpi_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_mpi_lock_release(void)
|
||||
{
|
||||
_lock_release(&s_crypto_mpi_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_ecc_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_ecc_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_ecc_lock_release(void)
|
||||
{
|
||||
_lock_release(&s_crypto_ecc_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_ecdsa_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_ecdsa_lock);
|
||||
esp_crypto_ecc_lock_acquire();
|
||||
esp_crypto_mpi_lock_acquire();
|
||||
}
|
||||
|
||||
void esp_crypto_ecdsa_lock_release(void)
|
||||
{
|
||||
esp_crypto_mpi_lock_release();
|
||||
esp_crypto_ecc_lock_release();
|
||||
_lock_release(&s_crypto_ecdsa_lock);
|
||||
}
|
@@ -10,8 +10,7 @@ set(srcs "rtc_clk_init.c"
|
||||
)
|
||||
|
||||
if(NOT BOOTLOADER_BUILD)
|
||||
list(APPEND srcs "sar_periph_ctrl.c"
|
||||
"esp_crypto_lock.c")
|
||||
list(APPEND srcs "sar_periph_ctrl.c")
|
||||
|
||||
if(NOT CONFIG_APP_BUILD_TYPE_PURE_RAM_APP)
|
||||
list(APPEND srcs "mspi_timing_config.c")
|
||||
|
@@ -10,7 +10,6 @@ set(srcs
|
||||
|
||||
if(NOT BOOTLOADER_BUILD)
|
||||
list(APPEND srcs "memprot.c"
|
||||
"esp_crypto_lock.c"
|
||||
"sar_periph_ctrl.c")
|
||||
|
||||
# init constructor for wifi
|
||||
|
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <sys/lock.h>
|
||||
|
||||
#include "esp_crypto_lock.h"
|
||||
|
||||
/* Single lock for SHA and AES engine which both use the crypto DMA */
|
||||
|
||||
static _lock_t s_crypto_dma_lock;
|
||||
|
||||
/* Lock for the MPI/RSA peripheral, also used by the DS peripheral */
|
||||
static _lock_t s_crypto_mpi_lock;
|
||||
|
||||
void esp_crypto_dma_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_dma_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_dma_lock_release(void)
|
||||
{
|
||||
_lock_release(&s_crypto_dma_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_mpi_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_mpi_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_mpi_lock_release(void)
|
||||
{
|
||||
_lock_release(&s_crypto_mpi_lock);
|
||||
}
|
@@ -10,8 +10,7 @@ set(srcs
|
||||
)
|
||||
|
||||
if(NOT BOOTLOADER_BUILD)
|
||||
list(APPEND srcs "esp_crypto_lock.c"
|
||||
"sar_periph_ctrl.c")
|
||||
list(APPEND srcs "sar_periph_ctrl.c")
|
||||
|
||||
if(NOT CONFIG_APP_BUILD_TYPE_PURE_RAM_APP)
|
||||
list(APPEND srcs "mspi_timing_config.c")
|
||||
|
@@ -1,67 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <sys/lock.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
|
||||
*/
|
||||
|
||||
/*
|
||||
* Single lock for SHA, HMAC, DS and AES peripherals.
|
||||
* SHA and AES share a reserved GDMA channel.
|
||||
* DS uses HMAC, HMAC uses SHA, so they may also not be used simulaneously.
|
||||
*/
|
||||
static _lock_t s_crypto_sha_aes_hmac_ds_lock;
|
||||
|
||||
/* Lock for the MPI/RSA peripheral, also used by the DS peripheral */
|
||||
static _lock_t s_crypto_mpi_lock;
|
||||
|
||||
void esp_crypto_ds_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire_recursive(&s_crypto_sha_aes_hmac_ds_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_ds_lock_release(void)
|
||||
{
|
||||
_lock_release_recursive(&s_crypto_sha_aes_hmac_ds_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_hmac_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire_recursive(&s_crypto_sha_aes_hmac_ds_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_hmac_lock_release(void)
|
||||
{
|
||||
_lock_release_recursive(&s_crypto_sha_aes_hmac_ds_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_sha_aes_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire_recursive(&s_crypto_sha_aes_hmac_ds_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_sha_aes_lock_release(void)
|
||||
{
|
||||
_lock_release_recursive(&s_crypto_sha_aes_hmac_ds_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_mpi_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_mpi_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_mpi_lock_release(void)
|
||||
{
|
||||
_lock_release(&s_crypto_mpi_lock);
|
||||
}
|
@@ -2,10 +2,7 @@ set(srcs "test_app_main.c"
|
||||
"test_dport.c"
|
||||
"test_fp.c"
|
||||
"test_dport_xt_highint5.S"
|
||||
"test_ds.c"
|
||||
"test_hmac.c"
|
||||
"test_random.c"
|
||||
"test_key_mgr.c"
|
||||
)
|
||||
|
||||
if(CONFIG_SOC_GP_LDO_SUPPORTED)
|
||||
|
File diff suppressed because one or more lines are too long
@@ -15,8 +15,6 @@
|
||||
#include "memory_checks.h"
|
||||
#include "esp_heap_trace.h"
|
||||
#endif
|
||||
#include "esp_crypto_lock.h"
|
||||
#include "esp_partition.h"
|
||||
|
||||
/* During merging of DS and HMAC testapps to this directory, maximum memory leak during running is 404,
|
||||
so, updating TEST_MEMORY_LEAK_THRESHOLD_DEFAULT */
|
||||
@@ -50,15 +48,6 @@ void setUp(void)
|
||||
|
||||
leak_threshold = TEST_MEMORY_LEAK_THRESHOLD_DEFAULT;
|
||||
|
||||
#if SOC_KEY_MANAGER_SUPPORTED
|
||||
esp_crypto_ecc_lock_acquire();
|
||||
esp_crypto_sha_aes_lock_acquire();
|
||||
esp_crypto_ecc_lock_release();
|
||||
esp_crypto_sha_aes_lock_release();
|
||||
esp_crypto_key_manager_lock_acquire();
|
||||
esp_crypto_key_manager_lock_release();
|
||||
esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_ANY, "storage");
|
||||
#endif
|
||||
before_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT);
|
||||
before_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
42
components/esp_security/CMakeLists.txt
Normal file
42
components/esp_security/CMakeLists.txt
Normal file
@@ -0,0 +1,42 @@
|
||||
idf_build_get_property(target IDF_TARGET)
|
||||
|
||||
if(${target} STREQUAL "linux")
|
||||
return() # This component is not supported by the POSIX/Linux simulator
|
||||
endif()
|
||||
|
||||
set(srcs "")
|
||||
set(priv_requires "")
|
||||
set(priv_includes "")
|
||||
|
||||
if(NOT BOOTLOADER_BUILD)
|
||||
list(APPEND srcs "src/init.c")
|
||||
list(APPEND priv_includes "src/${IDF_TARGET}")
|
||||
|
||||
if(CONFIG_SOC_HMAC_SUPPORTED)
|
||||
list(APPEND srcs "src/esp_hmac.c")
|
||||
endif()
|
||||
|
||||
if(CONFIG_SOC_DIG_SIGN_SUPPORTED)
|
||||
list(APPEND srcs "src/esp_ds.c")
|
||||
endif()
|
||||
|
||||
if(CONFIG_SOC_KEY_MANAGER_SUPPORTED)
|
||||
list(APPEND srcs "src/esp_key_mgr.c")
|
||||
endif()
|
||||
|
||||
if(CONFIG_SOC_CRYPTO_DPA_PROTECTION_SUPPORTED)
|
||||
list(APPEND srcs "src/esp_dpa_protection.c")
|
||||
endif()
|
||||
|
||||
list(APPEND srcs "src/esp_crypto_lock.c")
|
||||
list(APPEND priv_requires efuse esp_hw_support esp_system esp_timer)
|
||||
endif()
|
||||
|
||||
idf_component_register(SRCS ${srcs}
|
||||
INCLUDE_DIRS "include"
|
||||
PRIV_INCLUDE_DIRS ${priv_includes}
|
||||
PRIV_REQUIRES ${priv_requires})
|
||||
|
||||
if(NOT BOOTLOADER_BUILD)
|
||||
target_link_libraries(${COMPONENT_LIB} PRIVATE "-u esp_security_init_include_impl")
|
||||
endif()
|
40
components/esp_security/Kconfig
Normal file
40
components/esp_security/Kconfig
Normal file
@@ -0,0 +1,40 @@
|
||||
menu "ESP Security Specific"
|
||||
|
||||
menu "Crypto DPA Protection"
|
||||
depends on SOC_CRYPTO_DPA_PROTECTION_SUPPORTED
|
||||
config ESP_CRYPTO_DPA_PROTECTION_AT_STARTUP
|
||||
bool "Enable crypto DPA protection at startup"
|
||||
default y
|
||||
help
|
||||
This config controls the DPA (Differential Power Analysis) protection
|
||||
knob for the crypto peripherals. DPA protection dynamically adjusts
|
||||
clock frequency of the crypto peripheral. DPA protection helps to make it
|
||||
difficult to perform SCA attacks on the crypto peripherals. However,
|
||||
there is also associated performance impact based on the security level
|
||||
set. Please refer to the TRM for more details.
|
||||
|
||||
choice ESP_CRYPTO_DPA_PROTECTION_LEVEL
|
||||
prompt "DPA protection level"
|
||||
depends on ESP_CRYPTO_DPA_PROTECTION_AT_STARTUP
|
||||
default ESP_CRYPTO_DPA_PROTECTION_LEVEL_LOW
|
||||
help
|
||||
Configure the DPA protection security level
|
||||
|
||||
config ESP_CRYPTO_DPA_PROTECTION_LEVEL_LOW
|
||||
bool "Security level low"
|
||||
|
||||
config ESP_CRYPTO_DPA_PROTECTION_LEVEL_MEDIUM
|
||||
bool "Security level medium"
|
||||
|
||||
config ESP_CRYPTO_DPA_PROTECTION_LEVEL_HIGH
|
||||
bool "Security level high"
|
||||
endchoice
|
||||
|
||||
config ESP_CRYPTO_DPA_PROTECTION_LEVEL
|
||||
int
|
||||
default 1 if ESP_CRYPTO_DPA_PROTECTION_LEVEL_LOW
|
||||
default 2 if ESP_CRYPTO_DPA_PROTECTION_LEVEL_MEDIUM
|
||||
default 3 if ESP_CRYPTO_DPA_PROTECTION_LEVEL_HIGH
|
||||
endmenu
|
||||
|
||||
endmenu
|
10
components/esp_security/src/esp32/esp_crypto_clk.h
Normal file
10
components/esp_security/src/esp32/esp_crypto_clk.h
Normal file
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/* nothing to do */
|
||||
static inline void esp_crypto_clk_init(void) {}
|
10
components/esp_security/src/esp32c2/esp_crypto_clk.h
Normal file
10
components/esp_security/src/esp32c2/esp_crypto_clk.h
Normal file
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/* nothing to do */
|
||||
static inline void esp_crypto_clk_init(void) {}
|
10
components/esp_security/src/esp32c3/esp_crypto_clk.h
Normal file
10
components/esp_security/src/esp32c3/esp_crypto_clk.h
Normal file
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/* nothing to do */
|
||||
static inline void esp_crypto_clk_init(void) {}
|
16
components/esp_security/src/esp32c5/esp_crypto_clk.h
Normal file
16
components/esp_security/src/esp32c5/esp_crypto_clk.h
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "soc/soc.h"
|
||||
#include "soc/pcr_reg.h"
|
||||
|
||||
#pragma once
|
||||
|
||||
static inline void esp_crypto_clk_init(void)
|
||||
{
|
||||
// Set crypto clock (`clk_sec`) to use 480M SPLL clock
|
||||
REG_SET_FIELD(PCR_SEC_CONF_REG, PCR_SEC_CLK_SEL, 0x2);
|
||||
}
|
10
components/esp_security/src/esp32c6/esp_crypto_clk.h
Normal file
10
components/esp_security/src/esp32c6/esp_crypto_clk.h
Normal file
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/* nothing to do */
|
||||
static inline void esp_crypto_clk_init(void) {}
|
16
components/esp_security/src/esp32c61/esp_crypto_clk.h
Normal file
16
components/esp_security/src/esp32c61/esp_crypto_clk.h
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "soc/soc.h"
|
||||
#include "soc/pcr_reg.h"
|
||||
|
||||
#pragma once
|
||||
|
||||
static inline void esp_crypto_clk_init(void)
|
||||
{
|
||||
// Set crypto clock (`clk_sec`) to use 480M SPLL clock
|
||||
REG_SET_FIELD(PCR_SEC_CONF_REG, PCR_SEC_CLK_SEL, 0x2);
|
||||
}
|
16
components/esp_security/src/esp32h2/esp_crypto_clk.h
Normal file
16
components/esp_security/src/esp32h2/esp_crypto_clk.h
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "soc/soc.h"
|
||||
#include "soc/pcr_reg.h"
|
||||
|
||||
#pragma once
|
||||
|
||||
static inline void esp_crypto_clk_init(void)
|
||||
{
|
||||
// Set crypto clock (`clk_sec`) to use 96M PLL clock
|
||||
REG_SET_FIELD(PCR_SEC_CONF_REG, PCR_SEC_CLK_SEL, 0x3);
|
||||
}
|
15
components/esp_security/src/esp32p4/esp_crypto_clk.h
Normal file
15
components/esp_security/src/esp32p4/esp_crypto_clk.h
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#include "soc/soc.h"
|
||||
#include "soc/hp_sys_clkrst_reg.h"
|
||||
|
||||
#pragma once
|
||||
|
||||
static inline void esp_crypto_clk_init(void)
|
||||
{
|
||||
// Set crypto clock (`clk_sec`) to use 240M PLL clock
|
||||
REG_SET_FIELD(HP_SYS_CLKRST_PERI_CLK_CTRL25_REG, HP_SYS_CLKRST_REG_CRYPTO_CLK_SRC_SEL, 0x2);
|
||||
}
|
10
components/esp_security/src/esp32s2/esp_crypto_clk.h
Normal file
10
components/esp_security/src/esp32s2/esp_crypto_clk.h
Normal file
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/* nothing to do */
|
||||
static inline void esp_crypto_clk_init(void) {}
|
10
components/esp_security/src/esp32s3/esp_crypto_clk.h
Normal file
10
components/esp_security/src/esp32s3/esp_crypto_clk.h
Normal file
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/* nothing to do */
|
||||
static inline void esp_crypto_clk_init(void) {}
|
@@ -18,27 +18,42 @@ DS: needs HMAC (which needs SHA), AES and MPI
|
||||
ECDSA: needs ECC and MPI
|
||||
*/
|
||||
|
||||
#ifdef SOC_DIG_SIGN_SUPPORTED
|
||||
/* Lock for DS peripheral */
|
||||
static _lock_t s_crypto_ds_lock;
|
||||
#endif /* SOC_DIG_SIGN_SUPPORTED */
|
||||
|
||||
#ifdef SOC_HMAC_SUPPORTED
|
||||
/* Lock for HMAC peripheral */
|
||||
static _lock_t s_crypto_hmac_lock;
|
||||
#endif /* SOC_HMAC_SUPPORTED */
|
||||
|
||||
#ifdef SOC_MPI_SUPPORTED
|
||||
/* Lock for the MPI/RSA peripheral, also used by the DS peripheral */
|
||||
static _lock_t s_crypto_mpi_lock;
|
||||
#endif /* SOC_MPI_SUPPORTED */
|
||||
|
||||
#if defined(SOC_SHA_SUPPORTED) && defined(SOC_AES_SUPPORTED)
|
||||
/* Single lock for SHA and AES, sharing a reserved GDMA channel */
|
||||
static _lock_t s_crypto_sha_aes_lock;
|
||||
#endif /* defined(SOC_SHA_SUPPORTED) && defined(SOC_AES_SUPPORTED) */
|
||||
|
||||
#ifdef SOC_ECC_SUPPORTED
|
||||
/* Lock for ECC peripheral */
|
||||
static _lock_t s_crypto_ecc_lock;
|
||||
#endif /* SOC_ECC_SUPPORTED */
|
||||
|
||||
#ifdef SOC_ECDSA_SUPPORTED
|
||||
/* Lock for ECDSA peripheral */
|
||||
static _lock_t s_crypto_ecdsa_lock;
|
||||
#endif /* SOC_ECDSA_SUPPORTED */
|
||||
|
||||
#ifdef SOC_KEY_MANAGER_SUPPORTED
|
||||
/* Lock for Key Manager peripheral */
|
||||
static _lock_t s_crypto_key_manager_lock;
|
||||
#endif /* SOC_KEY_MANAGER_SUPPORTED */
|
||||
|
||||
#ifdef SOC_HMAC_SUPPORTED
|
||||
void esp_crypto_hmac_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_hmac_lock);
|
||||
@@ -50,7 +65,9 @@ void esp_crypto_hmac_lock_release(void)
|
||||
esp_crypto_sha_aes_lock_release();
|
||||
_lock_release(&s_crypto_hmac_lock);
|
||||
}
|
||||
#endif /* SOC_HMAC_SUPPORTED */
|
||||
|
||||
#ifdef SOC_DIG_SIGN_SUPPORTED
|
||||
void esp_crypto_ds_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_ds_lock);
|
||||
@@ -64,7 +81,9 @@ void esp_crypto_ds_lock_release(void)
|
||||
esp_crypto_hmac_lock_release();
|
||||
_lock_release(&s_crypto_ds_lock);
|
||||
}
|
||||
#endif /* SOC_DIG_SIGN_SUPPORTED */
|
||||
|
||||
#if defined(SOC_SHA_SUPPORTED) && defined(SOC_AES_SUPPORTED)
|
||||
void esp_crypto_sha_aes_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_sha_aes_lock);
|
||||
@@ -74,7 +93,21 @@ void esp_crypto_sha_aes_lock_release(void)
|
||||
{
|
||||
_lock_release(&s_crypto_sha_aes_lock);
|
||||
}
|
||||
#endif /* defined(SOC_SHA_SUPPORTED) && defined(SOC_AES_SUPPORTED) */
|
||||
|
||||
#if defined(SOC_SHA_CRYPTO_DMA) && defined(SOC_AES_CRYPTO_DMA)
|
||||
void esp_crypto_dma_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_sha_aes_lock);
|
||||
}
|
||||
|
||||
void esp_crypto_dma_lock_release(void)
|
||||
{
|
||||
_lock_release(&s_crypto_sha_aes_lock);
|
||||
}
|
||||
#endif /* defined(SOC_SHA_CRYPTO_DMA) && defined(SOC_AES_CRYPTO_DMA) */
|
||||
|
||||
#ifdef SOC_MPI_SUPPORTED
|
||||
void esp_crypto_mpi_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_mpi_lock);
|
||||
@@ -84,7 +117,9 @@ void esp_crypto_mpi_lock_release(void)
|
||||
{
|
||||
_lock_release(&s_crypto_mpi_lock);
|
||||
}
|
||||
#endif /* SOC_MPI_SUPPORTED */
|
||||
|
||||
#ifdef SOC_ECC_SUPPORTED
|
||||
void esp_crypto_ecc_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_ecc_lock);
|
||||
@@ -94,21 +129,29 @@ void esp_crypto_ecc_lock_release(void)
|
||||
{
|
||||
_lock_release(&s_crypto_ecc_lock);
|
||||
}
|
||||
#endif /* SOC_ECC_SUPPORTED */
|
||||
|
||||
#ifdef SOC_ECDSA_SUPPORTED
|
||||
void esp_crypto_ecdsa_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_ecdsa_lock);
|
||||
esp_crypto_ecc_lock_acquire();
|
||||
#ifdef SOC_ECDSA_USES_MPI
|
||||
esp_crypto_mpi_lock_acquire();
|
||||
#endif /* SOC_ECDSA_USES_MPI */
|
||||
}
|
||||
|
||||
void esp_crypto_ecdsa_lock_release(void)
|
||||
{
|
||||
#ifdef SOC_ECDSA_USES_MPI
|
||||
esp_crypto_mpi_lock_release();
|
||||
#endif /* SOC_ECDSA_USES_MPI */
|
||||
esp_crypto_ecc_lock_release();
|
||||
_lock_release(&s_crypto_ecdsa_lock);
|
||||
}
|
||||
#endif /* SOC_ECDSA_SUPPORTED */
|
||||
|
||||
#ifdef SOC_KEY_MANAGER_SUPPORTED
|
||||
void esp_crypto_key_manager_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_key_manager_lock);
|
||||
@@ -118,3 +161,4 @@ void esp_crypto_key_manager_lock_release(void)
|
||||
{
|
||||
_lock_release(&s_crypto_key_manager_lock);
|
||||
}
|
||||
#endif /* SOC_KEY_MANAGER_SUPPORTED */
|
@@ -16,12 +16,10 @@ static inline void esp_crypto_dpa_set_level(esp_crypto_dpa_sec_level_t level)
|
||||
REG_SET_FIELD(HP_SYSTEM_SEC_DPA_CONF_REG, HP_SYSTEM_SEC_DPA_LEVEL, level);
|
||||
}
|
||||
|
||||
#if CONFIG_ESP_CRYPTO_DPA_PROTECTION_AT_STARTUP
|
||||
static void __attribute__((constructor)) esp_crypto_dpa_protection_startup(void)
|
||||
void esp_crypto_dpa_protection_startup(void)
|
||||
{
|
||||
esp_crypto_dpa_set_level(CONFIG_ESP_CRYPTO_DPA_PROTECTION_LEVEL);
|
||||
}
|
||||
#endif
|
||||
|
||||
void esp_crypto_dpa_protection_enable(esp_crypto_dpa_sec_level_t level)
|
||||
{
|
||||
@@ -32,8 +30,3 @@ void esp_crypto_dpa_protection_disable(void)
|
||||
{
|
||||
REG_CLR_BIT(HP_SYSTEM_SEC_DPA_CONF_REG, HP_SYSTEM_SEC_DPA_CFG_SEL);
|
||||
}
|
||||
|
||||
void esp_crypto_dpa_prot_include_impl(void)
|
||||
{
|
||||
// Linker hook, exists for no other purpose
|
||||
}
|
@@ -163,7 +163,8 @@ esp_err_t esp_hmac_calculate(hmac_key_id_t key_id,
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
static ets_efuse_block_t convert_key_type(hmac_key_id_t key_id) {
|
||||
static ets_efuse_block_t convert_key_type(hmac_key_id_t key_id)
|
||||
{
|
||||
return ETS_EFUSE_BLOCK_KEY0 + (ets_efuse_block_t) key_id;
|
||||
}
|
||||
|
||||
@@ -172,8 +173,9 @@ esp_err_t esp_hmac_jtag_enable(hmac_key_id_t key_id, const uint8_t *token)
|
||||
int ets_status;
|
||||
esp_err_t err = ESP_OK;
|
||||
|
||||
if ((!token) || (key_id >= HMAC_KEY_MAX))
|
||||
if ((!token) || (key_id >= HMAC_KEY_MAX)) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/* Check if JTAG is permanently disabled by HW Disable eFuse */
|
||||
if (esp_efuse_read_field_bit(JTAG_STATUS_BIT)) {
|
||||
@@ -224,7 +226,8 @@ esp_err_t esp_hmac_jtag_disable()
|
||||
}
|
||||
#else /* !CONFIG_IDF_TARGET_ESP32S2 */
|
||||
|
||||
static ets_efuse_block_t convert_key_type(hmac_key_id_t key_id) {
|
||||
static ets_efuse_block_t convert_key_type(hmac_key_id_t key_id)
|
||||
{
|
||||
return ETS_EFUSE_BLOCK_KEY0 + (ets_efuse_block_t) key_id;
|
||||
}
|
||||
|
||||
@@ -234,8 +237,12 @@ esp_err_t esp_hmac_calculate(hmac_key_id_t key_id,
|
||||
uint8_t *hmac)
|
||||
{
|
||||
int hmac_ret;
|
||||
if (!message || !hmac) return ESP_ERR_INVALID_ARG;
|
||||
if (key_id >= HMAC_KEY_MAX) return ESP_ERR_INVALID_ARG;
|
||||
if (!message || !hmac) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
if (key_id >= HMAC_KEY_MAX) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
esp_crypto_dma_lock_acquire();
|
||||
|
||||
@@ -257,8 +264,9 @@ esp_err_t esp_hmac_jtag_enable(hmac_key_id_t key_id, const uint8_t *token)
|
||||
int ets_status;
|
||||
esp_err_t err = ESP_OK;
|
||||
|
||||
if ((!token) || (key_id >= HMAC_KEY_MAX))
|
||||
if ((!token) || (key_id >= HMAC_KEY_MAX)) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/* Check if JTAG is permanently disabled by HW Disable eFuse */
|
||||
if (esp_efuse_read_field_bit(ESP_EFUSE_HARD_DIS_JTAG)) {
|
@@ -366,8 +366,7 @@ static esp_err_t key_mgr_recover_key(key_recovery_config_t *config)
|
||||
}
|
||||
ESP_LOGD(TAG, "HUK info valid");
|
||||
|
||||
if ((!key_mgr_hal_is_huk_valid()) || (!config->huk_recovered))
|
||||
{
|
||||
if ((!key_mgr_hal_is_huk_valid()) || (!config->huk_recovered)) {
|
||||
check_huk_risk_level();
|
||||
esp_err_t esp_ret = huk_hal_configure(ESP_HUK_MODE_RECOVERY, config->key_recovery_info->huk_info.info);
|
||||
if (esp_ret != ESP_OK) {
|
11
components/esp_security/src/esp_security_priv.h
Normal file
11
components/esp_security/src/esp_security_priv.h
Normal file
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/* Private interface file */
|
||||
|
||||
void esp_crypto_dpa_protection_startup(void);
|
24
components/esp_security/src/init.c
Normal file
24
components/esp_security/src/init.c
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "esp_private/startup_internal.h"
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_crypto_clk.h"
|
||||
#include "esp_security_priv.h"
|
||||
|
||||
ESP_SYSTEM_INIT_FN(esp_security_init, SECONDARY, BIT(0), 103)
|
||||
{
|
||||
esp_crypto_clk_init();
|
||||
#if CONFIG_ESP_CRYPTO_DPA_PROTECTION_AT_STARTUP
|
||||
esp_crypto_dpa_protection_startup();
|
||||
#endif
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
void esp_security_init_include_impl(void)
|
||||
{
|
||||
// Linker hook, exists for no other purpose
|
||||
}
|
7
components/esp_security/test_apps/.build-test-rules.yml
Normal file
7
components/esp_security/test_apps/.build-test-rules.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
# Documentation: .gitlab/ci/README.md#manifest-file-to-control-the-buildtest-apps
|
||||
|
||||
components/esp_security/test_apps/crypto_drivers:
|
||||
disable:
|
||||
- if: IDF_TARGET in ["esp32c61"]
|
||||
temporary: true
|
||||
reason: Support for ESP32C6 is yet to be added.
|
@@ -0,0 +1,10 @@
|
||||
# This is the project CMakeLists.txt file for the test subproject
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
set(COMPONENTS main)
|
||||
|
||||
set(EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/unit-test-app/components")
|
||||
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
|
||||
project(crypto_drivers)
|
@@ -0,0 +1,3 @@
|
||||
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
|
||||
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
|
||||
|
@@ -0,0 +1,8 @@
|
||||
set(srcs "test_app_main.c"
|
||||
"test_ds.c"
|
||||
"test_hmac.c"
|
||||
"test_key_mgr.c")
|
||||
|
||||
idf_component_register(SRCS ${srcs}
|
||||
REQUIRES unity efuse test_utils spi_flash esp_security
|
||||
WHOLE_ARCHIVE)
|
@@ -38,8 +38,6 @@ static const uint32_t test_messages[NUM_MESSAGES][3072/32] = {
|
||||
{ 0x08b2bdd7, 0xb9e4f5e9, 0x2298b215, 0xed9042e0, 0xd93a60dd, 0x14f08d95, 0xe9f669fe, 0x196b10fb, 0xceb6f5a5, 0xe19255c5, 0x1ebb83b2, 0xb4655473, 0xa6b79c9d, 0x88fe4dd9, 0x3546e18a, 0x6dc61f68, 0xc45d3b39, 0x061ee6ff, 0x9c85aaa3, 0x5ad24b87, 0x8ee06618, 0xc5292e42, 0x92bf8b73, 0x23124856, 0x85272862, 0xb284fbed, 0x6212d764, 0x7ee3f935, 0x3b386c35, 0xc694dd1f, 0xa6e068c2, 0xc8cad857, 0x5efd0a73, 0xceec5084, 0xfbb88a02, 0xb09d042d, 0x4e45d49f, 0xb430b6e7, 0xc63934a8, 0x212701f8, 0x6220074a, 0xd88103c3, 0x3312698b, 0x4e0bd933, 0x37b85cbd, 0x2cd97e09, 0x5014b36e, 0x57c8399f, 0xa6427d45, 0x57381c5d, 0x689adc4b, 0x48f893c3, 0x40b902a1, 0x130048cd, 0xa158e363, 0xf3a58a8a, 0x6b3ea545, 0xd6b51dc4, 0xe65db148, 0x5bf8ad29, 0x44257142, 0x92e0deb9, 0xb9cfbe30, 0x83b5cc31, 0x401feebc, 0x70d8ed1a, 0x6a77f25b, 0xed4bb4ba, 0x6a69e8a3, 0xe72c1f3a, 0xf9f67b2d, 0x64a13cdd, 0xc3268e68, 0xa5a33132, 0x6b10626a, 0xb48a00a3, 0xffc1ab2e, 0x4ae98114, 0xf571d6d5, 0x1c068302, 0xca5fe2a9, 0xc7f43921, 0x5b82d397, 0x43a210b2, 0x7b58af9e, 0x6232c22a, 0xc51f2306, 0xfcd5d566, 0x76c5e2e7, 0x8b77942e, 0xd9323119, 0xe3eb7011, 0xe8a1bc8e, 0xc02bf571, 0x90799da8, 0x76f308ea },
|
||||
};
|
||||
|
||||
|
||||
|
||||
#define NUM_CASES 6
|
||||
|
||||
static const encrypt_testcase_t test_cases[NUM_CASES] = {
|
||||
@@ -66,7 +64,8 @@ static const encrypt_testcase_t test_cases[NUM_CASES] = {
|
||||
{ 0x3091af00, 0x3e88a63f, 0xc1e5a42e, 0xef4136ab, 0x019914f4, 0xe5679a1d, 0x53398d88, 0x0adbfe54, 0x18b045db, 0xc192c25a, 0x42d66a41, 0x44fe7c2f, 0x24c949c3, 0x9a9a1a24, 0x72a30041, 0x1d4d0c7f, 0xda007af0, 0x0f8ebd86, 0x9d75b6d6, 0x63c92aff, 0x43689bcb, 0xbe3c99be, 0xec00e4b6, 0x3c1b6d9e, 0x09e61956, 0xe32bc167, 0xeef7d112, 0xa5b6aaca, 0xd4920f01, 0x9d2a805f, 0x045b38ff, 0xf85b8e76, 0xcd5eb94d, 0x65a26556, 0xc67f6cd8, 0xc0b8e974, 0x7d82557e, 0xd9818bbd, 0xeb5ba0fb, 0x5c9a90f0, 0xed2b3d8c, 0x2c4012b0, 0xaaa83528, 0x27f8ca81, 0x1fa868eb, 0xf6f1ffd8, 0x0ebb2a64, 0x65f33892, 0xa83b6286, 0xdc8f84e7, 0x0082e31f, 0xa94c437a, 0x273e38dd, 0x18cbba3e, 0x33d142c1, 0x9652fa61, 0x38c770ef, 0x456110a9, 0x1cc26e20, 0x35440d20, 0x2bc8c13f, 0x934c3e3b, 0xc7592d8a, 0x4ff51143, 0xd528f834, 0x08a081b2, 0x008da561, 0xf66f5ad5, 0x304ef7ba, 0x4cbb841b, 0xafc3093f, 0x8f4f2bcd, 0x0dd051cc, 0xfd9cdd1b, 0x3171189c, 0x1690ca02, 0x3e6fbbd7, 0x0c2a98b5, 0x1362d451, 0x7e2edb82, 0x33e6eeed, 0x4e71a3a6, 0xf51d3acc, 0x444e4e06, 0xeb50c285, 0x66881abb, 0x2d3690f8, 0x574b7709, 0xe6e57584, 0x16c95cae, 0xba2dbd54, 0x5a5d693a, 0xc823016c, 0xf0089ae6, 0x415e0902, 0x67c1b0c1 }, // Message 7
|
||||
{ 0x7e8b2e2a, 0x289b46a4, 0xa6a37b8c, 0xc567df73, 0x55018796, 0x4e9d9d18, 0x0d31eb7e, 0x5d74d159, 0x841ebae2, 0xe1973167, 0xd61418e6, 0x5cb89cbc, 0x1acb9a42, 0xf82e0e7f, 0x05e631bc, 0xba43f7f9, 0xd79c942b, 0x16628593, 0xcbb9d614, 0x8614cc8b, 0xf7945887, 0xca968cfe, 0x5b92abbf, 0x18abb020, 0x4ca4d94d, 0x652b2efd, 0xb38d885c, 0xd727ce25, 0xd0accfb8, 0x8b1498c4, 0xa9788ae1, 0x87b60400, 0x72ee888c, 0x3cc8b5be, 0xd01b4fda, 0xe4214afd, 0xd709bd20, 0xe17b0353, 0x7fffe766, 0x1cf3c00e, 0x1ba37716, 0x0e412e6e, 0xcfe26c33, 0xd4e73eef, 0xcfe108b0, 0x9da923e4, 0xf309b4f6, 0xf7553306, 0x96001a08, 0x18392a1e, 0x10f14241, 0x1c5b6398, 0xe14efe32, 0xa1fa1f3d, 0xd30a00e3, 0x2220b1b5, 0xd21b950f, 0xffbe55a0, 0xab511ea4, 0x1d508c36, 0x11766260, 0x93f08d28, 0x2b55f5d2, 0x3b31e88a, 0x901cc723, 0xffb83098, 0x0cc75b00, 0xfdf6ddfa, 0x8c61275f, 0x7c3d5f35, 0x6e947893, 0x8d78a4ef, 0x3715a9b2, 0x5df48a9b, 0xced6b5ac, 0xc365d317, 0xf0751afa, 0x51b70a61, 0xb961f7ab, 0x00e2ec20, 0xddc4bcd5, 0x3575bb7c, 0xfc3e41e6, 0xabd80278, 0x560cd8db, 0x37c6f978, 0xbecaf8b6, 0x8e9370b8, 0x6e419061, 0x123a0d8e, 0xafc8bf2f, 0x110335cb, 0x0e2dd6ff, 0xdff2ac5b, 0xc4c40ded, 0x71c828d5 }, // Message 8
|
||||
{ 0x5f4d6c0f, 0x07cbb6c0, 0xc5d29098, 0xaa4b7646, 0x9ad67706, 0xc24cb90a, 0x0e3b474d, 0x570aa38b, 0x609c6eea, 0x35acb442, 0xfb4ecb48, 0xc0bca95d, 0xca13fb93, 0xce8c161c, 0xcb587f70, 0x5be94979, 0xa8d864f1, 0x46d3a2cd, 0x376e1880, 0xed9e9acc, 0xad3671d8, 0xf07acd26, 0xd4fcd4b2, 0x8592f218, 0x4215a2ee, 0xeba03531, 0x5979f6e3, 0xce0435fa, 0xda72ea66, 0x02503771, 0x9734cb8d, 0x7ecc8a3a, 0x5b7e0c2f, 0x952a10c9, 0xbb8ac3e7, 0x07691411, 0x6a4ec582, 0x5720909f, 0x6dfbd1f8, 0x87a2ade8, 0x4fa2084c, 0x47cef5ef, 0x68295cb4, 0xf126dd97, 0x147ad2d0, 0x8350c426, 0x5f996e6e, 0xb984046f, 0xdfe837e9, 0xc90ba36b, 0x74f4144c, 0x96b87bf6, 0x2a854c34, 0x4aecade4, 0x51262c73, 0x59ef8591, 0x5e8a1852, 0xb18e1501, 0x96fb63a7, 0x99766d88, 0x4eae8963, 0xdc86ecbe, 0x394414c8, 0x4b680710, 0xf1f31913, 0x44decb2a, 0xbc328965, 0xeb85a7a5, 0x3123199b, 0x029a3109, 0xf7ff3e08, 0x6624ddd6, 0x25f6bc05, 0x1dafd418, 0x0d07a121, 0x3c8c10aa, 0x0d367ea7, 0xbc97bccc, 0x4c3c5bd0, 0x6a412808, 0xdd549ed9, 0xeac0470f, 0x9bab1f29, 0x22fcbbf9, 0x844313ad, 0x020ad2d7, 0x738d245d, 0x0e0de0e0, 0x7ca6cb06, 0x02c4cc89, 0x8bf7b00b, 0x3b19f999, 0xd8acac9d, 0xdba5a5c7, 0x79e558bd, 0x98cdad76 }, // Message 9
|
||||
{ 0x3cb7cf11, 0xa6105ab5, 0xab76fba2, 0x83b390f6, 0x2c8b342f, 0x067cb33b, 0x1408d6ee, 0x11fac21f, 0x3acf1455, 0x0b5a24b0, 0xfd77a460, 0x94c6fd74, 0x58f4b525, 0xf942d753, 0x66cc39a2, 0x49c9739e, 0x6403a808, 0xc991f39f, 0x32b96bad, 0x251f2197, 0x39e921b7, 0x0678add2, 0xeea0ac3b, 0x73ca6627, 0xb471fc30, 0x5a3af2cd, 0x2e295cb3, 0xf69dabd3, 0xe91b9a66, 0x3a22cfcd, 0xc19a3cac, 0x6558aa8a, 0x1d35ee0e, 0x3fe4bbbc, 0xa502e579, 0xeef25dd8, 0x852ee0e2, 0x691a50b6, 0xc24f814b, 0x4057d02e, 0x1a7027c2, 0x940128ca, 0xe524bd60, 0xdfc42a34, 0x5c660828, 0x625f0bc0, 0x0736e130, 0xdb1f4eb8, 0x93dd97bb, 0xab978162, 0xa892631e, 0x32344a00, 0x422976a3, 0x25779ed5, 0xb7320ebd, 0x24ae7deb, 0xff1f30e1, 0x90a022e1, 0xb553ada7, 0x3a00c75d, 0x3b14b336, 0x80ac9445, 0x76b35ce5, 0x825a665d, 0x4e1e0923, 0x0c69aebc, 0x3e15c3e6, 0x1bca6e19, 0x1cfeef07, 0xe174c35c, 0x4fbda286, 0x2c7bbf73, 0x96f754dc, 0x5c63252a, 0x95c04e0d, 0x77ca359a, 0xc18676fb, 0x3da32215, 0xc2e9e2af, 0xdc786295, 0x37b467e6, 0x2de4b870, 0x981d8fcb, 0x1c55875a, 0x25b97c90, 0xcffc9df3, 0xf8f07656, 0xfc55a341, 0x7df87dfe, 0x075a4077, 0xd0c81ca3, 0xd3d4b477, 0x3ac9b98f, 0xad6ddd0c, 0x0887bc80, 0x8a4211d9 }, },
|
||||
{ 0x3cb7cf11, 0xa6105ab5, 0xab76fba2, 0x83b390f6, 0x2c8b342f, 0x067cb33b, 0x1408d6ee, 0x11fac21f, 0x3acf1455, 0x0b5a24b0, 0xfd77a460, 0x94c6fd74, 0x58f4b525, 0xf942d753, 0x66cc39a2, 0x49c9739e, 0x6403a808, 0xc991f39f, 0x32b96bad, 0x251f2197, 0x39e921b7, 0x0678add2, 0xeea0ac3b, 0x73ca6627, 0xb471fc30, 0x5a3af2cd, 0x2e295cb3, 0xf69dabd3, 0xe91b9a66, 0x3a22cfcd, 0xc19a3cac, 0x6558aa8a, 0x1d35ee0e, 0x3fe4bbbc, 0xa502e579, 0xeef25dd8, 0x852ee0e2, 0x691a50b6, 0xc24f814b, 0x4057d02e, 0x1a7027c2, 0x940128ca, 0xe524bd60, 0xdfc42a34, 0x5c660828, 0x625f0bc0, 0x0736e130, 0xdb1f4eb8, 0x93dd97bb, 0xab978162, 0xa892631e, 0x32344a00, 0x422976a3, 0x25779ed5, 0xb7320ebd, 0x24ae7deb, 0xff1f30e1, 0x90a022e1, 0xb553ada7, 0x3a00c75d, 0x3b14b336, 0x80ac9445, 0x76b35ce5, 0x825a665d, 0x4e1e0923, 0x0c69aebc, 0x3e15c3e6, 0x1bca6e19, 0x1cfeef07, 0xe174c35c, 0x4fbda286, 0x2c7bbf73, 0x96f754dc, 0x5c63252a, 0x95c04e0d, 0x77ca359a, 0xc18676fb, 0x3da32215, 0xc2e9e2af, 0xdc786295, 0x37b467e6, 0x2de4b870, 0x981d8fcb, 0x1c55875a, 0x25b97c90, 0xcffc9df3, 0xf8f07656, 0xfc55a341, 0x7df87dfe, 0x075a4077, 0xd0c81ca3, 0xd3d4b477, 0x3ac9b98f, 0xad6ddd0c, 0x0887bc80, 0x8a4211d9 },
|
||||
},
|
||||
},
|
||||
{ /* Case 1 */
|
||||
.iv = { 0x1a, 0x74, 0x1a, 0x0d, 0x12, 0x6a, 0x41, 0x95, 0xad, 0x9d, 0xcf, 0x50, 0x36, 0xcd, 0xd2, 0x2f },
|
||||
@@ -91,7 +90,8 @@ static const encrypt_testcase_t test_cases[NUM_CASES] = {
|
||||
{ 0xec64ca3c, 0x3678f40f, 0xe3d00448, 0x8404a50a, 0x101223df, 0x1aaa5b1e, 0x5f64bec9, 0x5d0ea2d2, 0x56a60d03, 0x13a8b3bb, 0x1c3e9a21, 0xf35e9061, 0xabe87d10, 0x21ee3db4, 0x7bed23da, 0x85bc8040, 0xfe8526cd, 0x8d23fec0, 0x8688adce, 0x007978c9, 0xa93f75f5, 0xaecc2565, 0x60fa222a, 0x6c3dca6e, 0x56a91183, 0xab8afb43, 0x8ddf1e0d, 0x94fbcbee, 0x255d9618, 0x3ee98bbc, 0x1ff43eb2, 0xfdb7edd7, 0xd352a38e, 0x82f977f3, 0x50873873, 0x12678596, 0x973fed11, 0xcf419c3b, 0xff80eb70, 0x56bf5e82, 0x3e45e09e, 0x20104ca2, 0xb350417e, 0xf7ba8440, 0xef3f6adc, 0x86077d78, 0xe63480fb, 0xcdb5f14b, 0x604e3b49, 0x82bb1259, 0x99764293, 0x7276ec12, 0x03d28b92, 0x324ff0c3, 0x95c31851, 0xd3d5d247, 0xbabf0578, 0x642bb38b, 0x62188f4c, 0x93ce0c9e, 0x1bfb9d63, 0xdd5d248c, 0x2316198e, 0x072e73f7 }, // Message 7
|
||||
{ 0x00a3e1e2, 0x66ce9c3b, 0x0d21bcea, 0xc051866e, 0x7e25880c, 0x5e17f3f7, 0x3e7925e8, 0x04b1d12a, 0xf11510d6, 0xafc765d6, 0x4532e9c6, 0x6939cee0, 0x2634d48b, 0xa03e3cb6, 0x060d39ad, 0xe2a95e89, 0x856f7fba, 0xcb429a2f, 0xfb2c2ce1, 0x8d950c85, 0x508af1f4, 0xfbdf22cf, 0x6b7258ab, 0x36bd4d6e, 0x55603283, 0x235e2a6d, 0xe3faff0c, 0xb8b0dbef, 0x7cd8a9be, 0x1de43b98, 0xf3ed9652, 0x1a5451e6, 0xa33a57bb, 0xc09ea9b6, 0x3d882bb0, 0xb3bc50f2, 0xd14e9fe5, 0xe123aa3a, 0x42a552b5, 0x3e675022, 0x78362ba8, 0x1d85e30f, 0xdcbe7506, 0xc5916a41, 0x55508d5f, 0x55f3fe0c, 0x988e98fd, 0x57ca4d0e, 0xa10feaef, 0x7e457772, 0xe71324cc, 0x499dff0c, 0x59200869, 0x7748d113, 0x049f9382, 0x3a27952a, 0x11e88cda, 0x9f0be192, 0x91a5336e, 0x65baea68, 0xa6185492, 0x51e9990b, 0x654144a9, 0x8af5b175 }, // Message 8
|
||||
{ 0x62c3edd8, 0x6fe563b4, 0xb55f8c9d, 0xeb212894, 0x544f427b, 0xdde12726, 0x25f49372, 0x58f31f93, 0xedae370a, 0x8bd35034, 0xe354465d, 0x734ffaf6, 0xecf5a0ce, 0x90d132ae, 0xdae05950, 0x4a98c3da, 0x22816397, 0x76cd5223, 0x959de8ce, 0xa6c70b75, 0x27f32d4b, 0x9b3b0e33, 0x25fb512a, 0xbd2bd4cd, 0x05b35f37, 0x88d625ea, 0x01f015a7, 0x703fe63e, 0x26a82c25, 0x58e42a0d, 0xe1a36751, 0x3a407afb, 0xccbfedd9, 0x6ccc2afd, 0x64a91a52, 0xcce659f6, 0x21bd8b9a, 0x70bafab3, 0x0bf349ef, 0xbc9ca563, 0x773eb021, 0xbdf4b1da, 0xc5d38991, 0x7f571195, 0x68c85949, 0x85a54e7e, 0x2af5550a, 0xd22049e4, 0x2e349d14, 0x44e65417, 0x74d2fcb3, 0xf476c998, 0x3a9ba228, 0xc172a514, 0x90c7c270, 0xd79c9b83, 0x831ae841, 0x3a7f9283, 0x372bae1d, 0xae1a6eeb, 0xbb459f0e, 0x0f6dafa7, 0x76d9fddc, 0x5cc22a15 }, // Message 9
|
||||
{ 0x70f405b7, 0x465029b2, 0x077202c6, 0xd31c7f2b, 0xd190f66b, 0xb9dc1726, 0xe5fca329, 0xac39c8c0, 0xf4404de0, 0x7ceb2dae, 0xe6e76432, 0xb3f0da25, 0xdf2dfbac, 0x3fe0d5e6, 0x10250326, 0xb5a89d4b, 0x26e384c9, 0x94bf486a, 0xb83a42ed, 0x6a7584dc, 0xdbba6ce6, 0x0dc2a4b0, 0xfc1ec776, 0xa9e7207e, 0x3321d690, 0xd67dcff8, 0xfa440ece, 0x2cbe27e0, 0xae3b3f56, 0x01ad071f, 0x25e3f648, 0x2c09f3f9, 0x504061a4, 0x5e1d77b7, 0x48858bfc, 0x9c05d8cf, 0x57eab353, 0x10a7809f, 0xf28e5ff9, 0xe1e06bbf, 0xa483c0b6, 0x0bb3e25a, 0xb32a6b03, 0x81e6d0bf, 0x64cc457a, 0xbb514952, 0x84b0b2ea, 0x9b7f44f5, 0x14b1f423, 0x93614063, 0xb75e831d, 0xae508c35, 0x07d9de51, 0xcb5a9404, 0xca5593bf, 0xd3a6f1c8, 0xfe0578ca, 0xbc175972, 0xf83c64cf, 0xfb612553, 0xebb70016, 0x0ded9f6e, 0xc12eb1e9, 0x90d391d3 }, },
|
||||
{ 0x70f405b7, 0x465029b2, 0x077202c6, 0xd31c7f2b, 0xd190f66b, 0xb9dc1726, 0xe5fca329, 0xac39c8c0, 0xf4404de0, 0x7ceb2dae, 0xe6e76432, 0xb3f0da25, 0xdf2dfbac, 0x3fe0d5e6, 0x10250326, 0xb5a89d4b, 0x26e384c9, 0x94bf486a, 0xb83a42ed, 0x6a7584dc, 0xdbba6ce6, 0x0dc2a4b0, 0xfc1ec776, 0xa9e7207e, 0x3321d690, 0xd67dcff8, 0xfa440ece, 0x2cbe27e0, 0xae3b3f56, 0x01ad071f, 0x25e3f648, 0x2c09f3f9, 0x504061a4, 0x5e1d77b7, 0x48858bfc, 0x9c05d8cf, 0x57eab353, 0x10a7809f, 0xf28e5ff9, 0xe1e06bbf, 0xa483c0b6, 0x0bb3e25a, 0xb32a6b03, 0x81e6d0bf, 0x64cc457a, 0xbb514952, 0x84b0b2ea, 0x9b7f44f5, 0x14b1f423, 0x93614063, 0xb75e831d, 0xae508c35, 0x07d9de51, 0xcb5a9404, 0xca5593bf, 0xd3a6f1c8, 0xfe0578ca, 0xbc175972, 0xf83c64cf, 0xfb612553, 0xebb70016, 0x0ded9f6e, 0xc12eb1e9, 0x90d391d3 },
|
||||
},
|
||||
},
|
||||
{ /* Case 2 */
|
||||
.iv = { 0xf8, 0x40, 0x6d, 0xc2, 0x14, 0xcf, 0x51, 0xfa, 0xba, 0x22, 0x6c, 0x84, 0x62, 0xe8, 0x55, 0x1f },
|
||||
@@ -116,7 +116,8 @@ static const encrypt_testcase_t test_cases[NUM_CASES] = {
|
||||
{ 0xf9c1f8c3, 0xa9cab7eb, 0x5c4bf6b0, 0x72b5fc95, 0xc135d95a, 0x9a0e9274, 0x7e5f01c9, 0x96f545f1, 0x75f80b45, 0xa4e86727, 0x83726459, 0x202c1901, 0xcd7501cf, 0x6645988c, 0x001fcf80, 0xcdc47212, 0x00c1eb3d, 0x46325c5f, 0x2dbfce7c, 0xe1abcf75, 0x3383ff3c, 0x2eea981f, 0x8575e22c, 0x328364d3, 0x2e9e4f77, 0x29699d6f, 0x87553675, 0x680c6dd5, 0xd13cefb1, 0xe1d92518, 0x96f6d4fb, 0x1f77b77d }, // Message 7
|
||||
{ 0x5c87dd11, 0x15c93747, 0xbcfe22f1, 0x21dd758d, 0xef45f74c, 0x5ee8ecd6, 0xadf3bd88, 0xf121ac92, 0xc9f2ecf2, 0xb15dc716, 0xdbc9e90f, 0xc806ffdb, 0x847ab647, 0xeb332783, 0x58cc1ae1, 0xe6141bc3, 0xda692ef1, 0xbd34d333, 0x6f132b8e, 0x628bc926, 0xfd5b168d, 0xc0ea4851, 0x51e30761, 0x6acdefad, 0x445084b7, 0x951871b7, 0x36224984, 0xfcaaf34a, 0x63e22ba1, 0xdb08fa93, 0x4d6e1866, 0x484a40b7 }, // Message 8
|
||||
{ 0x865fa089, 0x79f6170d, 0xf418880c, 0xa20da1bd, 0xf76f4041, 0xbc53972d, 0xeaa4560f, 0x39dd7056, 0x43dd5a60, 0xfaffb757, 0x8e8f2e2e, 0xb1ebb81d, 0xe5a114d3, 0xe0420859, 0x37b94b75, 0x7edf1b31, 0x1a7c257f, 0xfed4fd79, 0xbfa6a733, 0x1ef1f749, 0xe3798bf5, 0xa3c4e95b, 0xaaeae176, 0xb413d684, 0xcfafb071, 0xfd8cfa58, 0x42144301, 0x221408ce, 0x7d191498, 0xfff720b2, 0x80ed8829, 0x939da9d6 }, // Message 9
|
||||
{ 0x98059557, 0x487b9a53, 0x1fe77a9f, 0x2f04419c, 0x1e25f53c, 0x85824732, 0x2f2a2a6b, 0x6784ce75, 0xc7a6e268, 0x167c1182, 0x330ad69c, 0x0c5bb9db, 0xaa23d157, 0xce49071a, 0x5bb53063, 0x76dc0f9d, 0xa4c01941, 0x38961aef, 0xdc7281c1, 0x22ae6c1d, 0xe3c0e5cb, 0xa01e3dd9, 0xdfef9f3c, 0x9dcdbcdb, 0xba7c9d06, 0x01258f94, 0x9603960e, 0x7bd2480f, 0x0a73d886, 0xb9dc2b12, 0x324e7747, 0x0b2fbdb9 }, },
|
||||
{ 0x98059557, 0x487b9a53, 0x1fe77a9f, 0x2f04419c, 0x1e25f53c, 0x85824732, 0x2f2a2a6b, 0x6784ce75, 0xc7a6e268, 0x167c1182, 0x330ad69c, 0x0c5bb9db, 0xaa23d157, 0xce49071a, 0x5bb53063, 0x76dc0f9d, 0xa4c01941, 0x38961aef, 0xdc7281c1, 0x22ae6c1d, 0xe3c0e5cb, 0xa01e3dd9, 0xdfef9f3c, 0x9dcdbcdb, 0xba7c9d06, 0x01258f94, 0x9603960e, 0x7bd2480f, 0x0a73d886, 0xb9dc2b12, 0x324e7747, 0x0b2fbdb9 },
|
||||
},
|
||||
},
|
||||
{ /* Case 3 */
|
||||
.iv = { 0x07, 0x26, 0x01, 0x00, 0x07, 0x30, 0x8f, 0x4b, 0x20, 0x54, 0x05, 0x88, 0xcb, 0xf6, 0x05, 0xe5 },
|
||||
@@ -141,7 +142,8 @@ static const encrypt_testcase_t test_cases[NUM_CASES] = {
|
||||
{ 0x191fa132, 0xec529575, 0xd350bc5a, 0x1dd01a08, 0x464fbc64, 0x3030ef77, 0xd3ae8199, 0x3a93d837, 0x95ba1b2d, 0x87281d33, 0xc71b420f, 0x0f869a92, 0x9395277d, 0x265f9014, 0x7ca1dcc2, 0x3a8aa517, 0x8ca06b79, 0x935d8c7f, 0x9846142c, 0x7fd38710, 0xa213679f, 0xccb22b7d, 0xfced5250, 0xe2ee7998, 0x1b74127d, 0x98b6f139, 0xa7b8d576, 0x795743f3, 0x003ca859, 0x98e4ff16, 0x865e5d7b, 0xc58ff71b, 0x51dd5f7c, 0x77d45d59, 0xdef44b51, 0x35ee735f, 0xbb2fd64e, 0x14ecc9f9, 0xee26206f, 0x16c40a0b, 0xe26da793, 0xe0ed59c4, 0x28cca504, 0xf8ad4257, 0xf7176ec4, 0xc305229c, 0xab835cf0, 0xb96f092f, 0x19ffd5b7, 0xb8316374, 0xb4cb7fe8, 0x5a433227, 0xb719f9a5, 0x03457109, 0x72b4e00a, 0x99cf6b58, 0xab3851f9, 0xbf07ee85, 0x9ee9abe6, 0xe610c900, 0x25b37bde, 0x8eee2d7d, 0xad082045, 0xa678a249, 0x1c74f6b7, 0x642b8c51, 0xee633a06, 0xe46bafc2, 0x5b257036, 0x08018ca6, 0xab2af844, 0x29febacc, 0x3eeae805, 0xc03721c0, 0x1650b290, 0xa8e2073c, 0x55f64445, 0x1fb6cf2b, 0x84b242de, 0x18a68269, 0x35c4e174, 0xa128d976, 0x19ef3319, 0xa23db9e1, 0x8d676a01, 0x86304fbb, 0x1066317e, 0x9e7029d3, 0x032cd540, 0x956f4738, 0x55241be1, 0x9e8331ba, 0xf929c836, 0x6d6209fe, 0x2a5b1d9e, 0x16c37c16 }, // Message 7
|
||||
{ 0xdb1c9a9c, 0x5deff40c, 0xb3373d4c, 0x9d628ea4, 0xd12262b6, 0xcbe805eb, 0xa0477188, 0x96ec467a, 0xea0884a7, 0x87e2cd54, 0x25617ab9, 0x7e9d0276, 0x7f796d2a, 0xc8d0eb0a, 0xf1e23aca, 0x471a4455, 0x50d35ea4, 0x633d0a89, 0xa6ebd368, 0xde3ad74d, 0x2774b9e0, 0xefb2422a, 0x23aa3274, 0x2bb5823a, 0xe654ffb5, 0xfaf11941, 0x0735094a, 0x623fe270, 0xd0605432, 0xb5f362e7, 0xd7e65ae9, 0x34332131, 0x4ed4ce90, 0xfd0d83aa, 0x125f0267, 0x566ac135, 0xe141ba65, 0x5213145f, 0xa46299ad, 0x75c5de69, 0x02d2d762, 0x2486b2af, 0x9aef897c, 0x4de5a642, 0xb56e1a99, 0x6a349e07, 0x219ee3b1, 0x7ad30cf9, 0x231e1d02, 0xc4ffb405, 0xecb691d7, 0xdba127a1, 0x453fed84, 0xb1a70dcc, 0xb0a31df7, 0xec814977, 0x2e1fbc59, 0x9811d77d, 0x1f6e8c8b, 0xe99e3675, 0x8057b8d7, 0xfe26053b, 0xca417fd1, 0x564ad062, 0x37d1df83, 0x77ad67bd, 0x9b60e003, 0x5b03ca19, 0x1d1d3c04, 0xa093d050, 0x35d1d54f, 0x0c212c6e, 0x8882c6b8, 0xc898c4e2, 0xd9c17559, 0xf502bac4, 0x279e8ae5, 0xa4f1aab6, 0x8301bab1, 0x743c84c4, 0xd5822a78, 0xb0af1dab, 0x2734861a, 0x68ba0d30, 0x402d8daf, 0xa63e25b6, 0xfe7060fb, 0xc8175ac8, 0xdff77344, 0xf3e5abc4, 0xfeb0c548, 0x9c409afd, 0xf451d5f5, 0x27861421, 0xc00dfe2a, 0x07e603fd }, // Message 8
|
||||
{ 0x79341110, 0x3eaa9a3e, 0x3c085c32, 0xb1a1add1, 0x11bbcfe1, 0xf70a0bc3, 0x988de2e3, 0x8cfecb83, 0x82a40d9c, 0xa1593ce9, 0x8ed03d21, 0xf3b8c633, 0x43d85b47, 0x878a92f3, 0x4d74b0b9, 0x976e8c95, 0x276d1d83, 0x7e0204d0, 0xc6718b91, 0xcb38068d, 0x1f8da0cc, 0x50c1b479, 0xff7f188b, 0xff1ab5d9, 0x46d9e9de, 0xaad3e1c1, 0x276f355f, 0x59f71ebe, 0x59bf872f, 0x00400dde, 0xe1e9eefa, 0x977098de, 0x309bf8bd, 0xeadcac01, 0x1ea8a66d, 0x62f2d4c6, 0x891afc3a, 0x4f3b0951, 0xdf2dd664, 0xe86f4b73, 0x1f1e1661, 0xe387443b, 0x1213e4cd, 0x45a5c758, 0x4b41af3d, 0x3b0b41dc, 0xab8f30c0, 0x17c6b450, 0x17e441f3, 0x455ba5e4, 0x0f21b9ee, 0x1aedcbcc, 0x2809d947, 0x39c30825, 0x7dc22fa6, 0x819098c1, 0x4ef74d7d, 0xa06d2712, 0xc80faaf2, 0xbd113791, 0x310fc8ec, 0x80d28dc1, 0x80fc8028, 0xa5f7868b, 0xd7f84266, 0xad7f7e1a, 0xb056eb1c, 0xe2405b9a, 0x6db21321, 0xe5d9cb1c, 0xfd0e9679, 0xb57560a8, 0x5b8a721b, 0xeb084e9f, 0x033fa371, 0xddd04527, 0x4c145eea, 0xa470244a, 0xc6eca4bb, 0x19aac9d1, 0x499c8362, 0xa19aee86, 0xac1bcd4c, 0xe23a4bad, 0xc1ee2115, 0x59e7f143, 0xed3917d8, 0xfc43b95f, 0xde31c771, 0x67f6ee54, 0xdc44c991, 0x4f1fe1de, 0x9cf4257e, 0x4ac95e18, 0x0676bc73, 0x6dc235f7 }, // Message 9
|
||||
{ 0xd1eb33f6, 0x927aa895, 0xc13d7b18, 0x20c54dd5, 0x21b7a967, 0x51d17dd6, 0x934d625d, 0x7437e19d, 0x5e1a4d84, 0x92722dcf, 0x3875608b, 0x536bb522, 0x8351e5e4, 0x74e732d1, 0x9edfec21, 0x2777d97c, 0x70df7f29, 0x6963e91c, 0x85391f32, 0x50ae8d40, 0xdf4af0a4, 0x1320f154, 0x56baaf09, 0xc90df7b2, 0x6fb6a16b, 0xf07c2cdd, 0x889aed44, 0x2540a3a9, 0xc81eb672, 0xc9b36b81, 0xf8f1f29d, 0x43faf5f2, 0x5f29013b, 0xfbb7e46c, 0x584c228b, 0x3b50bc1b, 0x9897c7fe, 0x0139e884, 0x243cd901, 0x76f81c72, 0x38f64dcb, 0x26db109a, 0xd7391f7a, 0x7bcd517f, 0xc72a5b4b, 0xb07f6e62, 0x40c01c5b, 0x7608fbeb, 0x0334fcb7, 0xe8ac74dc, 0x0478c091, 0x65a667f8, 0xf23a6d82, 0x488fa619, 0x471dc831, 0x54f3b664, 0x9f11e50d, 0x7ad8dd31, 0x3a7e9ba0, 0xc468fa21, 0x8dda1f65, 0x88b9d1fa, 0xeb9b57da, 0xcec0d814, 0x3456663b, 0x607418cf, 0x130fba8f, 0x64397053, 0x7b56732e, 0xa84f74e9, 0x353950d6, 0x8eb42599, 0xfe2c8159, 0xcc2a2650, 0x498862ae, 0xf7269bbc, 0xc62a4d59, 0xf3c1a9cd, 0xc79b25d3, 0x1fa0f53a, 0xc1187788, 0x874e3ad2, 0x38ddff67, 0x86a40e76, 0x2964e3ad, 0x835a1fa2, 0x3b7cb7de, 0x8f9737e4, 0xbc318a9c, 0x1f9fdbe9, 0x559a63c5, 0x4acbee44, 0x51d2a044, 0xdeed124e, 0x09fe623b, 0x78433ad2 }, },
|
||||
{ 0xd1eb33f6, 0x927aa895, 0xc13d7b18, 0x20c54dd5, 0x21b7a967, 0x51d17dd6, 0x934d625d, 0x7437e19d, 0x5e1a4d84, 0x92722dcf, 0x3875608b, 0x536bb522, 0x8351e5e4, 0x74e732d1, 0x9edfec21, 0x2777d97c, 0x70df7f29, 0x6963e91c, 0x85391f32, 0x50ae8d40, 0xdf4af0a4, 0x1320f154, 0x56baaf09, 0xc90df7b2, 0x6fb6a16b, 0xf07c2cdd, 0x889aed44, 0x2540a3a9, 0xc81eb672, 0xc9b36b81, 0xf8f1f29d, 0x43faf5f2, 0x5f29013b, 0xfbb7e46c, 0x584c228b, 0x3b50bc1b, 0x9897c7fe, 0x0139e884, 0x243cd901, 0x76f81c72, 0x38f64dcb, 0x26db109a, 0xd7391f7a, 0x7bcd517f, 0xc72a5b4b, 0xb07f6e62, 0x40c01c5b, 0x7608fbeb, 0x0334fcb7, 0xe8ac74dc, 0x0478c091, 0x65a667f8, 0xf23a6d82, 0x488fa619, 0x471dc831, 0x54f3b664, 0x9f11e50d, 0x7ad8dd31, 0x3a7e9ba0, 0xc468fa21, 0x8dda1f65, 0x88b9d1fa, 0xeb9b57da, 0xcec0d814, 0x3456663b, 0x607418cf, 0x130fba8f, 0x64397053, 0x7b56732e, 0xa84f74e9, 0x353950d6, 0x8eb42599, 0xfe2c8159, 0xcc2a2650, 0x498862ae, 0xf7269bbc, 0xc62a4d59, 0xf3c1a9cd, 0xc79b25d3, 0x1fa0f53a, 0xc1187788, 0x874e3ad2, 0x38ddff67, 0x86a40e76, 0x2964e3ad, 0x835a1fa2, 0x3b7cb7de, 0x8f9737e4, 0xbc318a9c, 0x1f9fdbe9, 0x559a63c5, 0x4acbee44, 0x51d2a044, 0xdeed124e, 0x09fe623b, 0x78433ad2 },
|
||||
},
|
||||
},
|
||||
{ /* Case 4 */
|
||||
.iv = { 0xc6, 0x09, 0xa6, 0x69, 0x05, 0xf2, 0x42, 0xa4, 0xd4, 0x92, 0x33, 0xc2, 0xe3, 0x09, 0x09, 0x56 },
|
||||
@@ -166,7 +168,8 @@ static const encrypt_testcase_t test_cases[NUM_CASES] = {
|
||||
{ 0x99f67aaf, 0x4599443a, 0xeaac250f, 0x64e642a5, 0xc90870ac, 0xfaad4d28, 0xcd7a418e, 0x8abe5c09, 0x54fdb68e, 0x5a690863, 0xc0244737, 0xcfb554ea, 0x19f591e3, 0xc63737c2, 0xfef6af07, 0x589d8e38, 0xd1792c9c, 0x5804026c, 0x62f0c6c8, 0x94f3dd2d, 0xc3078ba0, 0x00d87497, 0x54e1c383, 0x545bbdfb, 0x901d305f, 0xb1bcd27b, 0x9a7e39fd, 0x479d39dc, 0x1a41841d, 0x51336abf, 0xec4e7c5e, 0x025424aa, 0x0ac9809f, 0x11034663, 0x3c25c619, 0x40052b07, 0xec885c50, 0xcc54068d, 0xc83ba064, 0x3dc4224b, 0xeea736d7, 0xba652070, 0xcce7a1d5, 0x7cf447af, 0xc5758174, 0xee446e38, 0xb39bf8a3, 0x82034077, 0xc06e33fc, 0xb9f3a31c, 0x8cfda584, 0xb6eeb236, 0xc6f30415, 0x2d1319ef, 0x2adea19f, 0x9a5789ac, 0x276ba414, 0x82d564c3, 0x6c4e2ac9, 0x86efe4ca, 0xadf6a7c3, 0x49dffebd, 0x4ec9b334, 0x525cc81a }, // Message 7
|
||||
{ 0x2f8cc27e, 0x350875fb, 0x39dd5df5, 0x89b03399, 0x7061995d, 0xcdff4a8d, 0x8ad7164a, 0xa94b3d47, 0xa27a52df, 0x81defbc8, 0x3bcab908, 0xe1ab51aa, 0x5e255d58, 0xa86e03c0, 0xb12e7d2d, 0xeb4ddb39, 0xe0b20ff1, 0xa1a8a804, 0xa1e63720, 0x5cdf514c, 0x20470756, 0x80ff396e, 0xe1a222fb, 0x1416a149, 0xf107da73, 0xb1f7266e, 0x004b334e, 0xa48d77d3, 0x4f1c1163, 0x2026e047, 0x516e5e8c, 0xc2e3b1dd, 0xa92a39d9, 0xc9912ad5, 0xe2a5d15b, 0x441a8d3d, 0xff6d2498, 0x3cc68abc, 0x31eeb23f, 0xa13cfe83, 0x9bdaab5f, 0xdd044d15, 0x26bd0f7a, 0xa42c0703, 0x6a5abd71, 0x037cf6a3, 0x6ac04323, 0x891bc22a, 0x40c30a53, 0x203fbde5, 0x6548de6b, 0x434b16d8, 0x16312b1e, 0x1cc818d2, 0x922fc3eb, 0xdb9afa7f, 0x826fb620, 0xac29c255, 0x535a649d, 0x295c40b1, 0x4371c19a, 0x98ad6d9a, 0xabbf3324, 0x99ac0444 }, // Message 8
|
||||
{ 0x6e83f692, 0xbc0e6bda, 0x7e72510e, 0x4e944578, 0xc65967b7, 0x32f2d6c0, 0x02e369aa, 0x67658c2f, 0x8c9b40b7, 0x48cb3f6c, 0xe44438c3, 0xa789ffc2, 0x58d58fd3, 0xb44dc061, 0xb41b3551, 0x7cb5a176, 0xc275d51f, 0x6b1b5da9, 0x084057ce, 0x5335f8da, 0xe3d68679, 0x0e2c0f9c, 0xc74d3251, 0x8614ea1d, 0xd24d3fbb, 0x19f1c101, 0x2b8428fe, 0x7e124e3b, 0xe5691058, 0xb81eaa06, 0x8cec76a6, 0x89b1c345, 0x2847f64f, 0xdc1c91dd, 0xb8b4b126, 0x929da99a, 0x53aef56c, 0x0790c430, 0x9c47900b, 0x2b14de91, 0x94a0c514, 0x36199986, 0x4c0da7ed, 0xe546f058, 0x49dd9fe7, 0x31f8858c, 0x2c0c6222, 0xf8fa5b53, 0x976128c4, 0x19cd831c, 0x9a62299c, 0x53e300c9, 0x88df91d0, 0x940f1558, 0xbd7fdce8, 0x8789041c, 0xefa7f207, 0x9a2eb6e8, 0xea2d8b7f, 0x5d1f5954, 0x1b20a908, 0x8ff17818, 0x428676fe, 0x1d93063a }, // Message 9
|
||||
{ 0x382d84b6, 0x9d2697cb, 0xf39c39f1, 0x874b431d, 0x4add73d1, 0x3af49e97, 0xed375698, 0x8a19b492, 0xe722e314, 0x3a83ce5d, 0xd9e4fd2f, 0x363f8acc, 0xf9b56768, 0xb646b2be, 0x593eb44c, 0x1866c5a8, 0xa8f2b7f0, 0x81f6de65, 0xc86441c3, 0xcd3cd74d, 0x3e0aa6b2, 0x620d0e63, 0x6e9337b8, 0xcd97bef4, 0xb8808dc3, 0x0a996a55, 0xcfc0fafe, 0xc20b72cd, 0x6dd75c42, 0x0a416689, 0xe175ba09, 0xfc1e76a4, 0xd257e752, 0x2ab8c17f, 0x528354f7, 0x0240e4ea, 0x545cafbb, 0x0b06f1ff, 0xdb305649, 0x581cee55, 0x21adaed2, 0x4ff0aa40, 0x99ba5d0d, 0x0fce658a, 0x97c55b62, 0x820b80b3, 0xd0186a18, 0x5e5a70bd, 0xb8c4c251, 0x883f43b2, 0x8fe14b9e, 0x3a12687b, 0x0c3552b5, 0x88506482, 0x2f8aad3a, 0x51a11aaa, 0x6199cbe3, 0x48fd82ec, 0x92818dc1, 0xfb3e4fcd, 0x4b5e76bf, 0xf7ded2ad, 0x241b6fae, 0xa617617f }, },
|
||||
{ 0x382d84b6, 0x9d2697cb, 0xf39c39f1, 0x874b431d, 0x4add73d1, 0x3af49e97, 0xed375698, 0x8a19b492, 0xe722e314, 0x3a83ce5d, 0xd9e4fd2f, 0x363f8acc, 0xf9b56768, 0xb646b2be, 0x593eb44c, 0x1866c5a8, 0xa8f2b7f0, 0x81f6de65, 0xc86441c3, 0xcd3cd74d, 0x3e0aa6b2, 0x620d0e63, 0x6e9337b8, 0xcd97bef4, 0xb8808dc3, 0x0a996a55, 0xcfc0fafe, 0xc20b72cd, 0x6dd75c42, 0x0a416689, 0xe175ba09, 0xfc1e76a4, 0xd257e752, 0x2ab8c17f, 0x528354f7, 0x0240e4ea, 0x545cafbb, 0x0b06f1ff, 0xdb305649, 0x581cee55, 0x21adaed2, 0x4ff0aa40, 0x99ba5d0d, 0x0fce658a, 0x97c55b62, 0x820b80b3, 0xd0186a18, 0x5e5a70bd, 0xb8c4c251, 0x883f43b2, 0x8fe14b9e, 0x3a12687b, 0x0c3552b5, 0x88506482, 0x2f8aad3a, 0x51a11aaa, 0x6199cbe3, 0x48fd82ec, 0x92818dc1, 0xfb3e4fcd, 0x4b5e76bf, 0xf7ded2ad, 0x241b6fae, 0xa617617f },
|
||||
},
|
||||
},
|
||||
{ /* Case 5 */
|
||||
.iv = { 0xdc, 0x0f, 0x35, 0x44, 0x22, 0x00, 0x92, 0x16, 0xb6, 0x05, 0x77, 0x21, 0x81, 0x7b, 0x04, 0x91 },
|
||||
@@ -191,6 +194,7 @@ static const encrypt_testcase_t test_cases[NUM_CASES] = {
|
||||
{ 0x601f9888, 0x324f03a7, 0x76816efa, 0x09f31fc2, 0x4fe54aaf, 0x8399f6b5, 0x116572eb, 0x0f72fb48, 0xbcc9bdee, 0x7ce8c882, 0xf2dae59a, 0xa0f7623c, 0xa97bb554, 0xc353fe65, 0xce3091d5, 0xe5aebe3b, 0xe4d813ce, 0x54f4d525, 0x2efb8057, 0x3f4d489e, 0xcc060bed, 0x8fc0df8f, 0x314948a9, 0x168d95a9, 0xaeee97d6, 0xfb4fb17f, 0xf4f7f17d, 0x69bf9713, 0xf7a9a28b, 0x79012b09, 0x4ee7e70a, 0x1a094462 }, // Message 7
|
||||
{ 0x4bc2312b, 0x5619fac2, 0x1032aede, 0x1c197418, 0x098c3bca, 0xba6a75b5, 0x6f914c9f, 0xfcb330fa, 0xd054a7a6, 0x741a1085, 0x21a6aa90, 0x4937d82b, 0xd51cf1af, 0x9f7c568a, 0x47f983be, 0x8c6cd2f9, 0xc6694a58, 0x9ef95f86, 0x5fa02a5a, 0x9a0e7f70, 0xc08e256a, 0x05be92fb, 0x303198c9, 0xd5c30c38, 0x039f7e31, 0xbb9f0b6e, 0x8b176868, 0xa92f0eaa, 0x3afee460, 0x23da6824, 0x008a0231, 0x83235c9c }, // Message 8
|
||||
{ 0x427d58e6, 0xc0bcaa51, 0xdebac30b, 0x08f1a13b, 0x96ec5ef0, 0x114d0d1f, 0xedaafc04, 0xf8c49654, 0xb6e3b23c, 0x2dbdc932, 0x28401da1, 0xca20457a, 0x0015d8f4, 0x3c809988, 0x9f6fcc0e, 0x225df98d, 0x258efa9f, 0x05c2b486, 0x35b9fb97, 0xfecb6e6f, 0x14540fac, 0x721b786f, 0x0f2e8738, 0x9811ad77, 0x5ee7eb36, 0xd3dbedb1, 0x4f1686fd, 0x31390953, 0x45e100c7, 0x49485e7a, 0xc586b794, 0x853b42d3 }, // Message 9
|
||||
{ 0x82cb45e5, 0x393db1f2, 0xd22e78cb, 0xcf57d0a4, 0x387e16ff, 0x7db3454f, 0x249c492f, 0xda86d50b, 0x7895254a, 0x1c12f919, 0x7b0be80c, 0x36a10ee4, 0x0666df05, 0xdd901597, 0x674c62ae, 0xe1b6c5fb, 0x1cffbbd9, 0x2fd45bdf, 0x30310492, 0xf2a60213, 0xadf46362, 0x28a65efa, 0xafaf03d4, 0x9bf58710, 0xef74f30a, 0x97092e4b, 0xd2c5deb1, 0x760b434e, 0x824fb397, 0x40de33ec, 0x815bd4eb, 0x32498475 }, },
|
||||
{ 0x82cb45e5, 0x393db1f2, 0xd22e78cb, 0xcf57d0a4, 0x387e16ff, 0x7db3454f, 0x249c492f, 0xda86d50b, 0x7895254a, 0x1c12f919, 0x7b0be80c, 0x36a10ee4, 0x0666df05, 0xdd901597, 0x674c62ae, 0xe1b6c5fb, 0x1cffbbd9, 0x2fd45bdf, 0x30310492, 0xf2a60213, 0xadf46362, 0x28a65efa, 0xafaf03d4, 0x9bf58710, 0xef74f30a, 0x97092e4b, 0xd2c5deb1, 0x760b434e, 0x824fb397, 0x40de33ec, 0x815bd4eb, 0x32498475 },
|
||||
},
|
||||
},
|
||||
};
|
File diff suppressed because one or more lines are too long
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "unity.h"
|
||||
#include "unity_test_runner.h"
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_log.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#ifdef CONFIG_HEAP_TRACING
|
||||
#include "memory_checks.h"
|
||||
#include "esp_heap_trace.h"
|
||||
#endif
|
||||
#include "esp_crypto_lock.h"
|
||||
#include "esp_partition.h"
|
||||
|
||||
#define TEST_TASK_PRIORITY 5
|
||||
|
||||
#define TEST_MEMORY_LEAK_THRESHOLD_DEFAULT -400
|
||||
static int leak_threshold = TEST_MEMORY_LEAK_THRESHOLD_DEFAULT;
|
||||
|
||||
void set_leak_threshold(int threshold)
|
||||
{
|
||||
leak_threshold = threshold;
|
||||
}
|
||||
|
||||
static size_t before_free_8bit;
|
||||
static size_t before_free_32bit;
|
||||
static const char* TAG = "esp_hw_support_test_app";
|
||||
|
||||
static void check_leak(size_t before_free, size_t after_free, const char *type)
|
||||
{
|
||||
ssize_t delta = after_free - before_free;
|
||||
printf("MALLOC_CAP_%s: Before %u bytes free, After %u bytes free (delta %d)\n", type, before_free, after_free, delta);
|
||||
TEST_ASSERT_MESSAGE(delta >= leak_threshold, "memory leak");
|
||||
}
|
||||
|
||||
void setUp(void)
|
||||
{
|
||||
// If heap tracing is enabled in kconfig, leak trace the test
|
||||
#ifdef CONFIG_HEAP_TRACING
|
||||
setup_heap_record();
|
||||
heap_trace_start(HEAP_TRACE_LEAKS);
|
||||
#endif
|
||||
|
||||
leak_threshold = TEST_MEMORY_LEAK_THRESHOLD_DEFAULT;
|
||||
|
||||
#if SOC_KEY_MANAGER_SUPPORTED
|
||||
esp_crypto_ecc_lock_acquire();
|
||||
esp_crypto_sha_aes_lock_acquire();
|
||||
esp_crypto_ecc_lock_release();
|
||||
esp_crypto_sha_aes_lock_release();
|
||||
esp_crypto_key_manager_lock_acquire();
|
||||
esp_crypto_key_manager_lock_release();
|
||||
esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_ANY, "storage");
|
||||
#endif
|
||||
before_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT);
|
||||
before_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT);
|
||||
}
|
||||
|
||||
void tearDown(void)
|
||||
{
|
||||
/*Give idle task time to clean up*/
|
||||
vTaskDelay(10);
|
||||
|
||||
#ifdef CONFIG_HEAP_TRACING
|
||||
heap_trace_stop();
|
||||
heap_trace_dump();
|
||||
#endif
|
||||
|
||||
size_t after_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT);
|
||||
size_t after_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT);
|
||||
check_leak(before_free_8bit, after_free_8bit, "8BIT");
|
||||
check_leak(before_free_32bit, after_free_32bit, "32BIT");
|
||||
|
||||
}
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
vTaskPrioritySet(NULL, TEST_TASK_PRIORITY);
|
||||
ESP_LOGI(TAG, "Running esp-hw-support test app");
|
||||
unity_run_menu();
|
||||
}
|
1319
components/esp_security/test_apps/crypto_drivers/main/test_hmac.c
Normal file
1319
components/esp_security/test_apps/crypto_drivers/main/test_hmac.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,16 @@
|
||||
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
pytest.param('default', marks=[pytest.mark.supported_targets]),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
def test_crypto_drivers(dut: Dut) -> None:
|
||||
dut.run_all_single_board_cases(timeout=180)
|
@@ -0,0 +1,2 @@
|
||||
CONFIG_ESP_TASK_WDT_INIT=n
|
||||
CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192
|
@@ -0,0 +1,2 @@
|
||||
# Set CPU frequency to max for performance tests
|
||||
# CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y
|
@@ -0,0 +1,2 @@
|
||||
# Set CPU frequency to max for performance tests
|
||||
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
@@ -106,9 +106,6 @@ __attribute__((weak)) void esp_clk_init(void)
|
||||
|
||||
// Re calculate the ccount to make time calculation correct.
|
||||
esp_cpu_set_cycle_count((uint64_t)esp_cpu_get_cycle_count() * new_freq_mhz / old_freq_mhz);
|
||||
|
||||
// Set crypto clock (`clk_sec`) to use 480M SPLL clock
|
||||
REG_SET_FIELD(PCR_SEC_CONF_REG, PCR_SEC_CLK_SEL, 0x2);
|
||||
}
|
||||
|
||||
static void select_rtc_slow_clk(soc_rtc_slow_clk_src_t rtc_slow_clk_src)
|
||||
|
@@ -140,9 +140,6 @@ __attribute__((weak)) void esp_clk_init(void)
|
||||
|
||||
// Re calculate the ccount to make time calculation correct.
|
||||
esp_cpu_set_cycle_count((uint64_t)esp_cpu_get_cycle_count() * new_freq_mhz / old_freq_mhz);
|
||||
|
||||
// Set crypto clock (`clk_sec`) to use 96M PLL clock
|
||||
REG_SET_FIELD(PCR_SEC_CONF_REG, PCR_SEC_CLK_SEL, 0x3);
|
||||
}
|
||||
|
||||
static void select_rtc_slow_clk(soc_rtc_slow_clk_src_t rtc_slow_clk_src)
|
||||
|
@@ -107,9 +107,6 @@ __attribute__((weak)) void esp_clk_init(void)
|
||||
|
||||
// Re calculate the ccount to make time calculation correct.
|
||||
esp_cpu_set_cycle_count((uint64_t)esp_cpu_get_cycle_count() * new_freq_mhz / old_freq_mhz);
|
||||
|
||||
// Set crypto clock (`clk_sec`) to use 240M PLL clock
|
||||
REG_SET_FIELD(HP_SYS_CLKRST_PERI_CLK_CTRL25_REG, HP_SYS_CLKRST_REG_CRYPTO_CLK_SRC_SEL, 0x2);
|
||||
}
|
||||
|
||||
static void select_rtc_slow_clk(soc_rtc_slow_clk_src_t rtc_slow_clk_src)
|
||||
|
@@ -76,6 +76,9 @@ SECONDARY: 101: esp_hw_stack_guard_init in components/esp_system/hw_stack_guard.
|
||||
# RNG module clock was disabled in `esp_perip_clk_init`, if hw_random is used, need to re-ebnabled it in startup
|
||||
SECONDARY: 102: init_rng_clock in components/esp_hw_support/hw_random.c on BIT(0)
|
||||
|
||||
# Security specific initializations
|
||||
SECONDARY: 103: esp_security_init in components/esp_security/src/init.c on BIT(0)
|
||||
|
||||
# esp_sleep doesn't have init dependencies
|
||||
SECONDARY: 105: esp_sleep_startup_init in components/esp_hw_support/sleep_gpio.c on BIT(0)
|
||||
SECONDARY: 106: sleep_clock_startup_init in components/esp_hw_support/sleep_clock.c on BIT(0)
|
||||
|
@@ -23,8 +23,8 @@ endif()
|
||||
|
||||
if(CONFIG_SOC_KEY_MANAGER_SUPPORTED)
|
||||
list(APPEND srcs "key_manager/test_key_manager.c"
|
||||
"$ENV{IDF_PATH}/components/esp_hw_support/esp_key_mgr.c")
|
||||
list(APPEND priv_include_dirs "$ENV{IDF_PATH}/components/esp_hw_support/include")
|
||||
"$ENV{IDF_PATH}/components/esp_security/src/esp_key_mgr.c")
|
||||
list(APPEND priv_include_dirs "$ENV{IDF_PATH}/components/esp_security/include")
|
||||
endif()
|
||||
|
||||
if(CONFIG_SOC_AES_SUPPORTED)
|
||||
@@ -74,7 +74,7 @@ if(CONFIG_SOC_SHA_SUPPORTED)
|
||||
endif()
|
||||
|
||||
idf_component_register(SRCS ${srcs}
|
||||
PRIV_REQUIRES efuse mbedtls esp_mm bootloader_support spi_flash
|
||||
PRIV_REQUIRES efuse mbedtls esp_security esp_mm bootloader_support spi_flash
|
||||
REQUIRES test_utils unity
|
||||
WHOLE_ARCHIVE
|
||||
PRIV_INCLUDE_DIRS "${priv_include_dirs}"
|
||||
|
@@ -153,6 +153,10 @@ endif()
|
||||
# Add port files to mbedtls targets
|
||||
target_sources(mbedtls PRIVATE ${mbedtls_target_sources})
|
||||
|
||||
if(NOT ${IDF_TARGET} STREQUAL "linux")
|
||||
target_link_libraries(mbedcrypto PRIVATE idf::esp_security)
|
||||
endif()
|
||||
|
||||
# Choose peripheral type
|
||||
|
||||
if(CONFIG_SOC_SHA_SUPPORTED)
|
||||
|
@@ -91,6 +91,11 @@ set(extra_components_which_shouldnt_be_included
|
||||
|
||||
# pthread is required by cxx. See [refactor-todo] about cxx, can it work without pthread?
|
||||
pthread
|
||||
|
||||
# esp_security is a private dependency of the following G1 components:
|
||||
# esp_hw_support
|
||||
# TODO: will be removed in IDF 6.x (see IDF-10733)
|
||||
esp_security
|
||||
)
|
||||
|
||||
set(expected_components
|
||||
|
@@ -11,7 +11,7 @@ g1_g0_components = ['hal', 'cxx', 'newlib', 'freertos', 'esp_hw_support', 'heap'
|
||||
|
||||
expected_dep_violations = {'esp_system': ['esp_timer', 'bootloader_support', 'esp_pm'],
|
||||
'spi_flash': ['bootloader_support', 'app_update', 'esp_driver_gpio'],
|
||||
'esp_hw_support': ['efuse', 'bootloader_support', 'esp_driver_gpio', 'esp_timer', 'esp_pm'],
|
||||
'esp_hw_support': ['efuse', 'bootloader_support', 'esp_driver_gpio', 'esp_timer', 'esp_pm', 'esp_security'],
|
||||
'cxx': ['pthread']}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user