Frans Hendriks has uploaded this change for review.

View Change

vc/eltan/security/verified_boot/vboot_check.c: Add cbfs_map_compressed()

CB:49334 removes possibility to use cbfs_map() for retrieving CBFS map
info of compressed files. cbfs_map() will return a NULL pointer for
compressed files.
The mapping and size of compressed items are used for verification and
measuring.

Add cbfs_map_compressed() which will return mapping and compressed size
of compressed files. For non-compressed items the

BUG = N/A
TEST = Boot Facebook FBG7101

Signed-off-by: Frans Hendriks <fhendriks@eltan.com>
Change-Id: Idc799f49ee198100deab1ecf66336831d9aed415
---
M src/vendorcode/eltan/security/verified_boot/vboot_check.c
1 file changed, 16 insertions(+), 1 deletion(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/25/52025/1
diff --git a/src/vendorcode/eltan/security/verified_boot/vboot_check.c b/src/vendorcode/eltan/security/verified_boot/vboot_check.c
index 0de2f0a..6a27cad 100644
--- a/src/vendorcode/eltan/security/verified_boot/vboot_check.c
+++ b/src/vendorcode/eltan/security/verified_boot/vboot_check.c
@@ -3,6 +3,7 @@
#include <boot_device.h>
#include <bootmem.h>
#include <bootmode.h>
+#include <cbfs_private.h>
#include <cbfs.h>
#include <vboot_check.h>
#include <vboot_common.h>
@@ -18,6 +19,20 @@
#define HASH_ALG VB2_HASH_SHA256
#endif

+static void *cbfs_map_compressed(const char *name, size_t *size_out)
+{
+ struct region_device rdev;
+ union cbfs_mdata mdata;
+
+ if (cbfs_boot_lookup(name, false, &mdata, &rdev))
+ return NULL;
+
+ if (size_out != NULL)
+ *size_out = region_device_sz(&rdev);
+
+ return rdev_mmap_full(&rdev);
+}
+
int verified_boot_check_manifest(void)
{
uint8_t *buffer;
@@ -183,7 +198,7 @@
void *start;
size_t size;

- start = cbfs_map(name, &size);
+ start = cbfs_map_compressed(name, &size);
if (start && size) {
/* Speed up processing by copying the file content to memory first */
if (!ENV_ROMSTAGE_OR_BEFORE && (type & VERIFIED_BOOT_COPY_BLOCK)) {

To view, visit change 52025. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Idc799f49ee198100deab1ecf66336831d9aed415
Gerrit-Change-Number: 52025
Gerrit-PatchSet: 1
Gerrit-Owner: Frans Hendriks <fhendriks@eltan.com>
Gerrit-MessageType: newchange