blob: c1e5700859dc13189771547cb4d30548d43539c9 [file] [log] [blame]
Peng Fan7b86cd42019-08-22 07:42:33 +00001/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * Copyright 2018-2019 NXP
4 */
5
6#ifndef __CONTAINER_HEADER_H_
7#define __CONTAINER_HEADER_H_
8
9#include <linux/sizes.h>
10#include <linux/types.h>
11
12#define IV_MAX_LEN 32
13#define HASH_MAX_LEN 64
14
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
20
21struct container_hdr {
22 u8 version;
23 u8 length_lsb;
24 u8 length_msb;
25 u8 tag;
26 u32 flags;
27 u16 sw_version;
28 u8 fuse_version;
29 u8 num_images;
30 u16 sig_blk_offset;
31 u16 reserved;
32} __packed;
33
34struct boot_img_t {
35 u32 offset;
36 u32 size;
37 u64 dst;
38 u64 entry;
39 u32 hab_flags;
40 u32 meta;
41 u8 hash[HASH_MAX_LEN];
42 u8 iv[IV_MAX_LEN];
43} __packed;
44
45struct signature_block_hdr {
46 u8 version;
47 u8 length_lsb;
48 u8 length_msb;
49 u8 tag;
50 u16 srk_table_offset;
51 u16 cert_offset;
52 u16 blob_offset;
53 u16 signature_offset;
54 u32 reserved;
55} __packed;
56#endif