mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
change(security): disable Key Manager support on ESP32-C5/P4/S31
The Key Manager hardware peripheral in its current form needs further design changes before it can be offered as a production feature. Until a revised peripheral design is available, withdraw ESP-IDF support for it on all Key Manager capable targets.
This commit is contained in:
committed by
Harshal Patil
parent
cad31b97f5
commit
6459793edd
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2023-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -122,7 +122,7 @@ void esp_crypto_ecdsa_lock_acquire(void);
|
||||
void esp_crypto_ecdsa_lock_release(void);
|
||||
#endif /* SOC_ECDSA_SUPPORTED */
|
||||
|
||||
#ifdef SOC_KEY_MANAGER_SUPPORTED
|
||||
#if SOC_KEY_MANAGER_SUPPORT_KEY_DEPLOYMENT
|
||||
/**
|
||||
* @brief Acquire lock for Key Manager peripheral
|
||||
*
|
||||
@@ -134,7 +134,7 @@ void esp_crypto_key_manager_lock_acquire(void);
|
||||
*
|
||||
*/
|
||||
void esp_crypto_key_manager_lock_release(void);
|
||||
#endif /* SOC_KEY_MANAGER_SUPPORTED */
|
||||
#endif /* SOC_KEY_MANAGER_SUPPORT_KEY_DEPLOYMENT */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
#include "soc/soc_caps.h"
|
||||
|
||||
#if SOC_KEY_MANAGER_SUPPORTED
|
||||
|
||||
#include "rom/ets_sys.h"
|
||||
#include "esp_attr.h"
|
||||
@@ -112,4 +111,3 @@ struct km_deploy_ops {
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -8,7 +8,6 @@
|
||||
#define _KM_H
|
||||
|
||||
#include "soc/soc_caps.h"
|
||||
#if SOC_KEY_MANAGER_SUPPORTED
|
||||
|
||||
#include <stdint.h>
|
||||
#include "soc/soc.h"
|
||||
@@ -58,6 +57,5 @@ int esp_rom_km_huk_risk(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* SOC_KEY_MANAGER_SUPPORTED */
|
||||
|
||||
#endif /* _KM_H */
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
#include "soc/soc_caps.h"
|
||||
|
||||
#if SOC_KEY_MANAGER_SUPPORTED
|
||||
#include <stdint.h>
|
||||
#include "esp_attr.h"
|
||||
#include "ets_sys.h"
|
||||
@@ -109,4 +108,3 @@ struct km_deploy_ops {
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -8,7 +8,6 @@
|
||||
#define _KM_H
|
||||
|
||||
#include "soc/soc_caps.h"
|
||||
#if SOC_KEY_MANAGER_SUPPORTED
|
||||
|
||||
#include <stdint.h>
|
||||
#include "soc/soc.h"
|
||||
@@ -58,6 +57,5 @@ int esp_rom_km_huk_risk(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* _KM_H */
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "esp_err.h"
|
||||
#include "soc/soc_caps.h"
|
||||
|
||||
#if SOC_KEY_MANAGER_SUPPORTED
|
||||
#if SOC_KEY_MANAGER_SUPPORT_KEY_DEPLOYMENT
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -52,10 +52,10 @@ static _lock_t s_crypto_ecdsa_lock;
|
||||
#endif /* SOC_ECDSA_USES_MPI */
|
||||
#endif /* SOC_ECDSA_SUPPORTED */
|
||||
|
||||
#ifdef SOC_KEY_MANAGER_SUPPORTED
|
||||
#if SOC_KEY_MANAGER_SUPPORT_KEY_DEPLOYMENT
|
||||
/* Lock for Key Manager peripheral */
|
||||
static _lock_t s_crypto_key_manager_lock;
|
||||
#endif /* SOC_KEY_MANAGER_SUPPORTED */
|
||||
#endif /* SOC_KEY_MANAGER_SUPPORT_KEY_DEPLOYMENT */
|
||||
|
||||
#ifdef SOC_HMAC_SUPPORTED
|
||||
void esp_crypto_hmac_lock_acquire(void)
|
||||
@@ -159,7 +159,7 @@ void esp_crypto_ecdsa_lock_release(void)
|
||||
}
|
||||
#endif /* SOC_ECDSA_SUPPORTED */
|
||||
|
||||
#ifdef SOC_KEY_MANAGER_SUPPORTED
|
||||
#if SOC_KEY_MANAGER_SUPPORT_KEY_DEPLOYMENT
|
||||
void esp_crypto_key_manager_lock_acquire(void)
|
||||
{
|
||||
_lock_acquire(&s_crypto_key_manager_lock);
|
||||
@@ -169,7 +169,7 @@ void esp_crypto_key_manager_lock_release(void)
|
||||
{
|
||||
_lock_release(&s_crypto_key_manager_lock);
|
||||
}
|
||||
#endif /* SOC_KEY_MANAGER_SUPPORTED */
|
||||
#endif /* SOC_KEY_MANAGER_SUPPORT_KEY_DEPLOYMENT */
|
||||
#else /* NON_OS_BUILD */
|
||||
#ifdef SOC_HMAC_SUPPORTED
|
||||
void esp_crypto_hmac_lock_acquire(void) {}
|
||||
@@ -213,9 +213,9 @@ void esp_crypto_ecdsa_lock_acquire(void) {}
|
||||
void esp_crypto_ecdsa_lock_release(void) {}
|
||||
#endif /* SOC_ECDSA_SUPPORTED */
|
||||
|
||||
#ifdef SOC_KEY_MANAGER_SUPPORTED
|
||||
#if SOC_KEY_MANAGER_SUPPORT_KEY_DEPLOYMENT
|
||||
void esp_crypto_key_manager_lock_acquire(void) {}
|
||||
|
||||
void esp_crypto_key_manager_lock_release(void) {}
|
||||
#endif /* SOC_KEY_MANAGER_SUPPORTED */
|
||||
#endif /* SOC_KEY_MANAGER_SUPPORT_KEY_DEPLOYMENT */
|
||||
#endif /* !NON_OS_BUILD */
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#if SOC_ECDSA_SUPPORTED
|
||||
#include "hal/ecdsa_ll.h"
|
||||
#endif
|
||||
#if SOC_KEY_MANAGER_SUPPORTED
|
||||
#if SOC_KEY_MANAGER_SUPPORT_KEY_DEPLOYMENT
|
||||
#include "hal/key_mgr_ll.h"
|
||||
#endif
|
||||
/* Crypto DMA, shared between AES and SHA */
|
||||
@@ -140,7 +140,7 @@ void esp_crypto_ecdsa_enable_periph_clk(bool enable)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if SOC_KEY_MANAGER_SUPPORTED
|
||||
#if SOC_KEY_MANAGER_SUPPORT_KEY_DEPLOYMENT
|
||||
void esp_crypto_key_mgr_enable_periph_clk(bool enable)
|
||||
{
|
||||
KEY_MANAGER_RCC_ATOMIC() {
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "rom/key_mgr.h"
|
||||
#include "soc/soc_caps.h"
|
||||
|
||||
#if SOC_KEY_MANAGER_SUPPORTED
|
||||
static const char *TAG = "esp_key_mgr";
|
||||
|
||||
static _lock_t s_key_mgr_ecdsa_key_lock;
|
||||
@@ -905,4 +904,3 @@ cleanup:
|
||||
esp_key_mgr_release_hardware(true);
|
||||
return esp_ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -26,8 +26,11 @@ if(CONFIG_SOC_WDT_SUPPORTED AND NOT CONFIG_HAL_WDT_USE_ROM_IMPL)
|
||||
list(APPEND srcs "wdt_hal_iram.c")
|
||||
endif()
|
||||
|
||||
if(CONFIG_SOC_KEY_MANAGER_SUPPORTED)
|
||||
if(CONFIG_SOC_KEY_MANAGER_SUPPORT_KEY_DEPLOYMENT)
|
||||
list(APPEND srcs "key_mgr_hal.c")
|
||||
endif()
|
||||
|
||||
if(CONFIG_SOC_HUK_SUPPORTED)
|
||||
list(APPEND srcs "huk_hal.c")
|
||||
endif()
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ static void configure_ecdsa_periph(ecdsa_hal_config_t *conf)
|
||||
key_mgr_hal_set_key_usage(ESP_KEY_MGR_ECDSA_KEY, ESP_KEY_MGR_USE_EFUSE_KEY);
|
||||
#endif
|
||||
}
|
||||
#if SOC_KEY_MANAGER_SUPPORTED
|
||||
#if SOC_KEY_MANAGER_ECDSA_KEY_DEPLOY
|
||||
else {
|
||||
if (!key_mgr_ll_is_supported()) {
|
||||
HAL_ASSERT(false && "Key manager is not supported");
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#include "soc/soc_caps.h"
|
||||
|
||||
#if SOC_KEY_MANAGER_SUPPORTED
|
||||
#if SOC_HUK_SUPPORTED
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2023-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#include "soc/soc_caps.h"
|
||||
|
||||
#if SOC_KEY_MANAGER_SUPPORTED
|
||||
#if SOC_HUK_SUPPORTED
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "esp_err.h"
|
||||
#include "soc/soc_caps.h"
|
||||
|
||||
#if SOC_KEY_MANAGER_SUPPORTED
|
||||
#if SOC_HUK_SUPPORTED
|
||||
esp_huk_state_t huk_hal_get_state(void)
|
||||
{
|
||||
return huk_ll_get_state();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2023-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include "soc/soc_caps.h"
|
||||
|
||||
#if SOC_KEY_MANAGER_SUPPORTED
|
||||
#if SOC_HUK_SUPPORTED
|
||||
|
||||
#include "esp_assert.h"
|
||||
#include "rom/km.h"
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "soc/soc_caps.h"
|
||||
|
||||
#if SOC_KEY_MANAGER_SUPPORTED
|
||||
#if SOC_KEY_MANAGER_SUPPORT_KEY_DEPLOYMENT
|
||||
#include "hal/key_mgr_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -138,4 +138,4 @@ void key_mgr_hal_set_date_info(const uint32_t date_info);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* SOC_KEY_MANAGER_SUPPORTED */
|
||||
#endif /* SOC_KEY_MANAGER_SUPPORT_KEY_DEPLOYMENT */
|
||||
|
||||
@@ -46,8 +46,11 @@ menu "Test App Configuration"
|
||||
bool
|
||||
default n if IDF_TARGET_ESP32P4 && ESP32P4_SELECTS_REV_LESS_V3
|
||||
default y
|
||||
depends on SOC_KEY_MANAGER_SUPPORTED
|
||||
depends on SOC_KEY_MANAGER_SUPPORT_KEY_DEPLOYMENT
|
||||
help
|
||||
A hidden config to determine if the Key Manager tests should be included.
|
||||
The tests build the esp_key_mgr driver from source so that the Key Manager
|
||||
hardware stays covered by CI even on targets where IDF does not support
|
||||
the Key Manager (SOC_KEY_MANAGER_SUPPORTED = 0).
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -245,7 +245,7 @@ config SOC_RNG_SUPPORTED
|
||||
|
||||
config SOC_KEY_MANAGER_SUPPORTED
|
||||
bool
|
||||
default y
|
||||
default n
|
||||
|
||||
config SOC_HUK_SUPPORTED
|
||||
bool
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
#define SOC_SPI_FLASH_SUPPORTED 1 // TODO: [ESP32C5] IDF-8715
|
||||
#define SOC_ECDSA_SUPPORTED 1
|
||||
#define SOC_RNG_SUPPORTED 1
|
||||
#define SOC_KEY_MANAGER_SUPPORTED 1
|
||||
#define SOC_KEY_MANAGER_SUPPORTED 0
|
||||
#define SOC_HUK_SUPPORTED 1
|
||||
#define SOC_MODEM_CLOCK_SUPPORTED 1
|
||||
#define SOC_LIGHT_SLEEP_SUPPORTED 1
|
||||
|
||||
@@ -209,7 +209,7 @@ config SOC_ECDSA_SUPPORTED
|
||||
|
||||
config SOC_KEY_MANAGER_SUPPORTED
|
||||
bool
|
||||
default y
|
||||
default n
|
||||
|
||||
config SOC_HUK_SUPPORTED
|
||||
bool
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
#define SOC_ECC_SUPPORTED 1
|
||||
#define SOC_ECC_EXTENDED_MODES_SUPPORTED 1
|
||||
#define SOC_ECDSA_SUPPORTED 1
|
||||
#define SOC_KEY_MANAGER_SUPPORTED 1
|
||||
#define SOC_KEY_MANAGER_SUPPORTED 0
|
||||
#define SOC_HUK_SUPPORTED 1
|
||||
#define SOC_FLASH_ENC_SUPPORTED 1
|
||||
#define SOC_SECURE_BOOT_SUPPORTED 1
|
||||
|
||||
Reference in New Issue
Block a user