mirror of https://github.com/wolfSSL/wolfBoot.git
Improve documentation for new custom TLV.
parent
e3669245d5
commit
2826f70ca7
|
@ -185,7 +185,7 @@ Provides a PCR mask and digest to be signed and included in the header. The sign
|
||||||
Provides a value to be set with a custom tag
|
Provides a value to be set with a custom tag
|
||||||
|
|
||||||
* `--custom-tlv tag len val`: Adds a TLV entry to the manifest header, corresponding
|
* `--custom-tlv tag len val`: Adds a TLV entry to the manifest header, corresponding
|
||||||
to the type identified by `tag`, with lenght `len` bytes, and assigns the value `val`.
|
to the type identified by `tag`, with length `len` bytes, and assigns the value `val`.
|
||||||
Values can be decimal or hex numbers (prefixed by '0x'). The tag is a 16-bit number.
|
Values can be decimal or hex numbers (prefixed by '0x'). The tag is a 16-bit number.
|
||||||
Valid tags are in the range between 0x0030 and 0xFEFE.
|
Valid tags are in the range between 0x0030 and 0xFEFE.
|
||||||
|
|
||||||
|
|
|
@ -77,17 +77,18 @@ The output image `test-app/image_v4_signed.bin` will contain the custom field wi
|
||||||
From the bootloader code, we can then retrieve the value of the custom field using the `wolfBoot_find_header` function:
|
From the bootloader code, we can then retrieve the value of the custom field using the `wolfBoot_find_header` function:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
uint32_t custom_code34_field;
|
uint32_t value;
|
||||||
const uint16_t custom_code34_field_size = 4;
|
uint8_t* ptr = NULL;
|
||||||
const uint16_t custom_code34_tag = 0x34;
|
uint16_t tlv = 0x34;
|
||||||
int size;
|
uint8_t* imageHdr = (uint8_t*)WOLFBOOT_PARTITION_BOOT_ADDRESS; /* WOLFBOOT_PARTITION_UPDATE_ADDRESS */
|
||||||
|
uint16_t size = wolfBoot_find_header(imageHdr, tlv, &ptr);
|
||||||
size = wolfBoot_find_header(0x34, &custom_code34_field, sizeof(custom_code34_value));
|
if (size != sizeof(uint32_t) || ptr == NULL) {
|
||||||
if (size != custom_code34_field_size) {
|
|
||||||
/* Error: the field is not present or has the wrong size */
|
/* Error: the field is not present or has the wrong size */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* From here, the value 0xAABBCCDD is stored in custom_code34_value */
|
/* From here, the value 0xAABBCCDD is at ptr */
|
||||||
|
memcpy(&value, ptr, size);
|
||||||
|
printf("TLV 0x%x=0x%x\n", tlv, value);
|
||||||
```
|
```
|
||||||
|
|
||||||
### Image signing tool
|
### Image signing tool
|
||||||
|
|
Loading…
Reference in New Issue