Skip to content

Commit 27648b8

Browse files
committed
Renumber the TLV type values
In preparation for moving the signature related values out of the main image header and into the TLV, renumber the existing TLV values to be grouped together better. The SHA256 is moved into the first group, at 0x10, and the signature values themselves are moved to start with 0x20. This change is the first in a series of changes toward the new v1.0 image format. The intermediate results are all internally consistent (meaning that the simulator, and the builtin imgtool.py will all work together), but until all patches are applied, the image format is not valid with any external tools. Based on work by Marko Kiiskila <marko@runtime.io>. Signed-off-by: Marko Kiiskila <marko@runtime.io> Signed-off-by: David Brown <david.brown@linaro.org>
1 parent d783809 commit 27648b8

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

boot/bootutil/include/bootutil/image.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ struct flash_area;
5252
/*
5353
* Image trailer TLV types.
5454
*/
55-
#define IMAGE_TLV_SHA256 1 /* SHA256 of image hdr and body */
56-
#define IMAGE_TLV_RSA2048 2 /* RSA2048 of hash output */
57-
#define IMAGE_TLV_ECDSA224 3 /* ECDSA of hash output */
58-
#define IMAGE_TLV_ECDSA256 4 /* ECDSA of hash output */
55+
#define IMAGE_TLV_SHA256 0x10 /* SHA256 of image hdr and body */
56+
#define IMAGE_TLV_RSA2048 0x20 /* RSA2048 of hash output */
57+
#define IMAGE_TLV_ECDSA224 0x21 /* ECDSA of hash output */
58+
#define IMAGE_TLV_ECDSA256 0x22 /* ECDSA of hash output */
5959

6060
struct image_version {
6161
uint8_t iv_major;

doc/design.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ struct image_tlv {
9090
/*
9191
* Image trailer TLV types.
9292
*/
93-
#define IMAGE_TLV_SHA256 1 /* SHA256 of image hdr and body */
94-
#define IMAGE_TLV_RSA2048 2 /* RSA2048 of hash output */
95-
#define IMAGE_TLV_ECDSA224 3 /* ECDSA of hash output */
96-
#define IMAGE_TLV_ECDSA256 4 /* ECDSA of hash output */
93+
#define IMAGE_TLV_SHA256 0x10 /* SHA256 of image hdr and body */
94+
#define IMAGE_TLV_RSA2048 0x20 /* RSA2048 of hash output */
95+
#define IMAGE_TLV_ECDSA224 0x21 /* ECDSA of hash output */
96+
#define IMAGE_TLV_ECDSA256 0x22 /* ECDSA of hash output */
9797

9898
Optional type-length-value records (TLVs) containing image metadata are placed
9999
after the end of the image.

scripts/imgtool/image.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
'PKCS1_PSS_RSA2048_SHA256': 0x0000040, }
2121

2222
TLV_VALUES = {
23-
'SHA256': 1,
24-
'RSA2048': 2,
25-
'ECDSA224': 3,
26-
'ECDSA256': 4, }
23+
'SHA256': 0x10,
24+
'RSA2048': 0x20,
25+
'ECDSA224': 0x21,
26+
'ECDSA256': 0x22, }
2727

2828
TLV_HEADER_SIZE = 4
2929

sim/src/tlv.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ bitflags! {
2929
#[derive(Copy, Clone, PartialEq, Eq)]
3030
#[allow(dead_code)] // TODO: For now
3131
pub enum TlvKinds {
32-
SHA256 = 1,
33-
RSA2048 = 2,
34-
ECDSA224 = 3,
35-
ECDSA256 = 4,
32+
SHA256 = 0x10,
33+
RSA2048 = 0x20,
34+
ECDSA224 = 0x21,
35+
ECDSA256 = 0x22,
3636
}
3737

3838
pub struct TlvGen {

0 commit comments

Comments
 (0)