blob: e945300cc8e7496dd8e325ff04e6a4b0cea17073 [file] [log] [blame]
Julius Wernerfdabf3f2020-05-06 17:06:35 -07001/* SPDX-License-Identifier: GPL-2.0-only */
Julius Wernerfdabf3f2020-05-06 17:06:35 -07002
3#ifndef _METADATA_HASH_H_
4#define _METADATA_HASH_H_
5
6#include <commonlib/bsd/metadata_hash.h>
7
Julius Werner6296ca82021-04-02 16:31:21 -07008/* Return a pointer to the whole anchor. Only used for decompressor builds. */
9void *metadata_hash_export_anchor(void);
10/* Import a pointer that points to the anchor. Only used for decompressor builds. */
11void metadata_hash_import_anchor(void *ptr);
12
Julius Wernerfdabf3f2020-05-06 17:06:35 -070013/* Verify the an FMAP data structure with the FMAP hash that is stored together with the CBFS
14 metadata hash in the bootblock's metadata hash anchor (when CBFS verification is enabled). */
15vb2_error_t metadata_hash_verify_fmap(const void *fmap_base, size_t fmap_size);
16
17#if CONFIG(CBFS_VERIFICATION)
18/* Get the (RO) CBFS metadata hash for this CBFS image, which forms the root of trust for CBFS
19 verification. This function is only available in the bootblock. */
20struct vb2_hash *metadata_hash_get(void);
21#else
22static inline struct vb2_hash *metadata_hash_get(void) { return NULL; }
23#endif
24
25#endif