fix(esp_security): Enable Key Manager clocks even for efuse key operations

The Key Manager holds a key usage register, thus, the Key Manager peripheral
clock must be enabled even for efuses-based key operations to route the
crypto operations to correctly to the efuses (default is Key Manager)
This commit is contained in:
harshal.patil
2026-03-25 10:38:44 +05:30
parent fd951bfdba
commit 28736a81fa
4 changed files with 151 additions and 13 deletions
+12
View File
@@ -77,6 +77,14 @@ esp_err_t esp_hmac_calculate(hmac_key_id_t key_id,
esp_crypto_ds_enable_periph_clk(true);
#if SOC_KEY_MANAGER_HMAC_KEY_DEPLOY
/* Key Manager holds the key usage selector register(efuse vs own key).
Thus, we need to enable the Key Manager peripheral clock to ensure
that the key usage selector register is properly set.
*/
esp_crypto_key_mgr_enable_periph_clk(true);
#endif /* SOC_KEY_MANAGER_HMAC_KEY_DEPLOY */
hmac_hal_start();
uint32_t conf_error = hmac_hal_configure(HMAC_OUTPUT_USER, key_id);
@@ -137,6 +145,10 @@ esp_err_t esp_hmac_calculate(hmac_key_id_t key_id,
// Read back result (bit swapped)
hmac_hal_read_result_256(hmac);
#if SOC_KEY_MANAGER_HMAC_KEY_DEPLOY
esp_crypto_key_mgr_enable_periph_clk(false);
#endif /* SOC_KEY_MANAGER_HMAC_KEY_DEPLOY */
esp_crypto_ds_enable_periph_clk(false);
esp_crypto_sha_enable_periph_clk(false);