|
CycloneBOOT 2.6.6
Secure Bootloader for ARM Cortex-M MCU
|
CycloneBOOT Image management. More...
#include "boot_config.h"#include "compiler_port.h"#include "core/cboot_error.h"#include "image_format.h"#include "core/crypto.h"#include "memory/memory.h"#include "core/verify.h"#include "security/cipher.h"Go to the source code of this file.
Classes | |
| struct | Image |
| Image context definition. More... | |
| struct | ImageProcessContext |
| Image Process context definition. More... | |
Macros | |
| #define | IMAGE_INPUT_ENCRYPTED DISABLED |
| #define | IMAGE_OUTPUT_ENCRYPTED DISABLED |
| #define | IMAGE_MAX_CHECK_DATA_SIZE 512 |
| #define | IMAGE_HEADER_VERSION_MAJOR 1 |
| #define | IMAGE_HEADER_VERSION_MINOR 3 |
| #define | IMAGE_HEADER_VERSION_PATCH 0 |
| #define | IMAGE_HEADER_VERSION |
| #define | IMAGE_HEADER_VERSION_GET_MAJOR(version) (((version) >> 16) & 0xFF) |
| #define | IMAGE_HEADER_VERSION_GET_MINOR(version) (((version) >> 8) & 0xFF) |
| #define | IMAGE_HEADER_VERSION_GET_PATCH(version) ((version) & 0xFF) |
Typedefs | |
| typedef bool_t(* | ImageAntiRollbackCallback) (ImageVersion currentAppVersion, ImageVersion updateAppVersion) |
| Image Anti-Rollback callback definition. | |
Enumerations | |
| enum | ImageState { IMAGE_STATE_IDLE , IMAGE_STATE_RECV_APP_HEADER , IMAGE_STATE_RECV_APP_DATA , IMAGE_STATE_RECV_APP_CHECK , IMAGE_STATE_VALIDATE_APP , IMAGE_STATE_APP_REBOOT , IMAGE_STATE_WRITE_APP_INIT , IMAGE_STATE_WRITE_APP_HEADER , IMAGE_STATE_WRITE_APP_DATA , IMAGE_STATE_WRITE_APP_CHECK , IMAGE_STATE_WRITE_APP_END } |
| Image states. | |
| enum | ImageVersionComparisonFlag { IMAGE_VERSION_EQUAL , IMAGE_VERSION_SUPERIOR , IMAGE_VERSION_INFERIOR } |
| Image version comparison flags definition. | |
Functions | |
| bool_t | imageSafeAdd32 (uint32_t a, uint32_t b, uint32_t *sum) |
| Overflow-safe addition of two 32-bit image geometry values. | |
| bool_t | imageFitsSlot (const ImageHeader *header, size_t slotSize) |
| Check that an image (header, data and CRC32 tag) fits in a slot. | |
| bool_t | imageIsBootImage (const ImageHeader *header) |
| Check whether an image holds a bootloader. | |
| cboot_error_t | imageCheckHeader (ImageHeader *header) |
| Check Internal Image header validity. | |
| cboot_error_t | imageGetHeader (uint8_t *buffer, size_t bufferLen, ImageHeader **header) |
| Get image header from data buffer. | |
| cboot_error_t | imageComputeHeaderCrc (ImageHeader *header) |
| Compute image header crc and store it in the image header crc field. The given input header will also be the outout image header. | |
| cboot_error_t | imageCheckIntegrity (Image *image) |
| Verifies the complete image integrity. | |
CycloneBOOT Image management.
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2021-2026 Oryx Embedded SARL. All rights reserved.
This file is part of CycloneBOOT Open.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
| #define IMAGE_HEADER_VERSION |
| cboot_error_t imageCheckHeader | ( | ImageHeader * | header | ) |
Check Internal Image header validity.
| [in] | header | Pointer to the internal image header to be checked |
| cboot_error_t imageCheckIntegrity | ( | Image * | image | ) |
Verifies the complete image integrity.
| [in/out] | image Pointer to the image we want to verify. |
| cboot_error_t imageComputeHeaderCrc | ( | ImageHeader * | header | ) |
Compute image header crc and store it in the image header crc field. The given input header will also be the outout image header.
| [in/out] | header Pointer the header on which to calculate the crc. |
| bool_t imageFitsSlot | ( | const ImageHeader * | header, |
| size_t | slotSize | ||
| ) |
| cboot_error_t imageGetHeader | ( | uint8_t * | buffer, |
| size_t | bufferLen, | ||
| ImageHeader ** | header | ||
| ) |
Get image header from data buffer.
| [in] | buffer | Data buffer containing the image header |
| [in] | bufferLen | Data buffer length |
| [out] | header | Pointer to the header structure to be returned |
| bool_t imageIsBootImage | ( | const ImageHeader * | header | ) |
Check whether an image holds a bootloader.
| [in] | header | Image header |
| bool_t imageSafeAdd32 | ( | uint32_t | a, |
| uint32_t | b, | ||
| uint32_t * | sum | ||
| ) |
Overflow-safe addition of two 32-bit image geometry values.
| [in] | a | First addend |
| [in] | b | Second addend |
| [out] | sum | Receives a + b when it fits in uint32_t |