xref: /aosp_15_r20/external/coreboot/src/include/metadata_hash.h (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef _METADATA_HASH_H_
4 #define _METADATA_HASH_H_
5 
6 #include <commonlib/bsd/metadata_hash.h>
7 
8 /* Return a pointer to the whole anchor. Only used for decompressor builds. */
9 void *metadata_hash_export_anchor(void);
10 /* Import a pointer that points to the anchor. Only used for decompressor builds. */
11 void metadata_hash_import_anchor(void *ptr);
12 
13 /* 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). */
15 vb2_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. */
20 struct vb2_hash *metadata_hash_get(void);
21 #else
metadata_hash_get(void)22 static inline struct vb2_hash *metadata_hash_get(void) { return NULL; }
23 #endif
24 
25 #endif
26