Commit cd28406e authored by Fabio Utzig's avatar Fabio Utzig Committed by Fabio Utzig
Browse files

Fix image creation without sign/encryption

Generating images with no signature or encryption was broken by commit
06b77b83

This allows generating images with just sha256 again, and fixes a few
leftovers from the imghash TLV change.

Signed-off-by: default avatarFabio Utzig <utzig@apache.org>
parent 71a697a4
Loading
Loading
Loading
Loading
−1
Changes for scripts/imgtool.py: 0 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -158,7 +158,6 @@ def sign(key, align, version, header_size, pad_header, slot_size, pad,
            raise Exception("Encryption only available with RSA")
        if key and not isinstance(key, (keys.RSA2048, keys.RSA2048Public)):
            raise Exception("Encryption with sign only available with RSA")
    if key or enckey:
    img.create(key, enckey)

    if pad:
+3 −6
Changes for scripts/imgtool/image.py: 3 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -148,7 +148,7 @@ class Image():
                raise Exception(msg)

    def create(self, key, enckey):
        self.add_header(key, enckey)
        self.add_header(enckey)

        tlv = TLV(self.endian)

@@ -189,11 +189,8 @@ class Image():

        self.payload += tlv.get()

    def add_header(self, key, enckey):
        """Install the image header.

        The key is needed to know the type of signature, and
        approximate the size of the signature."""
    def add_header(self, enckey):
        """Install the image header."""

        flags = 0
        if enckey is not None: