[coreboot-gerrit] New patch to review for coreboot: commonlib/cbfs: remove cbfs_vb2_hash_contents() function

Aaron Durbin (adurbin@chromium.org) gerrit at coreboot.org
Thu Jan 5 20:28:25 CET 2017


Aaron Durbin (adurbin at chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18045

-gerrit

commit e86abde15c1e57632faeac56fd5fcfb9b71c9485
Author: Aaron Durbin <adurbin at chromium.org>
Date:   Thu Jan 5 13:20:15 2017 -0600

    commonlib/cbfs: remove cbfs_vb2_hash_contents() function
    
    Things will still fail to build because of internal usage
    vb2 hashing functions.
    
    Change-Id: Id467d46223f9c7ab19beff88be579321ebfe4cbe
    Signed-off-by: Aaron Durbin <adurbin at chromium.org>
---
 src/commonlib/cbfs.c                   | 56 ----------------------------------
 src/commonlib/include/commonlib/cbfs.h | 10 ------
 2 files changed, 66 deletions(-)

diff --git a/src/commonlib/cbfs.c b/src/commonlib/cbfs.c
index 1db8d31..76d5143 100644
--- a/src/commonlib/cbfs.c
+++ b/src/commonlib/cbfs.c
@@ -314,59 +314,3 @@ static int cbfs_extend_hash_master_header(struct vb2_digest_context *ctx,
 
 	return cbfs_extend_hash_with_offset(ctx, cbfs, &rdev);
 }
-
-int cbfs_vb2_hash_contents(const struct region_device *cbfs,
-				enum vb2_hash_algorithm hash_alg, void *digest,
-				size_t digest_sz)
-{
-	struct vb2_digest_context ctx;
-	int rv;
-	struct cbfsf f;
-	struct cbfsf *prev;
-	struct cbfsf *fh;
-
-	rv = vb2_digest_init(&ctx, hash_alg);
-
-	if (rv)
-		return rv;
-
-	rv = cbfs_extend_hash_master_header(&ctx, cbfs);
-	if (rv)
-		return rv;
-
-	prev = NULL;
-	fh = &f;
-
-	while (1) {
-		uint32_t ftype;
-
-		rv = cbfs_for_each_file(cbfs, prev, fh);
-		prev = fh;
-
-		if (rv < 0)
-			return VB2_ERROR_UNKNOWN;
-
-		/* End of CBFS. */
-		if (rv > 0)
-			break;
-
-		rv = cbfs_extend_hash_with_offset(&ctx, cbfs, &fh->metadata);
-
-		if (rv)
-			return rv;
-
-		/* Include data contents in hash if file is non-empty. */
-		if (cbfsf_file_type(fh, &ftype))
-			return VB2_ERROR_UNKNOWN;
-
-		if (ftype == CBFS_TYPE_DELETED || ftype == CBFS_TYPE_DELETED2)
-			continue;
-
-		rv = cbfs_extend_hash_with_offset(&ctx, cbfs, &fh->data);
-
-		if (rv)
-			return rv;
-	}
-
-	return vb2_digest_finalize(&ctx, digest, digest_sz);
-}
diff --git a/src/commonlib/include/commonlib/cbfs.h b/src/commonlib/include/commonlib/cbfs.h
index 163bef2..87a4000 100644
--- a/src/commonlib/include/commonlib/cbfs.h
+++ b/src/commonlib/include/commonlib/cbfs.h
@@ -18,7 +18,6 @@
 
 #include <commonlib/cbfs_serialized.h>
 #include <commonlib/region.h>
-#include <vb2_api.h>
 
 /* Object representing cbfs files. */
 struct cbfsf {
@@ -70,13 +69,4 @@ size_t cbfs_for_each_attr(void *metadata, size_t metadata_size,
  */
 int cbfsf_decompression_info(struct cbfsf *fh, uint32_t *algo, size_t *size);
 
-/*
- * 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



More information about the coreboot-gerrit mailing list