diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2020-02-18 08:36:45 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2020-02-18 08:36:45 +0100 |
commit | 801119922cb086ea7fc9f9194253a180d40581cb (patch) | |
tree | db40f3a353c683ef16b771f11450e689fab32393 /common/optee.c | |
parent | d69b7f3d693887c755671bffab677362f4e4a0b6 (diff) | |
parent | af1a0da42f9493b2d4266580b15d52946b326ca7 (diff) | |
download | barebox-801119922cb086ea7fc9f9194253a180d40581cb.tar.gz barebox-801119922cb086ea7fc9f9194253a180d40581cb.tar.xz |
Merge branch 'for-next/optee'
Diffstat (limited to 'common/optee.c')
-rw-r--r-- | common/optee.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/common/optee.c b/common/optee.c new file mode 100644 index 0000000000..d542dde118 --- /dev/null +++ b/common/optee.c @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0 + +#define pr_fmt(fmt) "optee: " fmt + +#include <tee/optee.h> +#include <printk.h> +#include <asm-generic/errno.h> + +int optee_verify_header(struct optee_header *hdr) +{ + if (hdr->magic != OPTEE_MAGIC) { + pr_err("Invalid header magic 0x%08x, expected 0x%08x\n", + hdr->magic, OPTEE_MAGIC); + return -EINVAL; + } + + if (hdr->arch != OPTEE_ARCH_ARM32 || hdr->init_load_addr_hi) { + pr_err("Only 32bit supported\n"); + return -EINVAL; + } + + return 0; +} |