On 2026-09-12T12:44:46, Aristo Chen <[email protected]> wrote:
> tools: mkimage: use an explicit iv from the cipher node when encrypting
>
> fit_image_setup_cipher() only consumes iv-name-hint: without the hint a
> fresh random IV is generated for every image, and any iv property the
> cipher node already carries is ignored and later overwritten. The FIT
> specification defines iv as the raw initialisation vector carried in
> the FIT and requires at least one of iv-name-hint or iv to be present,
> so an .its author who supplies an explicit iv reasonably expects it to
> be used.
>
> Use the iv property when no iv-name-hint is given, after checking that
> its length matches the cipher's IV length, and only fall back to a
> random IV when the node provides neither. Besides matching the
> specification this makes encryption reproducible, since the same
> source, key and IV now produce the same ciphertext on every run. It
> also allows images that share data through the image-data property,
> added later in this series, to be encrypted consistently without
> relying on an IV file in the key directory.
>
> Signed-off-by: Aristo Chen <[email protected]>
>
> tools/image-host.c | 18 ++++++++++++++++--
>  1 file changed, 16 insertions(+), 2 deletions(-)

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

Reply via email to