summaryrefslogtreecommitdiff
path: root/src/commonlib/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/commonlib/include')
-rw-r--r--src/commonlib/include/commonlib/cbfs.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/commonlib/include/commonlib/cbfs.h b/src/commonlib/include/commonlib/cbfs.h
index b0a468cdc9..c74dd708e3 100644
--- a/src/commonlib/include/commonlib/cbfs.h
+++ b/src/commonlib/include/commonlib/cbfs.h
@@ -18,6 +18,9 @@
#include <commonlib/cbfs_serialized.h>
#include <commonlib/region.h>
+/* TODO: remove me! This is for vboot_handoff.c's benefit. */
+#define NEED_VB20_INTERNALS
+#include <vb2_api.h>
/* Object representing cbfs files. */
struct cbfsf {
@@ -52,4 +55,13 @@ static inline void cbfs_file_metadata(struct region_device *metadata,
int cbfs_for_each_file(const struct region_device *cbfs,
const struct cbfsf *prev, struct cbfsf *fh);
+/*
+ * Perform the vb2 hash over the CBFS region skipping empty file contents.
+ * Caller is responsible for providing the hash algorithm as well as storage
+ * for the final digest. Return 0 on success or non-zero on error.
+ */
+int cbfs_vb2_hash_contents(const struct region_device *cbfs,
+ enum vb2_hash_algorithm hash_alg, void *digest,
+ size_t digest_sz);
+
#endif