-
Notifications
You must be signed in to change notification settings - Fork 308
/
plat_auth.h
87 lines (67 loc) · 1.99 KB
/
plat_auth.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright(c) 2017 Intel Corporation. All rights reserved.
*/
#ifndef __PLAT_AUTH_H__
#define __PLAT_AUTH_H__
#include <stdint.h>
struct image;
#define PLAT_AUTH_SHA256_LEN 32
#define PLAT_AUTH_NAME_LEN 12
#define PLAT_AUTH_PADDING 48 /* pad at end of struct */
#define SIGN_PKG_EXT_TYPE 15
#define SIGN_PKG_NUM_MODULE 1
struct signed_pkg_info_module {
uint8_t name[PLAT_AUTH_NAME_LEN]; /* must be padded with 0 */
uint8_t type;
uint8_t hash_algo;
uint16_t hash_size;
uint32_t meta_size;
uint8_t hash[PLAT_AUTH_SHA256_LEN];
} __attribute__((packed));
struct signed_pkg_info_ext {
uint32_t ext_type;
uint32_t ext_len;
uint8_t name[4];
uint32_t vcn;
uint8_t bitmap[16];
uint32_t svn;
uint8_t fw_type;
uint8_t fw_sub_type;
uint8_t reserved[14]; /* must be 0 */
/* variable length of modules */
struct signed_pkg_info_module module[SIGN_PKG_NUM_MODULE];
} __attribute__((packed));
#define PART_INFO_EXT_TYPE 3
#define PART_INFO_NUM_MODULE 1
struct partition_info_module {
uint8_t name[PLAT_AUTH_NAME_LEN]; /* must be padded with 0 */
uint8_t type;
uint8_t reserved[3];
uint32_t meta_size;
uint8_t hash[PLAT_AUTH_SHA256_LEN];
} __attribute__((packed));
struct partition_info_ext {
uint32_t ext_type;
uint32_t ext_len;
uint8_t name[4]; /* "ADSP" */
uint32_t length;
uint8_t hash[PLAT_AUTH_SHA256_LEN];
uint32_t vcn;
uint32_t part_version;
uint32_t fmt_version;
uint32_t instance_id;
uint32_t part_flags;
uint8_t reserved[20]; /* must be 0 */
/* variable length of modules */
struct partition_info_module module[PART_INFO_NUM_MODULE];
} __attribute__((packed));
#define PLAT_AUTH_SIZE \
(sizeof(struct partition_info_ext) + \
sizeof(struct signed_pkg_info_ext))
void ri_adsp_meta_data_create_v1_8(struct image *image, int meta_start_offset,
int meta_end_offset);
void ri_adsp_meta_data_create_v2_5(struct image *image, int meta_start_offset,
int meta_end_offset);
void ri_plat_ext_data_create(struct image *image);
#endif