diff options
author | Patrick Georgi <patrick@georgi-clan.de> | 2015-10-01 15:54:04 +0200 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2015-10-01 20:14:26 +0000 |
commit | 89f20340d5a4c14ab76d3612cd33fff8894602ec (patch) | |
tree | a44cf61e958eb121de01bd17bc1cb4691ad8d455 /util/cbfstool/cbfs_image.h | |
parent | 44853371f108b85a36775b72b894c93b24d7b7f7 (diff) | |
download | coreboot-89f20340d5a4c14ab76d3612cd33fff8894602ec.tar.xz |
cbfstool: Add support for hashes as file metadata
They allow optimizing a verification of a whole CBFS image by only
dealing with the headers (assuming you choose to trust the hash
algorithm(s)).
The format allows for multiple hashes for a single file, and cbfstool
can handle them, but right now it can't generate such headers.
Loosely based on Sol's work in http://review.coreboot.org/#/c/10147/,
but using the compatible file attribute format. vboot is now a hard
dependency of the build process, but we import it into the tree for
quite a while now.
Change-Id: I9f14f30537d676ce209ad612e7327c6f4810b313
Signed-off-by: Patrick Georgi <patrick@georgi-clan.de>
Reviewed-on: http://review.coreboot.org/11767
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'util/cbfstool/cbfs_image.h')
-rw-r--r-- | util/cbfstool/cbfs_image.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/util/cbfstool/cbfs_image.h b/util/cbfstool/cbfs_image.h index baceb51373..f602976177 100644 --- a/util/cbfstool/cbfs_image.h +++ b/util/cbfstool/cbfs_image.h @@ -36,6 +36,10 @@ struct cbfs_image { * enum comp_algo if it's supported, or a number < 0 otherwise. */ int cbfs_parse_comp_algo(const char *name); +/* Given the string name of a hash algorithm, return the corresponding + * id if it's supported, or a number < 0 otherwise. */ +int cbfs_parse_hash_algo(const char *name); + /* Given a pointer, serialize the header from host-native byte format * to cbfs format, i.e. big-endian. */ void cbfs_put_header(void *dest, const struct cbfs_header *header); @@ -184,4 +188,10 @@ struct cbfs_file_attribute *cbfs_file_next_attr(struct cbfs_file *file, struct cbfs_file_attribute *cbfs_add_file_attr(struct cbfs_file *header, uint32_t tag, uint32_t size); + +/* Adds an extended attribute to header, containing a hash of buffer's data of + * the type specified by hash_type. + * Returns 0 on success, -1 on error. */ +int cbfs_add_file_hash(struct cbfs_file *header, struct buffer *buffer, + enum vb2_hash_algorithm hash_type); #endif |