mirror of
https://github.com/espressif/esp-idf.git
synced 2026-09-26 22:00:39 +03:00
feat(esp_image_verify): split image verification out of bootloader_support
This commit is contained in:
committed by
Mahavir Jain
parent
b912691fcd
commit
e7af5c69d9
48
components/bootloader_support/include/bootloader_sha_flash.h
Normal file
48
components/bootloader_support/include/bootloader_sha_flash.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "esp_err.h"
|
||||
#include "soc/soc_caps.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @brief Generates the SHA-256 digest of flash contents between offset and offset+length.
|
||||
*
|
||||
* Reads in MMU-sized chunks, so it handles images larger than the MMU window
|
||||
* (3.2 MB / 50 pages of 64 KB).
|
||||
*
|
||||
* @param[in] flash_offset Byte offset in flash.
|
||||
* @param[in] len Length of data in bytes.
|
||||
* @param[out] digest 32-byte buffer for the resulting SHA-256 digest.
|
||||
*
|
||||
* @return ESP_OK on success; ESP_ERR_NO_MEM if allocation fails.
|
||||
*
|
||||
* @note Defined in the esp_image_verify component; calling it in builds without
|
||||
* that component fails at link time with an undefined reference.
|
||||
*/
|
||||
esp_err_t bootloader_sha256_flash_contents(uint32_t flash_offset, uint32_t len, uint8_t *digest);
|
||||
|
||||
#if SOC_SHA_SUPPORT_SHA384 && SOC_ECDSA_SUPPORT_CURVE_P384
|
||||
/** @brief Generates the SHA-384 digest of flash contents between offset and offset+length.
|
||||
*
|
||||
* @param[in] flash_offset Byte offset in flash.
|
||||
* @param[in] len Length of data in bytes.
|
||||
* @param[out] digest 48-byte buffer for the resulting SHA-384 digest.
|
||||
*
|
||||
* @return ESP_OK on success; ESP_ERR_NO_MEM if allocation fails.
|
||||
*
|
||||
* @note Defined in the esp_image_verify component; calling it in builds without
|
||||
* that component fails at link time with an undefined reference.
|
||||
*/
|
||||
esp_err_t bootloader_sha384_flash_contents(uint32_t flash_offset, uint32_t len, uint8_t *digest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user