17310c0d0Sopenharmony_ci/*
27310c0d0Sopenharmony_ci * Copyright (c) 2022-2023 Huawei Device Co., Ltd.
37310c0d0Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
47310c0d0Sopenharmony_ci * you may not use this file except in compliance with the License.
57310c0d0Sopenharmony_ci * You may obtain a copy of the License at
67310c0d0Sopenharmony_ci *
77310c0d0Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
87310c0d0Sopenharmony_ci *
97310c0d0Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
107310c0d0Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
117310c0d0Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
127310c0d0Sopenharmony_ci * See the License for the specific language governing permissions and
137310c0d0Sopenharmony_ci * limitations under the License.
147310c0d0Sopenharmony_ci */
157310c0d0Sopenharmony_ci#ifndef __HVB_FOOTER_H_
167310c0d0Sopenharmony_ci#define __HVB_FOOTER_H_
177310c0d0Sopenharmony_ci
187310c0d0Sopenharmony_ci#include "hvb_sysdeps.h"
197310c0d0Sopenharmony_ci#include "hvb_types.h"
207310c0d0Sopenharmony_ci#include "hvb_ops.h"
217310c0d0Sopenharmony_ci#include "hvb.h"
227310c0d0Sopenharmony_ci
237310c0d0Sopenharmony_ci#ifdef __cplusplus
247310c0d0Sopenharmony_ciextern "C" {
257310c0d0Sopenharmony_ci#endif
267310c0d0Sopenharmony_ci
277310c0d0Sopenharmony_ci/* Magic for the footer. */
287310c0d0Sopenharmony_ci#define HVB_FOOTER_MAGIC       "HVB\x00\x00\x00\x00\x00"
297310c0d0Sopenharmony_ci#define HVB_FOOTER_MAGIC_LEN   8
307310c0d0Sopenharmony_ci/* Size of the footer. */
317310c0d0Sopenharmony_ci#define HVB_FOOTER_SIZE        104
327310c0d0Sopenharmony_ci
337310c0d0Sopenharmony_cistruct hvb_footer {
347310c0d0Sopenharmony_ci    uint8_t magic[HVB_FOOTER_MAGIC_LEN];
357310c0d0Sopenharmony_ci    uint64_t cert_offset;
367310c0d0Sopenharmony_ci    uint64_t cert_size;
377310c0d0Sopenharmony_ci    uint64_t image_size;
387310c0d0Sopenharmony_ci    uint64_t partition_size;
397310c0d0Sopenharmony_ci    uint8_t reserved[64];
407310c0d0Sopenharmony_ci};
417310c0d0Sopenharmony_ci
427310c0d0Sopenharmony_cienum hvb_errno footer_init_desc(struct hvb_ops *ops, const char *ptn, const char *const *hash_ptn_list,
437310c0d0Sopenharmony_ci                                struct hvb_buf *out_pubk, struct hvb_verified_data *vd);
447310c0d0Sopenharmony_ci
457310c0d0Sopenharmony_ci#ifdef __cplusplus
467310c0d0Sopenharmony_ci}
477310c0d0Sopenharmony_ci#endif
487310c0d0Sopenharmony_ci
497310c0d0Sopenharmony_ci#endif /* HVB_FOOTER_H_ */
50