[PATCH 09/18] optee: add header version check
Marco Felsch
m.felsch at pengutronix.de
Thu Jan 11 03:48:32 PST 2024
OPTEE supports two header versions right now we do only support V1.
Signed-off-by: Marco Felsch <m.felsch at pengutronix.de>
---
common/optee.c | 5 +++++
include/tee/optee.h | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/common/optee.c b/common/optee.c
index fd2b03d06d2d..6a8084839619 100644
--- a/common/optee.c
+++ b/common/optee.c
@@ -14,6 +14,11 @@ int optee_verify_header(struct optee_header *hdr)
return -EINVAL;
}
+ if (hdr->version != OPTEE_VERSION_V1) {
+ pr_err("Only V1 headers are supported right now\n");
+ return -EINVAL;
+ }
+
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");
diff --git a/include/tee/optee.h b/include/tee/optee.h
index 607f5072d385..b5ba0a71d7c9 100644
--- a/include/tee/optee.h
+++ b/include/tee/optee.h
@@ -14,7 +14,8 @@
#include <linux/errno.h>
#define OPTEE_MAGIC 0x4554504f
-#define OPTEE_VERSION 1
+#define OPTEE_VERSION_V1 1
+#define OPTEE_VERSION_V2 2
#define OPTEE_ARCH_ARM32 0
#define OPTEE_ARCH_ARM64 1
--
2.39.2
More information about the barebox
mailing list