common/spl: handle properly images with bad checksum
authorMikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Tue, 10 Jun 2025 09:56:31 +0000 (12:56 +0300)
committerTom Rini <trini@konsulko.com>
Thu, 19 Jun 2025 17:01:51 +0000 (11:01 -0600)
commit3eb43c54fadba457f22e415a2821145164efe662
tree055bfb39d45abe615e9c7bccbac22b026f3c2f8e
parent3704b888a4cabac8daea20a4504d513bc47153ca
common/spl: handle properly images with bad checksum

load_simple_fit() returns -EPERM for the images with broken signatures.
Unfortunately this may conflict with image loaging selection on the base
of boot phase. See commit 873112db9ce68c38984ff25808dde726f8dd5573
("spl: Support selecting images based on phase in simple FIT").

Thus loading of

configurations {
uboot {
description = "u-boot";
firmware = "atf";
loadables = "atf", "tee", "uboot";
};
};

with damaged "tee" image may finish without errors. This may results in
board bricking.

This patch fixes commit 873112db9ce68c38984ff25808dde726f8dd5573
("spl: Support selecting images based on phase in simple FIT")
by replacing EPERM with EBADSLT places where it should be done.

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
common/spl/spl_fit.c