[PATCH v2 08/18] optee: add support to verify 64-bit headers as well

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Rouven Czerwinski <r.czerwinski@xxxxxxxxxxxxxx>

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@xxxxxxxxxxxxxx>
Signed-off-by: Marco Felsch <m.felsch@xxxxxxxxxxxxxx>
---
 common/optee.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/common/optee.c b/common/optee.c
index 32a6c0a15b94..fd2b03d06d2d 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;
 	}
 
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux