Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/test-custom-tlv-simulator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,51 @@ jobs:
- name: Run get_tlv simulator test
run: |
[ x`./wolfboot.elf get_tlv 2>/dev/null| tail -1` = xAABBCCDDEEFF0011223344 ]

custom_tlv_large_simulator_tests:
runs-on: ubuntu-latest
container:
image: ghcr.io/wolfssl/wolfboot-ci-sim:v1.0
timeout-minutes: 15

steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: Trust workspace
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"

- name: make clean
run: |
make distclean

- name: Select config
run: |
cp config/examples/sim.config .config

- name: Build tools
run: |
make -C tools/keytools && make -C tools/bin-assemble

- name: Build wolfboot.elf and test-app/image.elf with a 2KB header
run: |
make clean && make IMAGE_HEADER_SIZE=2048

- name: Sign the image with 300-byte buffer and file custom TLVs
run: |
VAL=`printf 'A5%.0s' $(seq 1 300)`
head -c 300 /dev/zero | tr '\0' '\245' > large_tlv.bin
IMAGE_HEADER_SIZE=2048 tools/keytools/sign --ed25519 --custom-tlv-buffer 0x0034 $VAL --custom-tlv-file 0x0035 large_tlv.bin test-app/image.elf wolfboot_signing_private_key.der 1

- name: Re-assemble the internal_flash.dd image file
run: |
make assemble_internal_flash.dd IMAGE_HEADER_SIZE=2048

- name: Run get_tlv simulator test on the 300-byte buffer TLV
run: |
[ x`./wolfboot.elf get_tlv 2>/dev/null| tail -1` = x`printf 'A5%.0s' $(seq 1 300)` ]

- name: Run get_tlv simulator test on the 300-byte file TLV (tag 0x35)
run: |
[ x`./wolfboot.elf get_tlv=53 2>/dev/null| tail -1` = x`printf 'A5%.0s' $(seq 1 300)` ]
17 changes: 15 additions & 2 deletions docs/Signing.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,17 +255,30 @@ Provides a value to be set with a custom tag
* `--custom-tlv-buffer tag value`: Adds a TLV entry with arbitrary length to the manifest
header, corresponding to the type identified by `tag`, and assigns the value `value`. The
tag is a 16-bit number. Valid tags are in the range between 0x0030 and 0xFEFE. The length
is implicit, and is the length of the value.
is implicit, and is the length of the value. The maximum length is 65535 bytes.
Value argument is in the form of a hex string, e.g. `--custom-tlv-buffer 0x0030 AABBCCDDEE`
will add a TLV entry with tag 0x0030, length 5 and value 0xAABBCCDDEE.

* `--custom-tlv-string tag ascii-string`: Adds a TLV entry with arbitrary length to the manifest
header, corresponding to the type identified by `tag`, and assigns the value of `ascii-string`. The
tag is a 16-bit number. Valid tags are in the range between 0x0030 and 0xFEFE. The length
is implicit, and is the length of the `ascii-string`. `ascii-string` argument is in the form of a string,
is implicit, and is the length of the `ascii-string`. The maximum length is 65535 bytes.
`ascii-string` argument is in the form of a string,
e.g. `--custom-tlv-string 0x0030 "Version-1"` will add a TLV entry with tag 0x0030,
length 9 and value Version-1.

* `--custom-tlv-file tag filename`: Adds a TLV entry with arbitrary length to the manifest
header, corresponding to the type identified by `tag`, with the value read as raw bytes
from the file `filename`. The tag is a 16-bit number. Valid tags are in the range between
0x0030 and 0xFEFE. The length is implicit, and is the size of the file. The maximum length
is 65535 bytes. Unlike `--custom-tlv-buffer`, the value is not passed on the command line,
so large binary values are not subject to the OS argument length limits.

If the custom TLVs do not fit in the configured header size, the sign tool automatically
increases the size of the manifest header, rounding up to the next power of two. wolfBoot
must be built with a matching `IMAGE_HEADER_SIZE`, or it will fail to locate the firmware
image at boot.

#### Three-steps signing using external provisioning tools

If the private key is not accessible, while it's possible to sign payloads using
Expand Down
Loading
Loading