summaryrefslogtreecommitdiffstats
path: root/src/include/metadata_hash.h
blob: e945300cc8e7496dd8e325ff04e6a4b0cea17073 (plain)
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
/* SPDX-License-Identifier: GPL-2.0-only */

#ifndef _METADATA_HASH_H_
#define _METADATA_HASH_H_

#include <commonlib/bsd/metadata_hash.h>

/* Return a pointer to the whole anchor. Only used for decompressor builds. */
void *metadata_hash_export_anchor(void);
/* Import a pointer that points to the anchor. Only used for decompressor builds. */
void metadata_hash_import_anchor(void *ptr);

/* Verify the an FMAP data structure with the FMAP hash that is stored together with the CBFS
   metadata hash in the bootblock's metadata hash anchor (when CBFS verification is enabled). */
vb2_error_t metadata_hash_verify_fmap(const void *fmap_base, size_t fmap_size);

#if CONFIG(CBFS_VERIFICATION)
/* Get the (RO) CBFS metadata hash for this CBFS image, which forms the root of trust for CBFS
   verification. This function is only available in the bootblock. */
struct vb2_hash *metadata_hash_get(void);
#else
static inline struct vb2_hash *metadata_hash_get(void) { return NULL; }
#endif

#endif