+9
−8
Loading
Remove the key_id field from the image header. There are two problems with this field. First, it is only an integer offset, and so causes an unnecessarily tight coupling between the particular keys built into the bootloader, and the key that is used to sign. Second, it makes the key_id part of the image header, which is included in the signature. This makes it impossible to later sign the image with a different signature. Instead of the key-id, add a TLV KEYHASH entry. This will hold the SHA256 of the public key that the signature is against. Each signature placed in the TLV should be preceeded by this entry to indicate the public key used. The signature check will check each signature, and if the KEYHASH is known and the signature type is supported, it will be checked. As long as at least one signature is considered valid, the image will be considered signed. This also allows the image to be signed with multiple signatures to support having different devices with possibly different keys compiled into the bootloaders. 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>
CRA Git | Maintained and supported by SUSTech CRA and CCSE