xref: /base/startup/hvb/libhvb/include/hvb_footer.h (revision 7310c0d0)
1/*
2 * Copyright (c) 2022-2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15#ifndef __HVB_FOOTER_H_
16#define __HVB_FOOTER_H_
17
18#include "hvb_sysdeps.h"
19#include "hvb_types.h"
20#include "hvb_ops.h"
21#include "hvb.h"
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27/* Magic for the footer. */
28#define HVB_FOOTER_MAGIC       "HVB\x00\x00\x00\x00\x00"
29#define HVB_FOOTER_MAGIC_LEN   8
30/* Size of the footer. */
31#define HVB_FOOTER_SIZE        104
32
33struct hvb_footer {
34    uint8_t magic[HVB_FOOTER_MAGIC_LEN];
35    uint64_t cert_offset;
36    uint64_t cert_size;
37    uint64_t image_size;
38    uint64_t partition_size;
39    uint8_t reserved[64];
40};
41
42enum hvb_errno footer_init_desc(struct hvb_ops *ops, const char *ptn, const char *const *hash_ptn_list,
43                                struct hvb_buf *out_pubk, struct hvb_verified_data *vd);
44
45#ifdef __cplusplus
46}
47#endif
48
49#endif /* HVB_FOOTER_H_ */
50