mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-04 05:04:33 +02:00
Merge branch 'bugfix/secure_boot_v2_doc_correction' into 'master'
docs: fix salt length in secure-boot-v2 guide See merge request espressif/esp-idf!16286
This commit is contained in:
@@ -127,25 +127,27 @@ static esp_err_t image_load(esp_image_load_mode_t mode, const esp_partition_pos_
|
|||||||
uint32_t checksum_word = ESP_ROM_CHECKSUM_INITIAL;
|
uint32_t checksum_word = ESP_ROM_CHECKSUM_INITIAL;
|
||||||
uint32_t *checksum = (do_verify) ? &checksum_word : NULL;
|
uint32_t *checksum = (do_verify) ? &checksum_word : NULL;
|
||||||
bootloader_sha256_handle_t sha_handle = NULL;
|
bootloader_sha256_handle_t sha_handle = NULL;
|
||||||
|
bool verify_sha;
|
||||||
#if (SECURE_BOOT_CHECK_SIGNATURE == 1)
|
#if (SECURE_BOOT_CHECK_SIGNATURE == 1)
|
||||||
/* used for anti-FI checks */
|
/* used for anti-FI checks */
|
||||||
uint8_t image_digest[HASH_LEN] = { [ 0 ... 31] = 0xEE };
|
uint8_t image_digest[HASH_LEN] = { [ 0 ... 31] = 0xEE };
|
||||||
uint8_t verified_digest[HASH_LEN] = { [ 0 ... 31 ] = 0x01 };
|
uint8_t verified_digest[HASH_LEN] = { [ 0 ... 31 ] = 0x01 };
|
||||||
#endif
|
#endif
|
||||||
#if CONFIG_SECURE_BOOT_V2_ENABLED
|
|
||||||
// For Secure Boot V2, we do verify signature on bootloader which includes the SHA calculation.
|
|
||||||
bool verify_sha = do_verify;
|
|
||||||
#else // Secure boot not enabled
|
|
||||||
// For secure boot V1 on ESP32, we don't calculate SHA or verify signature on bootloaders.
|
|
||||||
// (For non-secure boot, we don't verify any SHA-256 hash appended to the bootloader because
|
|
||||||
// esptool.py may have rewritten the header - rely on esptool.py having verified the bootloader at flashing time, instead.)
|
|
||||||
bool verify_sha = (part->offset != ESP_BOOTLOADER_OFFSET) && do_verify;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (data == NULL || part == NULL) {
|
if (data == NULL || part == NULL) {
|
||||||
return ESP_ERR_INVALID_ARG;
|
return ESP_ERR_INVALID_ARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_SECURE_BOOT_V2_ENABLED
|
||||||
|
// For Secure Boot V2, we do verify signature on bootloader which includes the SHA calculation.
|
||||||
|
verify_sha = do_verify;
|
||||||
|
#else // Secure boot not enabled
|
||||||
|
// For secure boot V1 on ESP32, we don't calculate SHA or verify signature on bootloaders.
|
||||||
|
// (For non-secure boot, we don't verify any SHA-256 hash appended to the bootloader because
|
||||||
|
// esptool.py may have rewritten the header - rely on esptool.py having verified the bootloader at flashing time, instead.)
|
||||||
|
verify_sha = (part->offset != ESP_BOOTLOADER_OFFSET) && do_verify;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (part->size > SIXTEEN_MB) {
|
if (part->size > SIXTEEN_MB) {
|
||||||
err = ESP_ERR_INVALID_ARG;
|
err = ESP_ERR_INVALID_ARG;
|
||||||
FAIL_LOAD("partition size 0x%x invalid, larger than 16MB", part->size);
|
FAIL_LOAD("partition size 0x%x invalid, larger than 16MB", part->size);
|
||||||
|
@@ -132,7 +132,7 @@ The content of each signature block is shown in the following table:
|
|||||||
- Pre-calculated M’, derived from ‘n’
|
- Pre-calculated M’, derived from ‘n’
|
||||||
* - 812
|
* - 812
|
||||||
- 384
|
- 384
|
||||||
- RSA-PSS Signature result (section 8.1.1 of RFC8017) of image content, computed using following PSS parameters: SHA256 hash, MFG1 function, 0 length salt, default trailer field (0xBC).
|
- RSA-PSS Signature result (section 8.1.1 of RFC8017) of image content, computed using following PSS parameters: SHA256 hash, MFG1 function, salt length 32 bytes, default trailer field (0xBC).
|
||||||
* - 1196
|
* - 1196
|
||||||
- 4
|
- 4
|
||||||
- CRC32 of the preceding 1095 bytes.
|
- CRC32 of the preceding 1095 bytes.
|
||||||
|
Reference in New Issue
Block a user