fix(esp_hw_support): update hmac toggle method due to discrepency in ROM code

Need to update the HMAC enable/disable method due to discrepancy in ROM code
across different targets for the esp_hmac_disable() API.
This commit is contained in:
nilesh.kale
2024-02-20 16:19:51 +05:30
parent d39db5ede8
commit 14d7caa921
3 changed files with 12 additions and 12 deletions

View File

@@ -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
*/
@@ -159,7 +159,7 @@ esp_err_t esp_hmac_jtag_enable(hmac_key_id_t key_id, const uint8_t *token)
ESP_LOGD(TAG, "HMAC computation in downstream mode is completed.");
ets_hmac_disable();
periph_module_disable(PERIPH_HMAC_MODULE);
esp_crypto_hmac_lock_release();
@@ -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_crypto_hmac_lock_acquire();
ets_hmac_enable();
periph_module_enable(PERIPH_HMAC_MODULE);
REG_SET_BIT(HMAC_SET_INVALIDATE_JTAG_REG, HMAC_INVALIDATE_JTAG);
ets_hmac_disable();
periph_module_disable(PERIPH_HMAC_MODULE);
esp_crypto_hmac_lock_release();
ESP_LOGD(TAG, "Invalidate JTAG result register. JTAG disabled.");

View File

@@ -159,7 +159,7 @@ esp_err_t esp_hmac_jtag_enable(hmac_key_id_t key_id, const uint8_t *token)
ESP_LOGD(TAG, "HMAC computation in downstream mode is completed.");
ets_hmac_disable();
periph_module_disable(PERIPH_HMAC_MODULE);
esp_crypto_hmac_lock_release();
@@ -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_crypto_hmac_lock_acquire();
ets_hmac_enable();
periph_module_enable(PERIPH_HMAC_MODULE);
REG_SET_BIT(HMAC_SET_INVALIDATE_JTAG_REG, HMAC_INVALIDATE_JTAG);
ets_hmac_disable();
periph_module_disable(PERIPH_HMAC_MODULE);
esp_crypto_hmac_lock_release();
ESP_LOGD(TAG, "Invalidate JTAG result register. JTAG disabled.");

View File

@@ -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
*/
@@ -160,7 +160,7 @@ esp_err_t esp_hmac_jtag_enable(hmac_key_id_t key_id, const uint8_t *token)
ESP_LOGD(TAG, "HMAC computation in downstream mode is completed.");
ets_hmac_disable();
periph_module_disable(PERIPH_HMAC_MODULE);
esp_crypto_hmac_lock_release();
@@ -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_crypto_hmac_lock_acquire();
ets_hmac_enable();
REG_SET_BIT(HMAC_SET_INVALIDATE_JTAG_REG, HMAC_INVALIDATE_JTAG);
ets_hmac_disable();
periph_module_enable(PERIPH_HMAC_MODULE);
REG_WRITE(HMAC_SET_INVALIDATE_JTAG_REG, 1);
periph_module_disable(PERIPH_HMAC_MODULE);
esp_crypto_hmac_lock_release();
ESP_LOGD(TAG, "Invalidate JTAG result register. JTAG disabled.");