mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 18:57:19 +02:00
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.
This commit is contained in:
@ -169,9 +169,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_err_t esp_hmac_jtag_disable()
|
||||||
{
|
{
|
||||||
esp_crypto_hmac_lock_acquire();
|
esp_crypto_hmac_lock_acquire();
|
||||||
|
ets_hmac_enable();
|
||||||
REG_SET_BIT(HMAC_SET_INVALIDATE_JTAG_REG, HMAC_INVALIDATE_JTAG);
|
REG_SET_BIT(HMAC_SET_INVALIDATE_JTAG_REG, HMAC_INVALIDATE_JTAG);
|
||||||
|
ets_hmac_disable();
|
||||||
esp_crypto_hmac_lock_release();
|
esp_crypto_hmac_lock_release();
|
||||||
|
|
||||||
ESP_LOGD(TAG, "Invalidate JTAG result register. JTAG disabled.");
|
ESP_LOGD(TAG, "Invalidate JTAG result register. JTAG disabled.");
|
||||||
|
@ -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
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -169,9 +169,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_err_t esp_hmac_jtag_disable()
|
||||||
{
|
{
|
||||||
esp_crypto_hmac_lock_acquire();
|
esp_crypto_hmac_lock_acquire();
|
||||||
|
ets_hmac_enable();
|
||||||
REG_SET_BIT(HMAC_SET_INVALIDATE_JTAG_REG, HMAC_INVALIDATE_JTAG);
|
REG_SET_BIT(HMAC_SET_INVALIDATE_JTAG_REG, HMAC_INVALIDATE_JTAG);
|
||||||
|
ets_hmac_disable();
|
||||||
esp_crypto_hmac_lock_release();
|
esp_crypto_hmac_lock_release();
|
||||||
|
|
||||||
ESP_LOGD(TAG, "Invalidate JTAG result register. JTAG disabled.");
|
ESP_LOGD(TAG, "Invalidate JTAG result register. JTAG disabled.");
|
||||||
|
@ -89,9 +89,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_err_t esp_hmac_jtag_disable()
|
||||||
{
|
{
|
||||||
esp_crypto_dma_lock_acquire();
|
esp_crypto_dma_lock_acquire();
|
||||||
|
ets_hmac_enable();
|
||||||
REG_WRITE(HMAC_SET_INVALIDATE_JTAG_REG, 1);
|
REG_WRITE(HMAC_SET_INVALIDATE_JTAG_REG, 1);
|
||||||
|
ets_hmac_disable();
|
||||||
esp_crypto_dma_lock_release();
|
esp_crypto_dma_lock_release();
|
||||||
|
|
||||||
ESP_LOGD(TAG, "Invalidate JTAG result register. JTAG disabled.");
|
ESP_LOGD(TAG, "Invalidate JTAG result register. JTAG disabled.");
|
||||||
|
@ -170,9 +170,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_err_t esp_hmac_jtag_disable()
|
||||||
{
|
{
|
||||||
esp_crypto_hmac_lock_acquire();
|
esp_crypto_hmac_lock_acquire();
|
||||||
|
ets_hmac_enable();
|
||||||
REG_SET_BIT(HMAC_SET_INVALIDATE_JTAG_REG, HMAC_INVALIDATE_JTAG);
|
REG_SET_BIT(HMAC_SET_INVALIDATE_JTAG_REG, HMAC_INVALIDATE_JTAG);
|
||||||
|
ets_hmac_disable();
|
||||||
esp_crypto_hmac_lock_release();
|
esp_crypto_hmac_lock_release();
|
||||||
|
|
||||||
ESP_LOGD(TAG, "Invalidate JTAG result register. JTAG disabled.");
|
ESP_LOGD(TAG, "Invalidate JTAG result register. JTAG disabled.");
|
||||||
|
Reference in New Issue
Block a user