# so-w-on/cryptoagile_bootloader architecture

> Architecture diagram of the GitHub repository so-w-on/cryptoagile_bootloader, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/so-w-on/cryptoagile_bootloader
- Repository: https://github.com/so-w-on/cryptoagile_bootloader

## Overview

This repository contains STM32F4 firmware examples: an application, a signed bootloader, and a crypto-agile bootloader variant. The bootloader workflow initializes hardware, checks whether the installed application is valid, reports failure or success over UART, and jumps to the application on success. The README describes the signed ECDSA/SHA-256 baseline and future multi-algorithm/PQC work; it does not establish that PQC algorithms are implemented. Bootloader validation and crypto call details are only partly sampled, so those links are marked unverified where appropriate.

Main entry points: [`Cryptoagile_PQC_bootloader/bootloader/Core/Src/main.c`](https://github.com/so-w-on/cryptoagile_bootloader/blob/main/Cryptoagile_PQC_bootloader/bootloader/Core/Src/main.c) (Agile boot flow), [`Signed_bootloader/bootloader/Core/Src/main.c`](https://github.com/so-w-on/cryptoagile_bootloader/blob/main/Signed_bootloader/bootloader/Core/Src/main.c) (Signed boot flow), [`Cryptoagile_PQC_bootloader/bootloader/Core/Src/bl_jump.c`](https://github.com/so-w-on/cryptoagile_bootloader/blob/main/Cryptoagile_PQC_bootloader/bootloader/Core/Src/bl_jump.c) (App validation), [`Cryptoagile_PQC_bootloader/Application/Core/Src/main.c`](https://github.com/so-w-on/cryptoagile_bootloader/blob/main/Cryptoagile_PQC_bootloader/Application/Core/Src/main.c) (Agile application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_boot["Bootloaders"]
  node_crypto_main["Agile boot flow<br/>[main.c]"]
  node_signed_main["Signed boot flow<br/>[main.c]"]
end

subgraph group_app["Applications"]
  node_agile_app["Agile application<br/>[main.c]"]
  node_signed_app["Signed application<br/>[main.c]"]
end

subgraph group_crypto["Signature and crypto"]
  node_agile_verify["App validation<br/>[bl_jump.c]"]
  node_signed_verify["App validation<br/>[bl_jump.c]"]
  node_app_header["App metadata<br/>[app_header.h]"]
  node_tinycrypt["ECC and SHA-256"]
end

subgraph group_platform["Board platform"]
  node_uart_gpio["UART and GPIO<br/>[main.c]"]
  node_board_io["Nucleo board I/O<br/>[stm32f4xx_nucleo.c]"]
end

node_device(("STM32 device"))

node_device -->|"starts"| node_crypto_main
node_crypto_main -->|"initializes and reports"| node_uart_gpio
node_crypto_main -->|"checks app"| node_agile_verify
node_crypto_main -.->|"jumps on success"| node_agile_app
node_agile_verify -.->|"checks metadata"| node_app_header
node_agile_verify -.->|"may verify signature"| node_tinycrypt
node_device -->|"starts"| node_signed_main
node_signed_main -->|"checks app"| node_signed_verify
node_signed_main -.->|"reports status"| node_uart_gpio
node_signed_main -.->|"jumps on success"| node_signed_app
node_signed_verify -.->|"may verify signature"| node_tinycrypt
node_agile_app -.->|"uses board I/O"| node_board_io
node_signed_app -.->|"uses board I/O"| node_board_io

click node_crypto_main "https://github.com/so-w-on/cryptoagile_bootloader/blob/main/Cryptoagile_PQC_bootloader/bootloader/Core/Src/main.c"
click node_signed_main "https://github.com/so-w-on/cryptoagile_bootloader/blob/main/Signed_bootloader/bootloader/Core/Src/main.c"
click node_agile_verify "https://github.com/so-w-on/cryptoagile_bootloader/blob/main/Cryptoagile_PQC_bootloader/bootloader/Core/Src/bl_jump.c"
click node_signed_verify "https://github.com/so-w-on/cryptoagile_bootloader/blob/main/Signed_bootloader/bootloader/Core/Src/bl_jump.c"
click node_app_header "https://github.com/so-w-on/cryptoagile_bootloader/blob/main/Cryptoagile_PQC_bootloader/bootloader/Core/Inc/app_header.h"
click node_tinycrypt "https://github.com/so-w-on/cryptoagile_bootloader/tree/main/Cryptoagile_PQC_bootloader/bootloader/Core/Src/tinycrypt"
click node_agile_app "https://github.com/so-w-on/cryptoagile_bootloader/blob/main/Cryptoagile_PQC_bootloader/Application/Core/Src/main.c"
click node_signed_app "https://github.com/so-w-on/cryptoagile_bootloader/blob/main/Signed_bootloader/Application/Core/Src/main.c"
click node_uart_gpio "https://github.com/so-w-on/cryptoagile_bootloader/blob/main/Cryptoagile_PQC_bootloader/bootloader/Core/Src/main.c"
click node_board_io "https://github.com/so-w-on/cryptoagile_bootloader/blob/main/Cryptoagile_PQC_bootloader/bootloader/Drivers/BSP/STM32F4xx-Nucleo/stm32f4xx_nucleo.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_crypto_main,node_signed_main toneBlue
class node_agile_app,node_signed_app toneAmber
class node_agile_verify,node_signed_verify,node_app_header,node_tinycrypt toneMint
class node_uart_gpio,node_board_io toneRose
class node_device toneIndigo
```

## Components

### Bootloaders

- [Agile boot flow](https://github.com/so-w-on/cryptoagile_bootloader/blob/main/Cryptoagile_PQC_bootloader/bootloader/Core/Src/main.c): `Cryptoagile_PQC_bootloader/bootloader/Core/Src/main.c`
- [Signed boot flow](https://github.com/so-w-on/cryptoagile_bootloader/blob/main/Signed_bootloader/bootloader/Core/Src/main.c): `Signed_bootloader/bootloader/Core/Src/main.c`

### Applications

- [Agile application](https://github.com/so-w-on/cryptoagile_bootloader/blob/main/Cryptoagile_PQC_bootloader/Application/Core/Src/main.c): `Cryptoagile_PQC_bootloader/Application/Core/Src/main.c`
- [Signed application](https://github.com/so-w-on/cryptoagile_bootloader/blob/main/Signed_bootloader/Application/Core/Src/main.c): `Signed_bootloader/Application/Core/Src/main.c`

### Signature and crypto

- [App validation](https://github.com/so-w-on/cryptoagile_bootloader/blob/main/Cryptoagile_PQC_bootloader/bootloader/Core/Src/bl_jump.c): `Cryptoagile_PQC_bootloader/bootloader/Core/Src/bl_jump.c`
- [App validation](https://github.com/so-w-on/cryptoagile_bootloader/blob/main/Signed_bootloader/bootloader/Core/Src/bl_jump.c): `Signed_bootloader/bootloader/Core/Src/bl_jump.c`
- [App metadata](https://github.com/so-w-on/cryptoagile_bootloader/blob/main/Cryptoagile_PQC_bootloader/bootloader/Core/Inc/app_header.h): `Cryptoagile_PQC_bootloader/bootloader/Core/Inc/app_header.h`
- [ECC and SHA-256](https://github.com/so-w-on/cryptoagile_bootloader/tree/main/Cryptoagile_PQC_bootloader/bootloader/Core/Src/tinycrypt): `Cryptoagile_PQC_bootloader/bootloader/Core/Src/tinycrypt`

### Board platform

- [UART and GPIO](https://github.com/so-w-on/cryptoagile_bootloader/blob/main/Cryptoagile_PQC_bootloader/bootloader/Core/Src/main.c): `Cryptoagile_PQC_bootloader/bootloader/Core/Src/main.c`
- [Nucleo board I/O](https://github.com/so-w-on/cryptoagile_bootloader/blob/main/Cryptoagile_PQC_bootloader/bootloader/Drivers/BSP/STM32F4xx-Nucleo/stm32f4xx_nucleo.c): `Cryptoagile_PQC_bootloader/bootloader/Drivers/BSP/STM32F4xx-Nucleo/stm32f4xx_nucleo.c`

### Other components

- **STM32 device**

## Connections

- STM32 device → Agile boot flow: starts
- Agile boot flow → UART and GPIO: initializes and reports (evidence: `Cryptoagile_PQC_bootloader/bootloader/Core/Src/main.c`)
- Agile boot flow → App validation: checks app (evidence: `Cryptoagile_PQC_bootloader/bootloader/Core/Src/main.c`)
- Agile boot flow → Agile application: jumps on success
- App validation → App metadata: checks metadata
- App validation → ECC and SHA-256: may verify signature
- STM32 device → Signed boot flow: starts
- Signed boot flow → App validation: checks app (evidence: `Signed_bootloader/bootloader/Core/Src/main.c`)
- Signed boot flow → UART and GPIO: reports status
- Signed boot flow → Signed application: jumps on success
- App validation → ECC and SHA-256: may verify signature
- Agile application → Nucleo board I/O: uses board I/O
- Signed application → Nucleo board I/O: uses board I/O
