[Skiboot] [PATCH v2 07/12] core/flash.c: verify and measure resources

Claudio Carvalho cclaudio at linux.vnet.ibm.com
Wed Sep 28 18:10:57 AEST 2016


This changes core/flash.c to verify and measure the downloaded PNOR
resource before it is returned to the caller.

sb_verify() and tb_measure() do nothing if libstb is not initialized
in the platform.

Signed-off-by: Claudio Carvalho <cclaudio at linux.vnet.ibm.com>
---
 core/flash.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/core/flash.c b/core/flash.c
index 24c34cf..9b07aa3 100644
--- a/core/flash.c
+++ b/core/flash.c
@@ -24,6 +24,7 @@
 #include <libflash/libffs.h>
 #include <libflash/blocklevel.h>
 #include <libflash/ecc.h>
+#include <libstb/stb.h>
 
 struct flash {
 	struct list_node	list;
@@ -610,6 +611,13 @@ static int flash_load_resource(enum resource_id id, uint32_t subid,
 	*len = size;
 	status = true;
 
+	/*
+	 * Verify and measure the retrieved PNOR partition as part of the
+	 * secure boot and trusted boot requirements
+	 */
+	sb_verify(id, subid, buf, *len);
+	tb_measure(id, subid, buf, *len);
+
 out_free_ffs:
 	ffs_close(ffs);
 out_unlock:
-- 
1.9.1



More information about the Skiboot mailing list