Julius Werner | fdabf3f | 2020-05-06 17:06:35 -0700 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Julius Werner | fdabf3f | 2020-05-06 17:06:35 -0700 | [diff] [blame] | 2 | |
| 3 | #ifndef _METADATA_HASH_H_ |
| 4 | #define _METADATA_HASH_H_ |
| 5 | |
| 6 | #include <commonlib/bsd/metadata_hash.h> |
| 7 | |
Julius Werner | 6296ca8 | 2021-04-02 16:31:21 -0700 | [diff] [blame] | 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 | |
Julius Werner | fdabf3f | 2020-05-06 17:06:35 -0700 | [diff] [blame] | 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 |
| 22 | static inline struct vb2_hash *metadata_hash_get(void) { return NULL; } |
| 23 | #endif |
| 24 | |
| 25 | #endif |