Skip to content

Commit b0fa070

Browse files
committed
Added support for treating external FRAM as internal flash. Added check on image header size and sector size. Expanded the ML-DSA testing. Improved the Vorago build_test scripts to use .config for parameters. Made EDAC parameters build-time macros.
1 parent f89eb94 commit b0fa070

File tree

21 files changed

+322
-61
lines changed

21 files changed

+322
-61
lines changed

.github/workflows/test-configs.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -463,11 +463,12 @@ jobs:
463463

464464
# TODO: ti-tms570lc435.config requires CCS_ROOT
465465

466-
vorago_va416x0_test:
467-
uses: ./.github/workflows/test-build.yml
468-
with:
469-
arch: arm
470-
config-file: ./config/examples/vorago_va416x0.config
466+
# Cannot run on CI without the SDK (see VORAGO_SDK_DIR)
467+
# vorago_va416x0_test:
468+
# uses: ./.github/workflows/test-build.yml
469+
# with:
470+
# arch: arm
471+
# config-file: ./config/examples/vorago_va416x0.config
471472

472473
x86_64_efi_test:
473474
uses: ./.github/workflows/test-build.yml

.github/workflows/test-renode-nrf52.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,23 @@ jobs:
6161

6262
# LMS TEST
6363
- name: Renode Tests LMS-8-5-5
64-
run: ./tools/renode/docker-test.sh "SIGN=LMS LMS_LEVELS=2 LMS_HEIGHT=5 LMS_WINTERNITZ=8 WOLFBOOT_SMALL_STACK=0 IMAGE_SIGNATURE_SIZE=2644 IMAGE_HEADER_SIZE=5288"
64+
run: ./tools/renode/docker-test.sh "SIGN=LMS LMS_LEVELS=2 LMS_HEIGHT=5 LMS_WINTERNITZ=8 WOLFBOOT_SMALL_STACK=0 IMAGE_SIGNATURE_SIZE=2644 IMAGE_HEADER_SIZE=5288 WOLFBOOT_SECTOR_SIZE=0x2000"
6565

6666
# XMSS TEST
6767
- name: Renode Tests XMSS-SHA2_10_256
68-
run: ./tools/renode/docker-test.sh "SIGN=XMSS XMSS_PARAMS='XMSS-SHA2_10_256' WOLFBOOT_SMALL_STACK=0 IMAGE_SIGNATURE_SIZE=2500 IMAGE_HEADER_SIZE=5000"
68+
run: ./tools/renode/docker-test.sh "SIGN=XMSS XMSS_PARAMS='XMSS-SHA2_10_256' WOLFBOOT_SMALL_STACK=0 IMAGE_SIGNATURE_SIZE=2500 IMAGE_HEADER_SIZE=5000 WOLFBOOT_SECTOR_SIZE=0x2000"
6969

70-
# ML-DSA TEST
70+
# ML-DSA Level 2 TEST
7171
- name: Renode Tests ML-DSA-44
72-
run: ./tools/renode/docker-test.sh "SIGN=ML_DSA ML_DSA_LEVEL=2 WOLFBOOT_SMALL_STACK=0 IMAGE_SIGNATURE_SIZE=2420 IMAGE_HEADER_SIZE=4840"
72+
run: ./tools/renode/docker-test.sh "SIGN=ML_DSA ML_DSA_LEVEL=2 WOLFBOOT_SMALL_STACK=0 IMAGE_SIGNATURE_SIZE=2420 IMAGE_HEADER_SIZE=4840 WOLFBOOT_SECTOR_SIZE=0x2000"
7373

74+
# ML-DSA Level 3 TEST
75+
- name: Renode Tests ML-DSA-65
76+
run: ./tools/renode/docker-test.sh "SIGN=ML_DSA ML_DSA_LEVEL=3 WOLFBOOT_SMALL_STACK=0 IMAGE_SIGNATURE_SIZE=3309 IMAGE_HEADER_SIZE=8192 WOLFBOOT_SECTOR_SIZE=0x2000"
77+
78+
# ML-DSA Level 5 TEST
79+
- name: Renode Tests ML-DSA-87
80+
run: ./tools/renode/docker-test.sh "SIGN=ML_DSA ML_DSA_LEVEL=5 WOLFBOOT_SMALL_STACK=0 IMAGE_SIGNATURE_SIZE=4627 IMAGE_HEADER_SIZE=12288 WOLFBOOT_SECTOR_SIZE=0x3000"
7481

7582
- name: Upload Output Dir
7683
uses: actions/upload-artifact@v4

.github/workflows/test-sunnyday-simulator.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,12 @@ jobs:
104104
- name: Run dualbank swap simulation
105105
run: |
106106
tools/scripts/sim-dualbank-swap-update.sh
107-
107+
108108
- name: Cleanup before WOLFBOOT_SMALL_STACK test
109109
run: |
110110
make keysclean
111111
mv .config.orig .config
112-
112+
113113
- name: Build wolfboot.elf (ECC256, WOLFBOOT_SMALL_STACK)
114114
run: |
115115
make clean && make test-sim-internal-flash-with-update SIGN=ECC256 WOLFBOOT_SMALL_STACK=1 SPMATH=1
@@ -617,10 +617,18 @@ jobs:
617617
run: |
618618
tools/scripts/sim-pq-sunnyday-update.sh config/examples/sim-xmss.config
619619
620-
- name: Run sunny day ML-DSA update test
620+
- name: Run sunny day ML-DSA level 2 update test
621621
run: |
622622
tools/scripts/sim-pq-sunnyday-update.sh config/examples/sim-ml-dsa.config
623623
624+
- name: Run sunny day ML-DSA level 3 update test
625+
run: |
626+
tools/scripts/sim-pq-sunnyday-update.sh config/examples/sim-ml-dsa3.config
627+
628+
- name: Run sunny day ML-DSA level 5 update test
629+
run: |
630+
tools/scripts/sim-pq-sunnyday-update.sh config/examples/sim-ml-dsa5.config
631+
624632
# 64 Bit simulator, Hybrid auth ML_DSA + ECDSA
625633
#
626634
- name: make clean

config/examples/sim-ml-dsa.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ IMAGE_HEADER_SIZE=8192
4949
# ML_DSA_LEVEL=5
5050
# IMAGE_SIGNATURE_SIZE=4627
5151
# IMAGE_HEADER_SIZE=12288
52-
# This example needsd larger sector size.
52+
# NOTE: This example needs larger sector size.
5353
# WOLFBOOT_SECTOR_SIZE=0x3000
5454
#
5555

config/examples/sim-ml-dsa3.config

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# ML-DSA signature example, based on sim.config example.
2+
#
3+
# The acceptable parameter values are those in FIPS 204:
4+
#
5+
# ML_DSA_LEVEL = {2, 3, 5}
6+
#
7+
# This corresponds to these security levels (from FIPS 204, Table 1.):
8+
#
9+
# Claimed Security Strength
10+
# ML-DSA-44 Category 2
11+
# ML-DSA-65 Category 3
12+
# ML-DSA-87 Category 5
13+
#
14+
# The signature, pub key, and priv key lengths are all a function
15+
# of this parameter. Refer to this table (from FIPS 204, Table 2.)
16+
# to configure your IMAGE_SIGNATURE_SIZE:
17+
#
18+
# Table 2. Sizes (in bytes) of keys and signatures of ML-DSA
19+
#
20+
# Private Key Public Key Signature Size
21+
# ML-DSA-44 2560 1312 2420
22+
# ML-DSA-65 4032 1952 3309
23+
# ML-DSA-87 4896 2592 4627
24+
#
25+
26+
ARCH=sim
27+
TARGET=sim
28+
SIGN=ML_DSA
29+
HASH=SHA256
30+
WOLFBOOT_SMALL_STACK=0
31+
SPI_FLASH=0
32+
DEBUG=0
33+
DELTA_UPDATES=0
34+
35+
#
36+
# ML-DSA config examples:
37+
#
38+
# Category 3:
39+
ML_DSA_LEVEL=3
40+
IMAGE_SIGNATURE_SIZE=3309
41+
IMAGE_HEADER_SIZE=8192
42+
43+
# sizes should be multiple of system page size
44+
WOLFBOOT_PARTITION_SIZE=0x40000
45+
WOLFBOOT_SECTOR_SIZE=0x2000
46+
WOLFBOOT_PARTITION_BOOT_ADDRESS=0x20000
47+
# if on external flash, it should be multiple of system page size
48+
WOLFBOOT_PARTITION_UPDATE_ADDRESS=0x60000
49+
WOLFBOOT_PARTITION_SWAP_ADDRESS=0xA0000
50+
51+
# required for keytools
52+
WOLFBOOT_FIXED_PARTITIONS=1

config/examples/sim-ml-dsa5.config

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# ML-DSA signature example, based on sim.config example.
2+
#
3+
# The acceptable parameter values are those in FIPS 204:
4+
#
5+
# ML_DSA_LEVEL = {2, 3, 5}
6+
#
7+
# This corresponds to these security levels (from FIPS 204, Table 1.):
8+
#
9+
# Claimed Security Strength
10+
# ML-DSA-44 Category 2
11+
# ML-DSA-65 Category 3
12+
# ML-DSA-87 Category 5
13+
#
14+
# The signature, pub key, and priv key lengths are all a function
15+
# of this parameter. Refer to this table (from FIPS 204, Table 2.)
16+
# to configure your IMAGE_SIGNATURE_SIZE:
17+
#
18+
# Table 2. Sizes (in bytes) of keys and signatures of ML-DSA
19+
#
20+
# Private Key Public Key Signature Size
21+
# ML-DSA-44 2560 1312 2420
22+
# ML-DSA-65 4032 1952 3309
23+
# ML-DSA-87 4896 2592 4627
24+
#
25+
26+
ARCH=sim
27+
TARGET=sim
28+
SIGN=ML_DSA
29+
HASH=SHA256
30+
WOLFBOOT_SMALL_STACK=0
31+
SPI_FLASH=0
32+
DEBUG=0
33+
DELTA_UPDATES=0
34+
35+
#
36+
# ML-DSA config examples:
37+
#
38+
# Category 5:
39+
ML_DSA_LEVEL=5
40+
IMAGE_SIGNATURE_SIZE=4627
41+
IMAGE_HEADER_SIZE=12288
42+
43+
# sizes should be multiple of system page size
44+
WOLFBOOT_PARTITION_SIZE=0x40000
45+
# This example needs larger sector size.
46+
WOLFBOOT_SECTOR_SIZE=0x3000
47+
WOLFBOOT_PARTITION_BOOT_ADDRESS=0x20000
48+
# if on external flash, it should be multiple of system page size
49+
WOLFBOOT_PARTITION_UPDATE_ADDRESS=0x60000
50+
WOLFBOOT_PARTITION_SWAP_ADDRESS=0xA0000
51+
52+
# required for keytools
53+
WOLFBOOT_FIXED_PARTITIONS=1

config/examples/vorago_va416x0.config

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
11
ARCH?=ARM
22
CORTEX_M4?=1
33
TARGET?=va416x0
4+
5+
# ECDSA P384 and SHA384
46
SIGN?=ECC384
57
HASH?=SHA384
68
IMAGE_HEADER_SIZE=512
9+
10+
# ML-DSA Level 5 (87)
11+
#SIGN=ML_DSA
12+
#HASH=SHA256
13+
#ML_DSA_LEVEL=5
14+
#IMAGE_SIGNATURE_SIZE=4627
15+
#IMAGE_HEADER_SIZE=12288
16+
717
WOLFBOOT_VERSION?=1
818
ARMORED?=1
919
DEBUG?=0
1020
DEBUG_SYMBOLS?=1
1121
DEBUG_UART?=1
1222
VTOR?=1
13-
EXT_FLASH?=1
23+
EXT_FLASH?=0
1424
SPI_FLASH?=0
1525
NO_XIP?=1
1626
NVM_FLASH_WRITEONCE?=0
@@ -35,19 +45,34 @@ NO_ARM_ASM?=0
3545
# Optional: Use smaller SHA512
3646
#CFLAGS_EXTRA+=-DUSE_SLOW_SHA512
3747

38-
# 2KB sector
39-
WOLFBOOT_SECTOR_SIZE?=0x800
40-
4148
# 38KB boot, 108KB partitions, 2KB swap
49+
WOLFBOOT_SECTOR_SIZE?=0x800
4250
WOLFBOOT_PARTITION_SIZE?=0x1B000
4351
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x9800
4452
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x24800
4553
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x3F800
4654

