summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Wawrzynczak <twawrzynczak@chromium.org>2019-10-23 14:48:12 -0600
committerCommit Bot <commit-bot@chromium.org>2019-11-14 07:22:13 +0000
commit19ff28bd95b79e421059fdccf6b07e0a23f12aa3 (patch)
tree4887c0614304379c60be561ab16d9d9ac1ee686e
parent5d874c2f45c991651a3c66be64e4139f56c69d25 (diff)
downloadvboot-19ff28bd95b79e421059fdccf6b07e0a23f12aa3.tar.gz
ec_sync: Remove vb2ex_get_expected_image() callback
This callback is redundant, because vboot takes the buffer pointer and just passes it straight into vb2ex_ec_update_image(), so clearly the platform must be able to find the image on its own. Remove it, and also remove the arguments to vb2ex_ec_update_image which were the image and its size. BUG=none BRANCH=none TEST=make runtests Cq-Depend: chromium:1910562 Change-Id: I35548cc0bde761cf08337489af0772bbdf46de4d Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1877065 Reviewed-by: Julius Werner <jwerner@chromium.org>
-rw-r--r--firmware/2lib/2ec_sync.c14
-rw-r--r--firmware/2lib/include/2recovery_reasons.h4
-rw-r--r--firmware/include/vboot_api.h23
-rw-r--r--firmware/lib/vboot_display.c3
-rw-r--r--firmware/stub/vboot_api_stub.c12
-rw-r--r--tests/vb2_ec_sync_tests.c12
6 files changed, 19 insertions, 49 deletions
diff --git a/firmware/2lib/2ec_sync.c b/firmware/2lib/2ec_sync.c
index 89a3c1a2..0bc58a85 100644
--- a/firmware/2lib/2ec_sync.c
+++ b/firmware/2lib/2ec_sync.c
@@ -158,21 +158,11 @@ static vb2_error_t update_ec(struct vb2_context *ctx,
enum vb2_firmware_selection select)
{
struct vb2_shared_data *sd = vb2_get_sd(ctx);
+ vb2_error_t rv;
VB2_DEBUG("Updating %s...\n", image_name_to_string(select));
- /* Get expected EC image */
- const uint8_t *want = NULL;
- int want_size;
- vb2_error_t rv = vb2ex_ec_get_expected_image(select, &want, &want_size);
- if (rv) {
- VB2_DEBUG("vb2ex_ec_get_expected_image() returned %#x\n", rv);
- request_recovery(ctx, VB2_RECOVERY_EC_EXPECTED_IMAGE);
- return rv;
- }
- VB2_DEBUG("image len = %d\n", want_size);
-
- rv = vb2ex_ec_update_image(select, want, want_size);
+ rv = vb2ex_ec_update_image(select);
if (rv != VB2_SUCCESS) {
VB2_DEBUG("vb2ex_ec_update_image() returned %#x\n", rv);
diff --git a/firmware/2lib/include/2recovery_reasons.h b/firmware/2lib/include/2recovery_reasons.h
index b409e957..d943563b 100644
--- a/firmware/2lib/include/2recovery_reasons.h
+++ b/firmware/2lib/include/2recovery_reasons.h
@@ -102,8 +102,8 @@ enum vb2_nv_recovery {
/* EC software sync - error obtaining EC image hash (deprecated) */
VB2_RECOVERY_DEPRECATED_EC_HASH = 0x24,
- /* EC software sync - error obtaining expected EC image */
- VB2_RECOVERY_EC_EXPECTED_IMAGE = 0x25,
+ /* EC software sync - error obtaining expected EC image (deprecated) */
+ VB2_RECOVERY_DEPRECATED_EC_EXPECTED_IMAGE = 0x25,
/* EC software sync - error updating EC */
VB2_RECOVERY_EC_UPDATE = 0x26,
diff --git a/firmware/include/vboot_api.h b/firmware/include/vboot_api.h
index a1282974..f34f219b 100644
--- a/firmware/include/vboot_api.h
+++ b/firmware/include/vboot_api.h
@@ -675,30 +675,33 @@ vb2_error_t vb2ex_ec_hash_image(enum vb2_firmware_selection select,
const uint8_t **hash, int *hash_size);
/**
- * Get the expected contents of the EC image associated with the main firmware
- * specified by the "select" argument.
- */
-vb2_error_t vb2ex_ec_get_expected_image(enum vb2_firmware_selection select,
- const uint8_t **image, int *image_size);
-
-/**
* Read the SHA-256 hash of the expected contents of the EC image associated
* with the main firmware specified by the "select" argument.
+ *
+ * @param select Image to get expected hash for (RO or RW).
+ * @param hash Pointer to the hash.
+ * @param hash_size Pointer to the hash size (in bytes).
+ * @return VB2_SUCCESS, or error code on error.
*/
vb2_error_t vb2ex_ec_get_expected_image_hash(enum vb2_firmware_selection select,
const uint8_t **hash,
int *hash_size);
/**
- * Update the selected EC image.
+ * Update the selected EC image to the expected version.
+ *
+ * @param select Image to get expected hash for (RO or RW).
+ * @return VB2_SUCCESS, or error code on error.
*/
-vb2_error_t vb2ex_ec_update_image(enum vb2_firmware_selection select,
- const uint8_t *image, int image_size);
+vb2_error_t vb2ex_ec_update_image(enum vb2_firmware_selection select);
/**
* Lock the EC code to prevent updates until the EC is rebooted.
* Subsequent calls to vb2ex_ec_update_image() with the same region this
* boot will fail.
+ *
+ * @param select Image to get expected hash for (RO or RW).
+ * @return VB2_SUCCESS, or error code on error.
*/
vb2_error_t vb2ex_ec_protect(enum vb2_firmware_selection select);
diff --git a/firmware/lib/vboot_display.c b/firmware/lib/vboot_display.c
index b9473347..d3daf658 100644
--- a/firmware/lib/vboot_display.c
+++ b/firmware/lib/vboot_display.c
@@ -139,9 +139,6 @@ const char *RecoveryReasonString(uint8_t code)
return "EC software sync error";
case VB2_RECOVERY_EC_UNKNOWN_IMAGE:
return "EC software sync unable to determine active EC image";
- case VB2_RECOVERY_EC_EXPECTED_IMAGE:
- return "EC software sync error "
- "obtaining expected EC image from BIOS";
case VB2_RECOVERY_EC_UPDATE:
return "EC software sync error updating EC";
case VB2_RECOVERY_EC_JUMP_RW:
diff --git a/firmware/stub/vboot_api_stub.c b/firmware/stub/vboot_api_stub.c
index c2b4e593..54ba130d 100644
--- a/firmware/stub/vboot_api_stub.c
+++ b/firmware/stub/vboot_api_stub.c
@@ -95,15 +95,6 @@ vb2_error_t vb2ex_ec_hash_image(enum vb2_firmware_selection select,
return VB2_SUCCESS;
}
-vb2_error_t vb2ex_ec_get_expected_image(enum vb2_firmware_selection select,
- const uint8_t **image, int *image_size)
-{
- static uint8_t fake_image[64] = {5, 6, 7, 8};
- *image = fake_image;
- *image_size = sizeof(fake_image);
- return VB2_SUCCESS;
-}
-
vb2_error_t vb2ex_ec_get_expected_image_hash(enum vb2_firmware_selection select,
const uint8_t **hash, int *hash_size)
{
@@ -114,8 +105,7 @@ vb2_error_t vb2ex_ec_get_expected_image_hash(enum vb2_firmware_selection select,
return VB2_SUCCESS;
}
-vb2_error_t vb2ex_ec_update_image(enum vb2_firmware_selection select,
- const uint8_t *image, int image_size)
+vb2_error_t vb2ex_ec_update_image(enum vb2_firmware_selection select)
{
return VB2_SUCCESS;
}
diff --git a/tests/vb2_ec_sync_tests.c b/tests/vb2_ec_sync_tests.c
index 241a1206..86159463 100644
--- a/tests/vb2_ec_sync_tests.c
+++ b/tests/vb2_ec_sync_tests.c
@@ -176,15 +176,6 @@ vb2_error_t vb2ex_ec_hash_image(enum vb2_firmware_selection select,
return *hash_size ? VB2_SUCCESS : VB2_ERROR_MOCK;
}
-vb2_error_t vb2ex_ec_get_expected_image(enum vb2_firmware_selection select,
- const uint8_t **image, int *image_size)
-{
- static uint8_t fake_image[64] = {5, 6, 7, 8};
- *image = fake_image;
- *image_size = sizeof(fake_image);
- return get_expected_retval;
-}
-
vb2_error_t vb2ex_ec_get_expected_image_hash(enum vb2_firmware_selection select,
const uint8_t **hash, int *hash_size)
{
@@ -194,8 +185,7 @@ vb2_error_t vb2ex_ec_get_expected_image_hash(enum vb2_firmware_selection select,
return want_ec_hash_size ? VB2_SUCCESS : VB2_ERROR_MOCK;
}
-vb2_error_t vb2ex_ec_update_image(enum vb2_firmware_selection select,
- const uint8_t *image, int image_size)
+vb2_error_t vb2ex_ec_update_image(enum vb2_firmware_selection select)
{
if (select == VB_SELECT_FIRMWARE_READONLY) {
ec_ro_updated = 1;