[coreboot-gerrit] New patch to review for coreboot: 287283d vboot2: Implement new vb2ex_hwcrypto API

Aaron Durbin (adurbin@chromium.org) gerrit at coreboot.org
Wed Apr 15 17:42:29 CEST 2015


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

-gerrit

commit 287283d02d752bf1a53832e40ba88077b5f6ebeb
Author: Julius Werner <jwerner at chromium.org>
Date:   Tue Dec 16 21:28:59 2014 -0800

    vboot2: Implement new vb2ex_hwcrypto API
    
    This patch aligns our verstage code to the new API addition in vboot2.
    The hardware crypto functions are stubbed out by default and just
    pretend that all algorithms are unsupported, causing vboot to fall back
    to the normal software hashing code. These weak symbols can be
    overridden by individual platform code to provide actual hardware
    crypto engine support.
    
    CQ-DEPEND=CL:236453
    BRANCH=None
    BUG=chrome-os-partner:32987
    TEST=Booted Pinky, confirmed vboot falls back to software crypto.
    
    Original-Change-Id: Idf6a38febd163aa2bff6e9a0e207213f01ca8324
    Original-Signed-off-by: Julius Werner <jwerner at chromium.org>
    Original-Reviewed-on: https://chromium-review.googlesource.com/236435
    Original-Reviewed-by: Randall Spangler <rspangler at chromium.org>
    
    (cherry picked from commit 9b5ee7f575f1aa3b0eb6ef78947ca93a4818f57b)
    Signed-off-by: Aaron Durbin <adurbin at chromium.org>
    
    Change-Id: I6f0e19255a9bc5c5cd1767db76f1e47897ef0798
---
 src/vendorcode/google/chromeos/vboot2/verstage.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/src/vendorcode/google/chromeos/vboot2/verstage.c b/src/vendorcode/google/chromeos/vboot2/verstage.c
index 569e6e5..06d76fe 100644
--- a/src/vendorcode/google/chromeos/vboot2/verstage.c
+++ b/src/vendorcode/google/chromeos/vboot2/verstage.c
@@ -19,6 +19,7 @@
 
 #include <antirollback.h>
 #include <arch/exception.h>
+#include <assert.h>
 #include <console/console.h>
 #include <console/vtxprintf.h>
 #include <delay.h>
@@ -91,6 +92,28 @@ int vb2ex_read_resource(struct vb2_context *ctx,
 	return VB2_SUCCESS;
 }
 
+/* No-op stubs that can be overridden by SoCs with hardware crypto support. */
+__attribute__((weak))
+int vb2ex_hwcrypto_digest_init(enum vb2_hash_algorithm hash_alg,
+			       uint32_t data_size)
+{
+	return VB2_ERROR_EX_HWCRYPTO_UNSUPPORTED;
+}
+
+__attribute__((weak))
+int vb2ex_hwcrypto_digest_extend(const uint8_t *buf, uint32_t size)
+{
+	BUG();	/* Should never get called if init() returned an error. */
+	return VB2_ERROR_UNKNOWN;
+}
+
+__attribute__((weak))
+int vb2ex_hwcrypto_digest_finalize(uint8_t *digest, uint32_t digest_size)
+{
+	BUG();	/* Should never get called if init() returned an error. */
+	return VB2_ERROR_UNKNOWN;
+}
+
 static int hash_body(struct vb2_context *ctx, struct vboot_region *fw_main)
 {
 	uint64_t load_ts;



More information about the coreboot-gerrit mailing list