mirror of
https://github.com/espressif/esp-idf.git
synced 2026-08-18 06:35:35 +03:00
secure_boot: Checks secure boot efuses
ESP32 V1 and V2 - protection bits. ESP32xx V2: revoke bits, protection bits - refactor efuse component - adds some APIs for esp32 chips as well as for esp32xx chips
This commit is contained in:
@@ -1,44 +0,0 @@
|
||||
// Copyright 2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Type of eFuse blocks for ESP32
|
||||
*/
|
||||
typedef enum {
|
||||
EFUSE_BLK0 = 0, /**< Number of eFuse block. Reserved. */
|
||||
EFUSE_BLK1 = 1, /**< Number of eFuse block. Used for Flash Encryption. If not using that Flash Encryption feature, they can be used for another purpose. */
|
||||
EFUSE_BLK2 = 2, /**< Number of eFuse block. Used for Secure Boot. If not using that Secure Boot feature, they can be used for another purpose. */
|
||||
EFUSE_BLK3 = 3, /**< Number of eFuse block. Uses for the purpose of the user. */
|
||||
EFUSE_BLK_MAX
|
||||
} esp_efuse_block_t;
|
||||
|
||||
/**
|
||||
* @brief Type of coding scheme
|
||||
*/
|
||||
typedef enum {
|
||||
EFUSE_CODING_SCHEME_NONE = 0, /**< None */
|
||||
EFUSE_CODING_SCHEME_3_4 = 1, /**< 3/4 coding */
|
||||
EFUSE_CODING_SCHEME_REPEAT = 2, /**< Repeat coding */
|
||||
} esp_efuse_coding_scheme_t;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,70 +0,0 @@
|
||||
// Copyright 2020 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Type of eFuse blocks ESP32C3
|
||||
*/
|
||||
typedef enum {
|
||||
EFUSE_BLK0 = 0, /**< Number of eFuse BLOCK0. REPEAT_DATA */
|
||||
|
||||
EFUSE_BLK1 = 1, /**< Number of eFuse BLOCK1. MAC_SPI_8M_SYS */
|
||||
|
||||
EFUSE_BLK2 = 2, /**< Number of eFuse BLOCK2. SYS_DATA_PART1 */
|
||||
EFUSE_BLK_SYS_DATA_PART1 = 2, /**< Number of eFuse BLOCK2. SYS_DATA_PART1 */
|
||||
|
||||
EFUSE_BLK3 = 3, /**< Number of eFuse BLOCK3. USER_DATA*/
|
||||
EFUSE_BLK_USER_DATA = 3, /**< Number of eFuse BLOCK3. USER_DATA*/
|
||||
|
||||
EFUSE_BLK4 = 4, /**< Number of eFuse BLOCK4. KEY0 */
|
||||
EFUSE_BLK_KEY0 = 4, /**< Number of eFuse BLOCK4. KEY0 */
|
||||
|
||||
EFUSE_BLK5 = 5, /**< Number of eFuse BLOCK5. KEY1 */
|
||||
EFUSE_BLK_KEY1 = 5, /**< Number of eFuse BLOCK5. KEY1 */
|
||||
|
||||
EFUSE_BLK6 = 6, /**< Number of eFuse BLOCK6. KEY2 */
|
||||
EFUSE_BLK_KEY2 = 6, /**< Number of eFuse BLOCK6. KEY2 */
|
||||
|
||||
EFUSE_BLK7 = 7, /**< Number of eFuse BLOCK7. KEY3 */
|
||||
EFUSE_BLK_KEY3 = 7, /**< Number of eFuse BLOCK7. KEY3 */
|
||||
|
||||
EFUSE_BLK8 = 8, /**< Number of eFuse BLOCK8. KEY4 */
|
||||
EFUSE_BLK_KEY4 = 8, /**< Number of eFuse BLOCK8. KEY4 */
|
||||
|
||||
EFUSE_BLK9 = 9, /**< Number of eFuse BLOCK9. KEY5 */
|
||||
EFUSE_BLK_KEY5 = 9, /**< Number of eFuse BLOCK9. KEY5 */
|
||||
EFUSE_BLK_KEY_MAX = 10,
|
||||
|
||||
EFUSE_BLK10 = 10, /**< Number of eFuse BLOCK10. SYS_DATA_PART2 */
|
||||
EFUSE_BLK_SYS_DATA_PART2 = 10, /**< Number of eFuse BLOCK10. SYS_DATA_PART2 */
|
||||
|
||||
EFUSE_BLK_MAX
|
||||
} esp_efuse_block_t;
|
||||
|
||||
/**
|
||||
* @brief Type of coding scheme
|
||||
*/
|
||||
typedef enum {
|
||||
EFUSE_CODING_SCHEME_NONE = 0, /**< None */
|
||||
EFUSE_CODING_SCHEME_RS = 3, /**< Reed-Solomon coding */
|
||||
} esp_efuse_coding_scheme_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,53 +0,0 @@
|
||||
// Copyright 2020 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at",
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License
|
||||
|
||||
#include <esp_types.h>
|
||||
#include <esp_err.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Get the RTC calibration efuse version
|
||||
*
|
||||
* @return Version of the stored efuse
|
||||
*/
|
||||
int esp_efuse_rtc_calib_get_ver(void);
|
||||
|
||||
/**
|
||||
* @brief Get the init code in the efuse, for the corresponding attenuation.
|
||||
*
|
||||
* @param version Version of the stored efuse
|
||||
* @param atten Attenuation of the init code
|
||||
* @return The init code stored in efuse
|
||||
*/
|
||||
uint16_t esp_efuse_rtc_calib_get_init_code(int version, int atten);
|
||||
|
||||
/**
|
||||
* @brief Get the calibration digits stored in the efuse, and the corresponding voltage.
|
||||
*
|
||||
* @param version Version of the stored efuse
|
||||
* @param atten Attenuation to use
|
||||
* @param out_digi Output buffer of the digits
|
||||
* @param out_vol_mv Output of the voltage, in mV
|
||||
* @return
|
||||
* - ESP_ERR_INVALID_ARG: If efuse version or attenuation is invalid
|
||||
* - ESP_OK: if success
|
||||
*/
|
||||
esp_err_t esp_efuse_rtc_calib_get_cal_voltage(int version, int atten, uint32_t* out_digi, uint32_t* out_vol_mv);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,70 +0,0 @@
|
||||
// Copyright 2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Type of eFuse blocks ESP32S2
|
||||
*/
|
||||
typedef enum {
|
||||
EFUSE_BLK0 = 0, /**< Number of eFuse BLOCK0. REPEAT_DATA */
|
||||
|
||||
EFUSE_BLK1 = 1, /**< Number of eFuse BLOCK1. MAC_SPI_8M_SYS */
|
||||
|
||||
EFUSE_BLK2 = 2, /**< Number of eFuse BLOCK2. SYS_DATA_PART1 */
|
||||
EFUSE_BLK_SYS_DATA_PART1 = 2, /**< Number of eFuse BLOCK2. SYS_DATA_PART1 */
|
||||
|
||||
EFUSE_BLK3 = 3, /**< Number of eFuse BLOCK3. USER_DATA*/
|
||||
EFUSE_BLK_USER_DATA = 3, /**< Number of eFuse BLOCK3. USER_DATA*/
|
||||
|
||||
EFUSE_BLK4 = 4, /**< Number of eFuse BLOCK4. KEY0 */
|
||||
EFUSE_BLK_KEY0 = 4, /**< Number of eFuse BLOCK4. KEY0 */
|
||||
|
||||
EFUSE_BLK5 = 5, /**< Number of eFuse BLOCK5. KEY1 */
|
||||
EFUSE_BLK_KEY1 = 5, /**< Number of eFuse BLOCK5. KEY1 */
|
||||
|
||||
EFUSE_BLK6 = 6, /**< Number of eFuse BLOCK6. KEY2 */
|
||||
EFUSE_BLK_KEY2 = 6, /**< Number of eFuse BLOCK6. KEY2 */
|
||||
|
||||
EFUSE_BLK7 = 7, /**< Number of eFuse BLOCK7. KEY3 */
|
||||
EFUSE_BLK_KEY3 = 7, /**< Number of eFuse BLOCK7. KEY3 */
|
||||
|
||||
EFUSE_BLK8 = 8, /**< Number of eFuse BLOCK8. KEY4 */
|
||||
EFUSE_BLK_KEY4 = 8, /**< Number of eFuse BLOCK8. KEY4 */
|
||||
|
||||
EFUSE_BLK9 = 9, /**< Number of eFuse BLOCK9. KEY5 */
|
||||
EFUSE_BLK_KEY5 = 9, /**< Number of eFuse BLOCK9. KEY5 */
|
||||
EFUSE_BLK_KEY_MAX = 10,
|
||||
|
||||
EFUSE_BLK10 = 10, /**< Number of eFuse BLOCK10. SYS_DATA_PART2 */
|
||||
EFUSE_BLK_SYS_DATA_PART2 = 10, /**< Number of eFuse BLOCK10. SYS_DATA_PART2 */
|
||||
|
||||
EFUSE_BLK_MAX
|
||||
} esp_efuse_block_t;
|
||||
|
||||
/**
|
||||
* @brief Type of coding scheme
|
||||
*/
|
||||
typedef enum {
|
||||
EFUSE_CODING_SCHEME_NONE = 0, /**< None */
|
||||
EFUSE_CODING_SCHEME_RS = 3, /**< Reed-Solomon coding */
|
||||
} esp_efuse_coding_scheme_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,108 +0,0 @@
|
||||
// Copyright 2017-2018 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "esp_err.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#define RTCCALIB_ESP32S2_ADCCOUNT 2
|
||||
#define RTCCALIB_ESP32S2_ATTENCOUNT 4
|
||||
|
||||
#define RTCCALIB_V1_PARAM_VLOW 0
|
||||
#define RTCCALIB_V1_PARAM_VHIGH 1
|
||||
#define RTCCALIB_V2_PARAM_VHIGH 0
|
||||
#define RTCCALIB_V2_PARAM_VINIT 1
|
||||
|
||||
// these are the tags. Either use them directly or use esp_efuse_rtc_table_get_tag to calculate
|
||||
// the corresponding tag.
|
||||
#define RTCCALIB_V1IDX_A10L 1
|
||||
#define RTCCALIB_V1IDX_A11L 2
|
||||
#define RTCCALIB_V1IDX_A12L 3
|
||||
#define RTCCALIB_V1IDX_A13L 4
|
||||
#define RTCCALIB_V1IDX_A20L 5
|
||||
#define RTCCALIB_V1IDX_A21L 6
|
||||
#define RTCCALIB_V1IDX_A22L 7
|
||||
#define RTCCALIB_V1IDX_A23L 8
|
||||
#define RTCCALIB_V1IDX_A10H 9
|
||||
#define RTCCALIB_V1IDX_A11H 10
|
||||
#define RTCCALIB_V1IDX_A12H 11
|
||||
#define RTCCALIB_V1IDX_A13H 12
|
||||
#define RTCCALIB_V1IDX_A20H 13
|
||||
#define RTCCALIB_V1IDX_A21H 14
|
||||
#define RTCCALIB_V1IDX_A22H 15
|
||||
#define RTCCALIB_V1IDX_A23H 16
|
||||
#define RTCCALIB_V2IDX_A10H 17
|
||||
#define RTCCALIB_V2IDX_A11H 18
|
||||
#define RTCCALIB_V2IDX_A12H 19
|
||||
#define RTCCALIB_V2IDX_A13H 20
|
||||
#define RTCCALIB_V2IDX_A20H 21
|
||||
#define RTCCALIB_V2IDX_A21H 22
|
||||
#define RTCCALIB_V2IDX_A22H 23
|
||||
#define RTCCALIB_V2IDX_A23H 24
|
||||
#define RTCCALIB_V2IDX_A10I 25
|
||||
#define RTCCALIB_V2IDX_A11I 26
|
||||
#define RTCCALIB_V2IDX_A12I 27
|
||||
#define RTCCALIB_V2IDX_A13I 28
|
||||
#define RTCCALIB_V2IDX_A20I 29
|
||||
#define RTCCALIB_V2IDX_A21I 30
|
||||
#define RTCCALIB_V2IDX_A22I 31
|
||||
#define RTCCALIB_V2IDX_A23I 32
|
||||
#define RTCCALIB_IDX_TMPSENSOR 33
|
||||
|
||||
/**
|
||||
* @brief Get rtc calibration version.
|
||||
*/
|
||||
int esp_efuse_rtc_table_read_calib_version(void);
|
||||
|
||||
/**
|
||||
* @brief Helper function to calculate a tag from human-readable parameters.
|
||||
* Tag is used to index the desired data from the efuse.
|
||||
* For example, (1, 1, 3, 1) yields the tag RTCCALIB_V1IDX_A13H
|
||||
* extra params are used for identification when a adc_num-atten combination has
|
||||
* multiple efuse values.
|
||||
* @param adc_channel_num verbatim numbering of the ADC channel. For channel 1, use 1 and not 0.
|
||||
* @param atten attenuation. use the enum value.
|
||||
* @param version the version of the scheme to index for.
|
||||
* @param extra_params defined differently for each version.
|
||||
* */
|
||||
int esp_efuse_rtc_table_get_tag(int version, int adc_channel_num, int atten, int extra_params);
|
||||
|
||||
/**
|
||||
* @brief Fetches a raw value from efuse and does signed bit parsing
|
||||
* @param tag tag obtained with esp_efuse_rtc_table_get_tag
|
||||
*
|
||||
* */
|
||||
int esp_efuse_rtc_table_get_raw_efuse_value(int tag);
|
||||
|
||||
/**
|
||||
* @brief Fetches a raw value from efuse and resolve it to get
|
||||
* the original number that it meant to represent.
|
||||
*
|
||||
* @param tag tag obtained with esp_efuse_rtc_table_get_tag
|
||||
* @param use_zero_inputs Does not perform the raw value fetching before resolving the number,
|
||||
* but proceed as if all zeros were read from efuse.
|
||||
*
|
||||
* */
|
||||
int esp_efuse_rtc_table_get_parsed_efuse_value(int tag, bool skip_efuse_reading);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,70 +0,0 @@
|
||||
// Copyright 2020 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Type of eFuse blocks ESP32S3
|
||||
*/
|
||||
typedef enum {
|
||||
EFUSE_BLK0 = 0, /**< Number of eFuse BLOCK0. REPEAT_DATA */
|
||||
|
||||
EFUSE_BLK1 = 1, /**< Number of eFuse BLOCK1. MAC_SPI_8M_SYS */
|
||||
|
||||
EFUSE_BLK2 = 2, /**< Number of eFuse BLOCK2. SYS_DATA_PART1 */
|
||||
EFUSE_BLK_SYS_DATA_PART1 = 2, /**< Number of eFuse BLOCK2. SYS_DATA_PART1 */
|
||||
|
||||
EFUSE_BLK3 = 3, /**< Number of eFuse BLOCK3. USER_DATA*/
|
||||
EFUSE_BLK_USER_DATA = 3, /**< Number of eFuse BLOCK3. USER_DATA*/
|
||||
|
||||
EFUSE_BLK4 = 4, /**< Number of eFuse BLOCK4. KEY0 */
|
||||
EFUSE_BLK_KEY0 = 4, /**< Number of eFuse BLOCK4. KEY0 */
|
||||
|
||||
EFUSE_BLK5 = 5, /**< Number of eFuse BLOCK5. KEY1 */
|
||||
EFUSE_BLK_KEY1 = 5, /**< Number of eFuse BLOCK5. KEY1 */
|
||||
|
||||
EFUSE_BLK6 = 6, /**< Number of eFuse BLOCK6. KEY2 */
|
||||
EFUSE_BLK_KEY2 = 6, /**< Number of eFuse BLOCK6. KEY2 */
|
||||
|
||||
EFUSE_BLK7 = 7, /**< Number of eFuse BLOCK7. KEY3 */
|
||||
EFUSE_BLK_KEY3 = 7, /**< Number of eFuse BLOCK7. KEY3 */
|
||||
|
||||
EFUSE_BLK8 = 8, /**< Number of eFuse BLOCK8. KEY4 */
|
||||
EFUSE_BLK_KEY4 = 8, /**< Number of eFuse BLOCK8. KEY4 */
|
||||
|
||||
EFUSE_BLK9 = 9, /**< Number of eFuse BLOCK9. KEY5 */
|
||||
EFUSE_BLK_KEY5 = 9, /**< Number of eFuse BLOCK9. KEY5 */
|
||||
EFUSE_BLK_KEY_MAX = 10,
|
||||
|
||||
EFUSE_BLK10 = 10, /**< Number of eFuse BLOCK10. SYS_DATA_PART2 */
|
||||
EFUSE_BLK_SYS_DATA_PART2 = 10, /**< Number of eFuse BLOCK10. SYS_DATA_PART2 */
|
||||
|
||||
EFUSE_BLK_MAX
|
||||
} esp_efuse_block_t;
|
||||
|
||||
/**
|
||||
* @brief Type of coding scheme
|
||||
*/
|
||||
typedef enum {
|
||||
EFUSE_CODING_SCHEME_NONE = 0, /**< None */
|
||||
EFUSE_CODING_SCHEME_RS = 3, /**< Reed-Solomon coding */
|
||||
} esp_efuse_coding_scheme_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -23,15 +23,7 @@ extern "C" {
|
||||
#include "esp_log.h"
|
||||
#include "soc/soc_caps.h"
|
||||
#include "sdkconfig.h"
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
#include "esp32/esp_efuse.h"
|
||||
#elif CONFIG_IDF_TARGET_ESP32S2
|
||||
#include "esp32s2/esp_efuse.h"
|
||||
#elif CONFIG_IDF_TARGET_ESP32S3
|
||||
#include "esp32s3/esp_efuse.h"
|
||||
#elif CONFIG_IDF_TARGET_ESP32C3
|
||||
#include "esp32c3/esp_efuse.h"
|
||||
#endif
|
||||
#include_next "esp_efuse.h"
|
||||
|
||||
#define ESP_ERR_EFUSE 0x1600 /*!< Base error code for efuse api. */
|
||||
#define ESP_OK_EFUSE_CNT (ESP_ERR_EFUSE + 0x01) /*!< OK the required number of bits is set. */
|
||||
@@ -496,48 +488,14 @@ esp_err_t esp_efuse_batch_write_cancel(void);
|
||||
*/
|
||||
esp_err_t esp_efuse_batch_write_commit(void);
|
||||
|
||||
|
||||
#ifndef CONFIG_IDF_TARGET_ESP32
|
||||
|
||||
/**
|
||||
* @brief Type of key purpose
|
||||
* @brief Checks that the given block is empty.
|
||||
*
|
||||
* @return
|
||||
* - True: The block is empty.
|
||||
* - False: The block is not empty or was an error.
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_EFUSE_KEY_PURPOSE_USER = 0,
|
||||
ESP_EFUSE_KEY_PURPOSE_RESERVED = 1,
|
||||
ESP_EFUSE_KEY_PURPOSE_XTS_AES_256_KEY_1 = 2,
|
||||
ESP_EFUSE_KEY_PURPOSE_XTS_AES_256_KEY_2 = 3,
|
||||
ESP_EFUSE_KEY_PURPOSE_XTS_AES_128_KEY = 4,
|
||||
ESP_EFUSE_KEY_PURPOSE_HMAC_DOWN_ALL = 5,
|
||||
ESP_EFUSE_KEY_PURPOSE_HMAC_DOWN_JTAG = 6,
|
||||
ESP_EFUSE_KEY_PURPOSE_HMAC_DOWN_DIGITAL_SIGNATURE = 7,
|
||||
ESP_EFUSE_KEY_PURPOSE_HMAC_UP = 8,
|
||||
ESP_EFUSE_KEY_PURPOSE_SECURE_BOOT_DIGEST0 = 9,
|
||||
ESP_EFUSE_KEY_PURPOSE_SECURE_BOOT_DIGEST1 = 10,
|
||||
ESP_EFUSE_KEY_PURPOSE_SECURE_BOOT_DIGEST2 = 11,
|
||||
ESP_EFUSE_KEY_PURPOSE_MAX,
|
||||
} esp_efuse_purpose_t;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Returns a pointer to a key purpose for an efuse key block.
|
||||
*
|
||||
* @param[in] block A key block in the range EFUSE_BLK_KEY0..EFUSE_BLK_KEY_MAX
|
||||
*
|
||||
* To get the value of this field use esp_efuse_read_field_blob() or esp_efuse_get_key_purpose().
|
||||
*
|
||||
* @return Pointer: If Successful returns a pointer to the corresponding efuse field otherwise NULL.
|
||||
*/
|
||||
const esp_efuse_desc_t **esp_efuse_get_purpose_field(esp_efuse_block_t block);
|
||||
|
||||
/**
|
||||
* @brief Returns a pointer to a key block.
|
||||
*
|
||||
* @param[in] block A key block in the range EFUSE_BLK_KEY0..EFUSE_BLK_KEY_MAX
|
||||
*
|
||||
* @return Pointer: If Successful returns a pointer to the corresponding efuse field otherwise NULL.
|
||||
*/
|
||||
const esp_efuse_desc_t** esp_efuse_get_key(esp_efuse_block_t block);
|
||||
bool esp_efuse_block_is_empty(esp_efuse_block_t block);
|
||||
|
||||
/**
|
||||
* @brief Returns a read protection for the key block.
|
||||
@@ -585,6 +543,62 @@ bool esp_efuse_get_key_dis_write(esp_efuse_block_t block);
|
||||
*/
|
||||
esp_err_t esp_efuse_set_key_dis_write(esp_efuse_block_t block);
|
||||
|
||||
/**
|
||||
* @brief Returns true if the key block is unused, false otherwise.
|
||||
*
|
||||
* An unused key block is all zero content, not read or write protected,
|
||||
* and has purpose 0 (ESP_EFUSE_KEY_PURPOSE_USER)
|
||||
*
|
||||
* @param block key block to check.
|
||||
*
|
||||
* @return
|
||||
* - True if key block is unused,
|
||||
* - False if key block is used or the specified block index is not a key block.
|
||||
*/
|
||||
bool esp_efuse_key_block_unused(esp_efuse_block_t block);
|
||||
|
||||
#ifndef CONFIG_IDF_TARGET_ESP32
|
||||
|
||||
/**
|
||||
* @brief Type of key purpose
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_EFUSE_KEY_PURPOSE_USER = 0,
|
||||
ESP_EFUSE_KEY_PURPOSE_RESERVED = 1,
|
||||
ESP_EFUSE_KEY_PURPOSE_XTS_AES_256_KEY_1 = 2,
|
||||
ESP_EFUSE_KEY_PURPOSE_XTS_AES_256_KEY_2 = 3,
|
||||
ESP_EFUSE_KEY_PURPOSE_XTS_AES_128_KEY = 4,
|
||||
ESP_EFUSE_KEY_PURPOSE_HMAC_DOWN_ALL = 5,
|
||||
ESP_EFUSE_KEY_PURPOSE_HMAC_DOWN_JTAG = 6,
|
||||
ESP_EFUSE_KEY_PURPOSE_HMAC_DOWN_DIGITAL_SIGNATURE = 7,
|
||||
ESP_EFUSE_KEY_PURPOSE_HMAC_UP = 8,
|
||||
ESP_EFUSE_KEY_PURPOSE_SECURE_BOOT_DIGEST0 = 9,
|
||||
ESP_EFUSE_KEY_PURPOSE_SECURE_BOOT_DIGEST1 = 10,
|
||||
ESP_EFUSE_KEY_PURPOSE_SECURE_BOOT_DIGEST2 = 11,
|
||||
ESP_EFUSE_KEY_PURPOSE_MAX,
|
||||
} esp_efuse_purpose_t;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Returns a pointer to a key purpose for an efuse key block.
|
||||
*
|
||||
* @param[in] block A key block in the range EFUSE_BLK_KEY0..EFUSE_BLK_KEY_MAX
|
||||
*
|
||||
* To get the value of this field use esp_efuse_read_field_blob() or esp_efuse_get_key_purpose().
|
||||
*
|
||||
* @return Pointer: If Successful returns a pointer to the corresponding efuse field otherwise NULL.
|
||||
*/
|
||||
const esp_efuse_desc_t **esp_efuse_get_purpose_field(esp_efuse_block_t block);
|
||||
|
||||
/**
|
||||
* @brief Returns a pointer to a key block.
|
||||
*
|
||||
* @param[in] block A key block in the range EFUSE_BLK_KEY0..EFUSE_BLK_KEY_MAX
|
||||
*
|
||||
* @return Pointer: If Successful returns a pointer to the corresponding efuse field otherwise NULL.
|
||||
*/
|
||||
const esp_efuse_desc_t** esp_efuse_get_key(esp_efuse_block_t block);
|
||||
|
||||
/**
|
||||
* @brief Returns the current purpose set for an efuse key block.
|
||||
*
|
||||
@@ -660,20 +674,6 @@ esp_efuse_block_t esp_efuse_find_unused_key_block(void);
|
||||
*/
|
||||
unsigned esp_efuse_count_unused_key_blocks(void);
|
||||
|
||||
/**
|
||||
* @brief Returns true if the key block is unused, false otherwise.
|
||||
*
|
||||
* An unused key block is all zero content, not read or write protected,
|
||||
* and has purpose 0 (ESP_EFUSE_KEY_PURPOSE_USER)
|
||||
*
|
||||
* @param block key block to check.
|
||||
*
|
||||
* @return
|
||||
* - True if key block is unused,
|
||||
* - False if key block is used or the specified block index is not a key block.
|
||||
*/
|
||||
bool esp_efuse_key_block_unused(esp_efuse_block_t block);
|
||||
|
||||
/**
|
||||
* @brief Returns the status of the Secure Boot public key digest revocation bit.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user