Commit 27648b83 authored by David Brown's avatar David Brown Committed by David Brown
Browse files

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: default avatarMarko Kiiskila <marko@runtime.io>
Signed-off-by: default avatarDavid Brown <david.brown@linaro.org>
parent d7838095
Loading
Loading
Loading
Loading
+4 −4
Changes for boot/bootutil/include/bootutil/image.h: 4 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -52,10 +52,10 @@ struct flash_area;
/*
 * 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;
+4 −4
Changes for doc/design.txt: 4 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -90,10 +90,10 @@ struct image_tlv {
/*
 * 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.
+4 −4
Changes for scripts/imgtool/image.py: 4 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -20,10 +20,10 @@ IMAGE_F = {
        '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

+4 −4
Changes for sim/src/tlv.rs: 4 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -29,10 +29,10 @@ bitflags! {
#[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 {