On 2026-09-22T12:36:21, Aristo Chen <[email protected]> wrote:
> tools: mkimage: resolve image-data references between FIT images
>
> An image node may carry an 'image-data' property naming another image
> node under /images whose binary data it shares. This lets several
> configurations load the same payload at different addresses without
> storing it twice, as described in the 'Shared image data' section of
> the Flat Image Tree specification [1].
>
> Resolve the references in mkimage after any external data has been
> imported: the target's data is copied into the referencing node, so the
> later ciphering, hashing and signing steps see a normal image node. The
> property itself is retained in the resolved FIT as a record of the
> sharing relationship. When mkimage re-processes a FIT that already
> contains resolved references, the node's data must match the target's
> data exactly, and fit_resolve_image_data() skips its own pack and
> rewrite of the file when no payload needed copying.
>
> A reference is rejected when the target does not exist, when the target
> itself carries an image-data property (chained references), when the
> node's existing data disagrees with the target, or when the node mixes
> image-data with external data properties. The last case is caught
> before the import when compiling a source file, where the combination
> cannot be legitimate; a re-processed FIT carries both on purpose, since
> that is the resolved form with external data. Since encryption happens
> per node, sharing encrypted data is only accepted when both nodes use
> the same algorithm and key together with the same iv-name-hint or,
> when neither uses a hint, the same explicit iv; anything else,
> including the independent random IV generated when a node provides no
> IV at all, would produce different ciphertexts.
>
> [1] https://github.com/open-source-firmware/flat-image-tree
>
> Signed-off-by: Aristo Chen <[email protected]>
>
> include/image.h   |   2 +
>  tools/fit_image.c | 358 
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 360 insertions(+)

Reviewed-by: Simon Glass <[email protected]>

Reply via email to