Merge branch 'fix/flipped_key_mgr_key_info_flash_position_v5.5' into 'release/v5.5'

Enable ECC clock while using the Key Manager's ECDH key deployment mode (v5.5)

See merge request espressif/esp-idf!48160
This commit is contained in:
Mahavir Jain
2026-05-05 14:32:29 +05:30

View File

@@ -21,6 +21,7 @@
#include "hal/huk_types.h"
#include "hal/huk_hal.h"
#include "rom/key_mgr.h"
#include "soc/soc_caps.h"
#if SOC_KEY_MANAGER_SUPPORTED
static const char *TAG = "esp_key_mgr";
@@ -100,6 +101,12 @@ static void esp_key_mgr_acquire_hardware(bool deployment_mode)
esp_crypto_ecc_lock_acquire();
esp_crypto_sha_aes_lock_acquire();
esp_crypto_key_manager_lock_acquire();
// The KM peripheral uses the external ECC block for the ECDH0/ECDH1
// scalar multiplications; its bus clock must be on, otherwise the KM
// deploys an incorrect key.
#if SOC_ECC_SUPPORTED
esp_crypto_ecc_enable_periph_clk(true);
#endif
}
// Reset the Key Manager Clock
esp_crypto_key_mgr_enable_periph_clk(true);
@@ -108,9 +115,12 @@ static void esp_key_mgr_acquire_hardware(bool deployment_mode)
static void esp_key_mgr_release_hardware(bool deployment_mode)
{
if (deployment_mode) {
esp_crypto_ecc_lock_release();
esp_crypto_sha_aes_lock_release();
#if SOC_ECC_SUPPORTED
esp_crypto_ecc_enable_periph_clk(false);
#endif
esp_crypto_key_manager_lock_release();
esp_crypto_sha_aes_lock_release();
esp_crypto_ecc_lock_release();
}
// Reset the Key Manager Clock