Skip to content

Latest commit

 

History

31 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CryptoBootloader for MSP430FR5994

Integration of Texas Instruments's CryptoBSL on the MSP430FR5994, a secure bootloader implementing AES-CCM authenticated encryption and hardware-enforced memory protection for safe field firmware updates.

Developed for ECCOSUR to enable authenticated, encrypted OTA-ready firmware updates in their Holter monitor devices.


Security model

The design follows a CIA triad threat analysis targeting the firmware image as the primary asset during field update transport and loading phases. Identified threats include image tampering, reverse engineering, unauthorized image loading, and loading onto unauthorized devices.

Countermeasures applied:

Threat Attribute Primitive
Reverse engineering Confidentiality AES-CTR (128-bit key)
Image tampering Integrity CBC-MAC
Unauthorized source Authenticity CBC-MAC

The combined mode AES-CCM (hardware accelerated) handles all three attributes in a single pass. Keys are stored encrypted under a KEK (Key Encryption Key) inside the MPU-IPE protected region. Version counters prevent key downgrade attacks.


Architecture

Memory layout

The CryptoBSL occupies a fixed 4 KB region at 0xF000–0xFFFF in the MSP430FR5994's FRAM. The ROM BSL is disabled by writing 0x5555 to BSL signature 1 at 0xFF84, making CryptoBSL the sole entry point.

0x43FFF ┐
        │  Application (high range)   MPU seg 3: RW / RWX
0x10000 ┘
0x0FFFF ┐
        │  IVT, signatures, config    IPE
0x0FF80 ┘
0x0FF7F ┐
        │  CryptoBSL (FRAM)           MPU seg 2: RX + IPE
0x0F000 ┘
0x0EFFF ┐
        │  Application (low range)    MPU seg 1: RW / RWX
0x04000 ┘

MPU + IPE protection

Three MPU segments isolate the bootloader from the application. The CryptoBSL segment additionally carries IPE (Intellectual Property Encapsulation) protection, where only code running within the IPE region can access its data, blocking external access including JTAG. The MPU lock bit (MPULOCK) is set before jumping to the application, preventing the application from modifying the bootloader.

FRAM advantages

The MSP430FR5994's FRAM enables bit-addressable writes without pre-erase, unified memory addressing, and up to 10¹⁵ write cycles simplifying partial image updates, non-volatile key storage, and reset vector management.

Reset vector management

Since CryptoBSL sits in FRAM rather than ROM, it owns the reset vector (0xFFFE–0xFFFF). Incoming application images targeting that address are intercepted and redirected to BSL430_User_Reset, preserving the bootloader's entry point across every reset type (BOR, POC, PUC).


Communication interfaces

Interface Peripheral Pins Config
UART USCI UCA0 TXD: P2.0 / RXD: P2.1 9600 bps, half-duplex, 8N1 + parity
I2C USCI UCB0 SDA: P1.6 / SCL: P1.7 slave, 7-bit addressing

Note: the on-board ez-FET debug chip limits UART to 115200 bps. Use a dedicated FTDI cable on P2.0/P2.1 to reach the theoretical 1 Mbps (DCO @ 8 MHz).


Invocation mechanisms

Four mutually exclusive invocation paths, detected atomically at startup:

Method Trigger
Software Application calls BSL430_ExternalJumptoBSL at 0xFF08 with password 0xC0DE
Hardware GPIO Hold S2 (P5.5) and assert reset — detected via BSL430_Config_Entry = 0x55
Hardware BSL standard TEST + RST/NMI sequence — detected via BSL430_Config_Entry = 0x00
Empty reset vector BSL430_User_Reset == 0xFFFF — no valid application present
Incomplete session BSL430_new_update_started != 0x00 after reset — previous update interrupted

Cryptographic protocol

Packets follow the ROM BSL model: a CryptoBSL command encapsulated by peripheral interface (PI) framing. The AES packet structure is:

[ IV (nonce) | Encrypted payload | MAC tag ]

Encryption uses AES-CTR for confidentiality; CBC-MAC provides the authentication tag. The bootloader reconstructs the plaintext only if the MAC validates, rejecting tampered or unauthorized images silently.

Main commands:

Command ID Auth required
Mass erase 0x15 No
BSL version 0x19 No
Reset 0x25 No
Send data block (encrypted) 0x30 Implicit via MAC
Send encryption key 0x31 Implicit via MAC

Toolchain

Component Details
MCU MSP430FR5994 · 256 KB FRAM + 8 KB SRAM
Dev board MSP-EXP430FR5994 LaunchPad
IDE IAR Embedded Workbench · IAR MSP430 compiler 8.10.2
Logic analyzer Saleae + Logic 2
Flash tool MSP430Flasher
Update scripting BSLScripter 3.4.0.1
Image encryption MSP BSL Encryptor 1.00.00.04

Usage

1. Flash CryptoBSL (full erase):

.\MSP430Flasher.exe -w cryptobsl.txt -e ERASE_TOTAL -v -g

2. Flash application (preserve bootloader):

.\MSP430Flasher.exe -w sampleapp.txt -e ERASE_MAIN -v -g

3. Standard firmware update via BSLScripter:

MODE FRxx UART 9600 COM6 PARITY
VERBOSE
TX_BSL_VERSION
RX_PASSWORD pass32_default.txt
RX_DATA_BLOCK Workspace.txt
CRC_CHECK 0x4000 0x00E6
SET_PC 0x4000

4. Encrypted firmware update via BSLScripter:

MODE FRxx UART 9600 COM6 PARITY
VERBOSE
TX_BSL_VERSION
RX_SECURE_DATA_BLOCK App_Example_Prot_DKey0_Ver1.txt
REBOOT_RESET

Encrypt the firmware image beforehand with MSP BSL Encryptor, providing a DKey file. The encrypted image carries AES metadata overhead, resulting in slightly longer transfer time compared to plaintext.


Context

Final project for the Embedded Systems Specialization (CESE) · FIUBA, Universidad de Buenos Aires. Barcelona, October 2025.

Director: Mg. Ing. Christian Yanez Flores (INTI, UBA)


References

About

AES-CCM crypto bootloader for secure field firmware updates on MSP430FR5994

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages