Skip to content

Commit dcd8f41

Browse files
committed
Added Vorago VA416x0 wolfBoot support
Added check on image header size and sector size. Expanded the ML-DSA testing.
1 parent d513adc commit dcd8f41

35 files changed

+1915
-76
lines changed

.github/workflows/test-configs.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,13 @@ jobs:
463463

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

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
472+
466473
x86_64_efi_test:
467474
uses: ./.github/workflows/test-build.yml
468475
with:

.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

arch.mk

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,26 @@ ifeq ($(ARCH),ARM)
266266
CFLAGS+=-DWOLFBOOT_USE_STDLIBC
267267
endif
268268

269+
ifeq ($(TARGET),va416x0)
270+
CFLAGS+=-I$(WOLFBOOT_ROOT)/include/vorago/ \
271+
-I$(VORAGO_SDK_DIR)/common/drivers/hdr/ \
272+
-I$(VORAGO_SDK_DIR)/common/mcu/hdr/ \
273+
-I$(VORAGO_SDK_DIR)/common/utils/hdr/
274+
SDK_OBJS=$(VORAGO_SDK_DIR)/common/drivers/src/va416xx_hal.o \
275+
$(VORAGO_SDK_DIR)/common/drivers/src/va416xx_hal_spi.o \
276+
$(VORAGO_SDK_DIR)/common/drivers/src/va416xx_hal_clkgen.o \
277+
$(VORAGO_SDK_DIR)/common/drivers/src/va416xx_hal_ioconfig.o \
278+
$(VORAGO_SDK_DIR)/common/drivers/src/va416xx_hal_irqrouter.o \
279+
$(VORAGO_SDK_DIR)/common/drivers/src/va416xx_hal_uart.o \
280+
$(VORAGO_SDK_DIR)/common/drivers/src/va416xx_hal_timer.o \
281+
$(VORAGO_SDK_DIR)/common/mcu/src/system_va416xx.o
282+
ifeq ($(USE_HAL_SPI_FRAM),1)
283+
SDK_OBJS+=$(VORAGO_SDK_DIR)/common/utils/src/spi_fram.o
284+
CFLAGS+=-DUSE_HAL_SPI_FRAM
285+
endif
286+
OBJS+=$(SDK_OBJS)
287+
endif
288+
269289
## Cortex CPU
270290

271291
ifeq ($(CORTEX_A5),1)

config/examples/sim-ml-dsa-ecc-hybrid.config

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ SIGN_SECONDARY=ECC384
1313

1414
# sizes should be multiple of system page size
1515
WOLFBOOT_PARTITION_SIZE=0x40000
16-
WOLFBOOT_SECTOR_SIZE=0x1000
16+
# sector size must be larger than IMAGE_HEADER_SIZE
17+
WOLFBOOT_SECTOR_SIZE=0x2000
1718
WOLFBOOT_PARTITION_BOOT_ADDRESS=0x80000
1819
# if on external flash, it should be multiple of system page size
1920
WOLFBOOT_PARTITION_UPDATE_ADDRESS=0x100000

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
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
ARCH?=ARM
2+
CORTEX_M4?=1
3+
TARGET?=va416x0
4+
5+
# ECDSA P384 and SHA384
6+
SIGN?=ECC384
7+
HASH?=SHA384
8+
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+
17+
WOLFBOOT_VERSION?=1
18+
ARMORED?=1
19+
DEBUG?=0
20+
DEBUG_SYMBOLS?=1
21+
DEBUG_UART?=1
22+
VTOR?=1
23+
EXT_FLASH?=0
24+
SPI_FLASH?=0
25+
NO_XIP?=1
26+
NVM_FLASH_WRITEONCE?=0
27+
UART_FLASH?=0
28+
V?=0
29+
NO_MPU?=1
30+
RAM_CODE?=0
31+
SPMATH?=1
32+
DUALBANK_SWAP?=0
33+
PKA?=0
34+
ENCRYPT=0
35+
WOLFTPM?=0
36+
OPTIMIZATION_LEVEL=1
37+
38+
# Optionally allow downgrade to older valid version in update partition
39+
ALLOW_DOWNGRADE?=0
40+
41+
# Use assembly version of ECDSA and SHA
42+
NO_ASM?=0
43+
NO_ARM_ASM?=0
44+
45+
# Optional: Use smaller SHA512
46+
#CFLAGS_EXTRA+=-DUSE_SLOW_SHA512
47+
48+
# 38KB boot, 108KB partitions, 2KB swap
49+
WOLFBOOT_SECTOR_SIZE?=0x800
50+
WOLFBOOT_PARTITION_SIZE?=0x1B000
51+
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x9800
52+
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x24800
53+
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x3F800
54+
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+
69+
# Vorago SDK common drivers directory
70+
VORAGO_SDK_DIR?=$(PWD)/../VA416xx_SDK/
71+
72+
# Use Verago FRAM driver
73+
USE_HAL_SPI_FRAM=1
74+
75+
#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:

0 commit comments

Comments
 (0)