libpayload: Add data structures for hashes in file attributes

Taken from cbfstool.

Change-Id: I4387900517dbfb1aa51ae6f679e26d0cf5b2acf8
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: http://review.coreboot.org/11808
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Patrick Georgi 2015-10-08 13:02:19 +02:00
parent 26fc544575
commit 78517f3a45
1 changed files with 9 additions and 0 deletions

View File

@ -143,6 +143,7 @@ struct cbfs_file {
#define CBFS_FILE_ATTR_TAG_UNUSED 0
#define CBFS_FILE_ATTR_TAG_UNUSED2 0xffffffff
#define CBFS_FILE_ATTR_TAG_COMPRESSION 0x42435a4c
#define CBFS_FILE_ATTR_TAG_HASH 0x68736148
/* The common fields of extended cbfs file attributes.
Attributes are expected to start with tag/len, then append their
@ -162,6 +163,14 @@ struct cbfs_file_attr_compression {
uint32_t decompressed_size;
} __attribute__((packed));
struct cbfs_file_attr_hash {
uint32_t tag;
uint32_t len;
uint32_t hash_type;
/* hash_data is len - sizeof(struct) bytes */
uint8_t hash_data[];
} __PACKED;
/* Given a cbfs_file, return the first file attribute, or NULL. */
struct cbfs_file_attribute *cbfs_file_first_attr(struct cbfs_file *file);