55+
# ML-DSA 5: 36KB boot, 104KB partitions, 12KB swap
56+
#WOLFBOOT_SECTOR_SIZE?=0x3000
57+
#WOLFBOOT_PARTITION_SIZE?=0x1A000
58+
#WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x9000
59+
#WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x23000
60+
#WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x3D000
61+
62+
# Debug: 64KB boot, 95KB partitions, 2KB swap
63+
#WOLFBOOT_SECTOR_SIZE?=0x800
64+
#WOLFBOOT_PARTITION_SIZE?=0x18000
65+
#WOLFBOOT_PARTITION_BOOT_ADDRESS?=0xFC00
66+
#WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x27C00
67+
#WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x3FC00
68+
4769
# Vorago SDK common drivers directory
4870
VORAGO_SDK_DIR?=$(PWD)/../VA416xx_SDK/
4971

5072
# Use Verago FRAM driver
5173
USE_HAL_SPI_FRAM=1
5274

5375
#CFLAGS_EXTRA+=-DDEBUG_EXT_FLASH
76+
77+
#CFLAGS_EXTRA+=-DWOLFBOOT_EDAC_RAM_SCRUB=1000
78+
#CFLAGS_EXTRA+=-DWOLFBOOT_EDAC_ROM_SCRUB=125

docs/PQ.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ In terms of relative tradeoffs:
2626
See these config files for simulated target examples:
2727

2828
- `config/examples/sim-ml-dsa.config`
29+
- `config/examples/sim-ml-dsa3.config`
30+
- `config/examples/sim-ml-dsa5.config`
2931
- `config/examples/sim-lms.config`
3032
- `config/examples/sim-xmss.config`
3133

@@ -60,15 +62,16 @@ all depend on the parameter set:
6062

6163
### ML-DSA Config
6264

63-
A new ML-DSA sim example has been added here:
65+
See ML-DSA sim examples here:
6466

6567
```
6668
config/examples/sim-ml-dsa.config
69+
config/examples/sim-ml-dsa3.config
70+
config/examples/sim-ml-dsa5.config
6771
```
6872

6973
The security category level is configured with `ML_DSA_LEVEL=<num>`, where
70-
num = 2, 3, 5. Here is an example from the `sim-ml-dsa.config` for category
71-
2:
74+
num = 2, 3, 5. Here is an example for level 2:
7275

7376
```
7477
# ML-DSA config examples:

docs/Targets.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3586,12 +3586,12 @@ FLASH: The VA41630 has 256KB of internal SPI FRAM (for the VA41620 its external)
35863586

35873587
Default flash layout:
35883588

3589-
| Partition | Size | Address | Description |
3590-
|-----------|-------|---------|-------------|
3591-
| Boot | 38KB | 0x0 | Bootloader partition |
3592-
| Boot | 108KB | 0x9800 | Boot partition |
3593-
| Update | 108KB | 0x24800 | Update partition |
3594-
| Swap | 2KB | 0x3F800 | Swap area |
3589+
| Partition | Size | Address | Description |
3590+
|-------------|-------|---------|-------------|
3591+
| Bootloader | 38KB | 0x0 | Bootloader partition |
3592+
| Application | 108KB | 0x9800 | Boot partition |
3593+
| Update | 108KB | 0x24800 | Update partition |
3594+
| Swap | 2KB | 0x3F800 | Swap area |
35953595

35963596
SRAM: 64KB on-chip SRAM and 256KB on-chip instruction/program memory
35973597

hal/imx_rt.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767

6868
/* #define DEBUG_EXT_FLASH */
6969

70-
#ifdef __WOLFBOOT
7170

7271
/** Built-in ROM API for bootloaders **/
7372

@@ -850,7 +849,7 @@ static int hal_flash_init(void);
850849

851850
void hal_init(void)
852851
{
853-
#ifdef WOLFSSL_IMXRT_DCP
852+
#if defined(__WOLFBOOT) && defined(WOLFSSL_IMXRT_DCP)
854853
wc_dcp_init();
855854
#endif
856855
ARM_MPU_Disable();
@@ -866,8 +865,6 @@ void hal_prepare_boot(void)
866865
{
867866
}
868867

869-
#endif /* __WOLFBOOT */
870-
871868
static int RAMFUNCTION hal_flash_init(void)
872869
{
873870
status_t ret = 0;

0 commit comments

Comments
 (0)