Function esp_idf_svc::sys::esp_efuse_write_key
source · pub unsafe extern "C" fn esp_efuse_write_key(
block: u32,
purpose: u32,
key: *const c_void,
key_size_bytes: usize,
) -> i32
Expand description
@brief Program a block of key data to an efuse block
The burn of a key, protection bits, and a purpose happens in batch mode.
@note This API also enables the read protection efuse bit for certain key blocks like XTS-AES, HMAC, ECDSA etc. This ensures that the key is only accessible to hardware peripheral.
@note For SoC’s with capability SOC_EFUSE_ECDSA_USE_HARDWARE_K
(e.g., ESP32-H2), this API writes an additional
efuse bit for ECDSA key purpose to enforce hardware TRNG generated k mode in the peripheral.
@param[in] block Block to read purpose for. Must be in range EFUSE_BLK_KEY0 to EFUSE_BLK_KEY_MAX. Key block must be unused (esp_efuse_key_block_unused). @param[in] purpose Purpose to set for this key. Purpose must be already unset. @param[in] key Pointer to data to write. @param[in] key_size_bytes Bytes length of data to write.
@return
- ESP_OK: Successful.
- ESP_ERR_INVALID_ARG: Error in the passed arguments.
- ESP_ERR_INVALID_STATE: Error in efuses state, unused block not found.
- ESP_ERR_EFUSE_REPEATED_PROG: Error repeated programming of programmed bits is strictly forbidden.
- ESP_ERR_CODING: Error range of data does not match the coding scheme.