summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRouven Czerwinski <r.czerwinski@pengutronix.de>2024-01-16 18:07:28 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2024-01-19 08:55:59 +0100
commit5f2f1f5fc1a9fd987d7aa3d227e3606a082e608e (patch)
treeccc6614aa906d31e9114a3f621e73c4f3cbd86e6
parentcf6bad3c356677604edcbd2e5f32b200e15812bb (diff)
downloadbarebox-5f2f1f5fc1a9.tar.gz
barebox-5f2f1f5fc1a9.tar.xz
optee: add support to verify 64-bit headers as well
Guard the check by IS_ENABLED() to make it possible to verify 32-bit and 64-bit optee headers. Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20240116170738.209954-9-m.felsch@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--common/optee.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/common/optee.c b/common/optee.c
index 32a6c0a15b..fd2b03d06d 100644
--- a/common/optee.c
+++ b/common/optee.c
@@ -14,8 +14,14 @@ int optee_verify_header(struct optee_header *hdr)
return -EINVAL;
}
- if (hdr->arch != OPTEE_ARCH_ARM32 || hdr->init_load_addr_hi) {
- pr_err("Only 32bit supported\n");
+ if (IS_ENABLED(CPU_V7) &&
+ (hdr->arch != OPTEE_ARCH_ARM32 || hdr->init_load_addr_hi)) {
+ pr_err("Wrong OP-TEE Arch for ARM v7 CPU\n");
+ return -EINVAL;
+ }
+
+ if (IS_ENABLED(CPU_V8) && hdr->arch != OPTEE_ARCH_ARM64) {
+ pr_err("Wrong OP-TEE Arch for ARM v8 CPU\n");
return -EINVAL;
}