1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright 2018-2019 NXP
6 #ifndef __CONTAINER_HEADER_H_
7 #define __CONTAINER_HEADER_H_
9 #include <linux/sizes.h>
10 #include <linux/types.h>
13 #define HASH_MAX_LEN 64
15 #define CONTAINER_HDR_ALIGNMENT 0x400
16 #define CONTAINER_HDR_EMMC_OFFSET 0
17 #define CONTAINER_HDR_MMCSD_OFFSET SZ_32K
18 #define CONTAINER_HDR_QSPI_OFFSET SZ_4K
19 #define CONTAINER_HDR_NAND_OFFSET SZ_128M
21 #define CONTAINER_HDR_TAG 0x87
22 #define CONTAINER_HDR_VERSION 0
24 struct container_hdr {
44 u8 hash[HASH_MAX_LEN];
48 struct signature_block_hdr {
60 struct generate_key_blob_hdr {
71 int get_container_size(ulong addr, u16 *header_length);
73 static inline bool valid_container_hdr(struct container_hdr *container)
75 return container->tag == CONTAINER_HDR_TAG &&
76 container->version == CONTAINER_HDR_VERSION;