From fa02eeeb97c03d3ad162b78985b033d90fd5992a Mon Sep 17 00:00:00 2001 From: "nilesh.kale" Date: Wed, 13 Dec 2023 15:10:20 +0530 Subject: [PATCH] fix(esp_hw_support): fix API esp_hmac_disable_jtag() to disable JTAG After ets_hmac_disable(), invalidating JTAG register process is ineffective. So, added call to enable hmac begore invalidating JTAG REG. And similarly disabled it after invalidation. --- components/esp_hw_support/esp_hmac.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/esp_hw_support/esp_hmac.c b/components/esp_hw_support/esp_hmac.c index 25e5c8bc8e8e..267ec792b93a 100644 --- a/components/esp_hw_support/esp_hmac.c +++ b/components/esp_hw_support/esp_hmac.c @@ -180,7 +180,9 @@ esp_err_t esp_hmac_jtag_enable(hmac_key_id_t key_id, const uint8_t *token) esp_err_t esp_hmac_jtag_disable() { esp_crypto_hmac_lock_acquire(); + ets_hmac_enable(); REG_WRITE(HMAC_SET_INVALIDATE_JTAG_REG, 1); + ets_hmac_disable(); esp_crypto_hmac_lock_release(); ESP_LOGD(TAG, "Invalidate JTAG result register. JTAG disabled."); @@ -262,7 +264,9 @@ esp_err_t esp_hmac_jtag_disable() { esp_crypto_dma_lock_acquire(); + ets_hmac_enable(); REG_WRITE(HMAC_SET_INVALIDATE_JTAG_REG, 1); + ets_hmac_disable(); esp_crypto_dma_lock_release();