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>
diff --git a/boot/bootutil/include/bootutil/image.h b/boot/bootutil/include/bootutil/image.h
index a1541b8..12819bc 100644
--- a/boot/bootutil/include/bootutil/image.h
+++ b/boot/bootutil/include/bootutil/image.h
@@ -52,10 +52,10 @@
/*
* Image trailer TLV types.
*/
-#define IMAGE_TLV_SHA256 1 /* SHA256 of image hdr and body */
-#define IMAGE_TLV_RSA2048 2 /* RSA2048 of hash output */
-#define IMAGE_TLV_ECDSA224 3 /* ECDSA of hash output */
-#define IMAGE_TLV_ECDSA256 4 /* ECDSA of hash output */
+#define IMAGE_TLV_SHA256 0x10 /* SHA256 of image hdr and body */
+#define IMAGE_TLV_RSA2048 0x20 /* RSA2048 of hash output */
+#define IMAGE_TLV_ECDSA224 0x21 /* ECDSA of hash output */
+#define IMAGE_TLV_ECDSA256 0x22 /* ECDSA of hash output */
struct image_version {
uint8_t iv_major;
diff --git a/doc/design.txt b/doc/design.txt
index 8894304..409147f 100644
--- a/doc/design.txt
+++ b/doc/design.txt
@@ -90,10 +90,10 @@
/*
* Image trailer TLV types.
*/
-#define IMAGE_TLV_SHA256 1 /* SHA256 of image hdr and body */
-#define IMAGE_TLV_RSA2048 2 /* RSA2048 of hash output */
-#define IMAGE_TLV_ECDSA224 3 /* ECDSA of hash output */
-#define IMAGE_TLV_ECDSA256 4 /* ECDSA of hash output */
+#define IMAGE_TLV_SHA256 0x10 /* SHA256 of image hdr and body */
+#define IMAGE_TLV_RSA2048 0x20 /* RSA2048 of hash output */
+#define IMAGE_TLV_ECDSA224 0x21 /* ECDSA of hash output */
+#define IMAGE_TLV_ECDSA256 0x22 /* ECDSA of hash output */
Optional type-length-value records (TLVs) containing image metadata are placed
after the end of the image.
diff --git a/scripts/imgtool/image.py b/scripts/imgtool/image.py
index 4cb6662..cd031be 100644
--- a/scripts/imgtool/image.py
+++ b/scripts/imgtool/image.py
@@ -20,10 +20,10 @@
'PKCS1_PSS_RSA2048_SHA256': 0x0000040, }
TLV_VALUES = {
- 'SHA256': 1,
- 'RSA2048': 2,
- 'ECDSA224': 3,
- 'ECDSA256': 4, }
+ 'SHA256': 0x10,
+ 'RSA2048': 0x20,
+ 'ECDSA224': 0x21,
+ 'ECDSA256': 0x22, }
TLV_HEADER_SIZE = 4
diff --git a/sim/src/tlv.rs b/sim/src/tlv.rs
index 59bdf2c..f4c88b0 100644
--- a/sim/src/tlv.rs
+++ b/sim/src/tlv.rs
@@ -29,10 +29,10 @@
#[derive(Copy, Clone, PartialEq, Eq)]
#[allow(dead_code)] // TODO: For now
pub enum TlvKinds {
- SHA256 = 1,
- RSA2048 = 2,
- ECDSA224 = 3,
- ECDSA256 = 4,
+ SHA256 = 0x10,
+ RSA2048 = 0x20,
+ ECDSA224 = 0x21,
+ ECDSA256 = 0x22,
}
pub struct TlvGen {