EasyManua.ls Logo

Espressif ESP32-S2 - Page 286

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 2. API Reference
Calculate the HMAC hmac of a given message message with length message_len. SHA256 is used for
the calculation (fixed on ESP32S2).
Note Uses the HMAC peripheral in upstreammode.
Return
ESP_OK, if the calculation was successful,
ESP_FAIL, if the hmac calculation failed
Parameters
key_id: Determines which of the 6 key blocks in the efuses should be used for the HMAC cal-
cuation. The corresponding purpose eld of the key block in the efuse must be set to the HMAC
upstream purpose value.
message: the message for which to calculate the HMAC
message_len: message length return ESP_ERR_INVALID_STATE if unsuccessful
[out] hmac: the hmac result; the buffer behind the provided pointer must be 32 bytes long
esp_err_t esp_hmac_jtag_enable(hmac_key_id_t key_id, const uint8_t *token)
Use HMAC peripheral in Downstream mode to re-enable the JTAG, if it is not permanently disable by HW.
In downstream mode HMAC calculations perfomred by peripheral used internally and not provided back to
user.
Return
ESP_OK, if the calculation was successful, if the calculated HMAC value matches with provided
token, JTAG will be re-enable otherwise JTAG will remain disabled. Return value does not indicate
the JTAG status.
ESP_FAIL, if the hmac calculation failed or JTAG is permanently disabled by
EFUSE_HARD_DIS_JTAG eFuse parameter.
ESP_ERR_INVALID_ARG, invalid input arguments
Parameters
key_id: Determines which of the 6 key blocks in the efuses should be used for the HMAC cal-
culation. The corresponding purpose eld of the key block in the efuse must be set to HMAC
downstream purpose.
token: Pre calculated HMAC value of the 32-byte 0x00 using SHA-256 and the known private
HMAC key. The key is already programmed to a eFuse key block. The key block number is provided
as the first parameter to this function.
esp_err_t esp_hmac_jtag_disable(void)
Disable the JTAG which might be enable using the HMAC downstream mode. This function just clear the
result generated by JTAG key by calling esp_hmac_jtag_enable() API.
Return
ESP_OK return ESP_OK after writing the HMAC_SET_INVALIDATE_JTAG_REG with value
1.
Enumerations
enum hmac_key_id_t
The possible efuse keys for the HMAC peripheral
Values:
HMAC_KEY0 = 0
HMAC_KEY1
HMAC_KEY2
HMAC_KEY3
HMAC_KEY4
HMAC_KEY5
HMAC_KEY_MAX
Espressif Systems 275
Submit Document Feedback
Release v4.4

Table of Contents