diff options
author | Claudio Carvalho <cclaudio@linux.vnet.ibm.com> | 2016-10-25 16:58:21 +1100 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2016-10-25 16:58:21 +1100 |
commit | 7b0d3155c9dd71cd8d7afcec9dbbeebc22bd77bf (patch) | |
tree | f816cb23d682239618a033edcc6cd4e955aaa8b9 /libstb/container.c | |
parent | 8652ced003f7977e1126149b8011c184b88fe24e (diff) | |
download | skiboot-7b0d3155c9dd71cd8d7afcec9dbbeebc22bd77bf.zip skiboot-7b0d3155c9dd71cd8d7afcec9dbbeebc22bd77bf.tar.gz skiboot-7b0d3155c9dd71cd8d7afcec9dbbeebc22bd77bf.tar.bz2 |
libstb/container: add function for getting sw payload size
Add a function to get the software payload size from a STB container.
(originally from patch from Claudio, but I pulled out just this bit here)
Extracted-from-a-patch-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'libstb/container.c')
-rw-r--r-- | libstb/container.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libstb/container.c b/libstb/container.c index 19df556..a720fbb 100644 --- a/libstb/container.c +++ b/libstb/container.c @@ -38,6 +38,16 @@ uint32_t stb_payload_magic(const void *buf, size_t size) return be32_to_cpu(*(uint32_t*)(p+SECURE_BOOT_HEADERS_SIZE)); } +uint64_t stb_sw_payload_size(const void *buf, size_t size) +{ + struct parsed_stb_container c; + if (!stb_is_container(buf, size)) + return 0; + if (parse_stb_container(buf, size, &c) != 0) + return 0; + return be64_to_cpu(c.sh->payload_size); +} + int parse_stb_container(const void* data, size_t len, struct parsed_stb_container *c) { const size_t prefix_data_min_size = 3 * (EC_COORDBYTES * 2); |