|
CycloneBOOT 2.6.6
Secure Bootloader for ARM Cortex-M MCU
|
Bootloader common functions. More...
#include <inttypes.h>#include "second_stage/boot.h"#include "second_stage/boot_common.h"#include "cmsis_compiler.h"#include "core/crc32.h"#include "debug.h"#include "error.h"#include "image/image.h"#include "image/image_utils.h"#include "second_stage/boot_verify.h"#include "security/verify_runtime.h"#include "cipher/aes.h"#include "cipher/cipher_algorithms.h"#include "cipher_modes/cbc.h"#include "core/crypto.h"#include "security/cipher.h"Macros | |
| #define | TRACE_LEVEL CBOOT_TRACE_LEVEL |
| #define | BOOT_RUNTIME_INTEGRITY_CHECK_ALGO &crc32HashAlgo |
| #define | INSTALL_COPY_CHUNK_SIZE 512 |
Functions | |
| bool_t | bootCheckNoSlotOverlap (Slot *s1, Slot *s2) |
| Verify slot addresses to make sure no slot overlaps occur. | |
| cboot_error_t | bootCheckRuntimeImageIntegrity (BootContext *context, Slot *slot) |
| Check integrity of current running image. | |
| const FlashDriver * | bootGetSlotDriver (const Slot *slot) |
| Resolve the flash driver backing a slot. | |
| cboot_error_t | bootInitPrimaryMem (BootContext *context, BootSettings *settings) |
| Intialize bootloader primary flash memory. | |
| cboot_error_t | bootInitSecondaryMem (BootContext *context, BootSettings *settings) |
| Initialize bootloader secondary (external) flash memory. | |
| cboot_error_t | bootSelectRepairImageSlot (BootContext *context, Slot *selectedSlot) |
| Select a slot holding an image that can repair the running application. Accepts an equal image index, never a lower one. | |
| cboot_error_t | bootSelectUpdateImageSlot (BootContext *context, Slot *selectedSlot) |
| cboot_error_t | bootBackupCurrentApp (BootContext *context, Slot *updateSlot) |
| Back up the running application before an update is installed. The copy is written as is. When the update slots are encrypted the application makes the backup instead, through updateCreateBackup(). | |
| cboot_error_t | bootUpdateApp (BootContext *context, Slot *slot) |
| Update current application. Basically it decrypt/copy an image from the external flash memory into the internal flash memory. | |
| cboot_error_t | bootReadbackVerifyImage (Slot *slot) |
| Read back and verify the image just installed in the given slot. Re-reads the slot from flash and re-checks its CRC32 whole-image integrity. | |
| cboot_error_t | bootCheckImage (BootContext *context, Slot *slot) |
| Check image validity within the given slot. | |
| cboot_error_t | bootCheckRuntimeImage (BootContext *context, Slot *slot) |
| Check signature or integrity of current running image. | |
| cboot_error_t | bootGetSlotImgHeader (Slot *slot, ImageHeader *header) |
| Get header from the image inside the given slot. | |
| cboot_error_t | bootCheckSlotAppResetVector (Slot *slot) |
| Check reset vector of the current application firmware binary. | |
| void | bootChangeState (BootContext *context, BootState newState) |
| Update Bootloader state. | |
Bootloader common functions.
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.
| cboot_error_t bootBackupCurrentApp | ( | BootContext * | context, |
| Slot * | updateSlot | ||
| ) |
Back up the running application before an update is installed. The copy is written as is. When the update slots are encrypted the application makes the backup instead, through updateCreateBackup().
| [in] | context | Pointer to the bootloader context |
| [in] | updateSlot | Slot holding the incoming update image |
| void bootChangeState | ( | BootContext * | context, |
| BootState | newState | ||
| ) |
Update Bootloader state.
| [in] | context | Pointer to the Bootloader context |
| [in] | newState | New state to switch to |
| cboot_error_t bootCheckImage | ( | BootContext * | context, |
| Slot * | slot | ||
| ) |
Check image validity within the given slot.
| [in] | slot | Pointer to the slot containing the image to be checked. |
| cboot_error_t bootCheckRuntimeImage | ( | BootContext * | context, |
| Slot * | slot | ||
| ) |
Check signature or integrity of current running image.
| [in] | slot | Pointer to the slot containing the image to be checked. |
| cboot_error_t bootCheckRuntimeImageIntegrity | ( | BootContext * | context, |
| Slot * | slot | ||
| ) |
Check integrity of current running image.
| [in] | slot | Pointer to the slot containing the image to be checked. |
| cboot_error_t bootCheckSlotAppResetVector | ( | Slot * | slot | ) |
Check reset vector of the current application firmware binary.
| [in] | slot | Pointer to the slot that contains the application firmware binary. |
| const FlashDriver * bootGetSlotDriver | ( | const Slot * | slot | ) |
Resolve the flash driver backing a slot.
| [in] | slot | Pointer to the slot |
| cboot_error_t bootGetSlotImgHeader | ( | Slot * | slot, |
| ImageHeader * | header | ||
| ) |
Get header from the image inside the given slot.
| [in] | slot | Pointer to the slot that contains the image header |
| [out] | header | Pointer that will hold the retrieved image header. |
| cboot_error_t bootInitPrimaryMem | ( | BootContext * | context, |
| BootSettings * | settings | ||
| ) |
Intialize bootloader primary flash memory.
| [in,out] | context | Pointer the bootloader context. |
| [in] | settings | Bootloader user settings used to initialize primary flash. |
| cboot_error_t bootInitSecondaryMem | ( | BootContext * | context, |
| BootSettings * | settings | ||
| ) |
Initialize bootloader secondary (external) flash memory.
| [in,out] | context | Pointer the bootloader context. |
| [in] | settings | Bootloader user settings used to initialize secondary flash. |
| cboot_error_t bootReadbackVerifyImage | ( | Slot * | slot | ) |
Read back and verify the image just installed in the given slot. Re-reads the slot from flash and re-checks its CRC32 whole-image integrity.
| [in] | slot | Pointer to the freshly written destination slot. |
| cboot_error_t bootSelectRepairImageSlot | ( | BootContext * | context, |
| Slot * | selectedSlot | ||
| ) |
Select a slot holding an image that can repair the running application. Accepts an equal image index, never a lower one.
| [in] | context | Pointer to the bootloader context |
| [out] | selectedSlot | Slot holding the repair image |
| cboot_error_t bootUpdateApp | ( | BootContext * | context, |
| Slot * | slot | ||
| ) |
Update current application. Basically it decrypt/copy an image from the external flash memory into the internal flash memory.
| [in] | context | Pointer to Bootloader context |
| [in] | slot | Pointer to the slot in the external flash memory that contains the new application |