summaryrefslogtreecommitdiffstats
path: root/common/optee.c
blob: d542dde118548937d8afc78e2bf549154f08760f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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;
}