mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-25 18:55:24 +00:00
VbExEcGetExpectedRW() should take a const **
Since vboot is expected not to modify the contents of the returned pointer. BUG=chrome-os-partner:11148 TEST=if it builds, it worked This change MUST be submitted at the same time as u-boot https://gerrit.chromium.org/gerrit/28146. Change-Id: Ieeee8f456a7fbd9fe6b108a29e208058310b471b Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/28145 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org>
This commit is contained in:
@@ -638,8 +638,8 @@ VbError_t VbExEcHashRW(const uint8_t **hash, int *hash_size);
|
|||||||
|
|
||||||
/* Get the expected contents of the EC image associated with the main firmware
|
/* Get the expected contents of the EC image associated with the main firmware
|
||||||
* specified by the "select" argument. */
|
* specified by the "select" argument. */
|
||||||
VbError_t VbExEcGetExpectedRW(enum VbSelectFirmware_t select, uint8_t **image,
|
VbError_t VbExEcGetExpectedRW(enum VbSelectFirmware_t select,
|
||||||
int *image_size);
|
const uint8_t **image, int *image_size);
|
||||||
|
|
||||||
/* Update the EC rewritable image. */
|
/* Update the EC rewritable image. */
|
||||||
VbError_t VbExEcUpdateRW(const uint8_t *image, int image_size);
|
VbError_t VbExEcUpdateRW(const uint8_t *image, int image_size);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
|
/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
|
||||||
* Use of this source code is governed by a BSD-style license that can be
|
* Use of this source code is governed by a BSD-style license that can be
|
||||||
* found in the LICENSE file.
|
* found in the LICENSE file.
|
||||||
*
|
*
|
||||||
@@ -351,6 +351,10 @@ VbError_t VbBootRecovery(VbCommonParams* cparams, LoadKernelParams* p) {
|
|||||||
VbError_t VbEcSoftwareSync(VbSharedDataHeader *shared) {
|
VbError_t VbEcSoftwareSync(VbSharedDataHeader *shared) {
|
||||||
int in_rw = 0;
|
int in_rw = 0;
|
||||||
int rv = VbExEcRunningRW(&in_rw);
|
int rv = VbExEcRunningRW(&in_rw);
|
||||||
|
const uint8_t *ec_hash;
|
||||||
|
int ec_hash_size;
|
||||||
|
const uint8_t *expected;
|
||||||
|
int expected_size;
|
||||||
|
|
||||||
if (shared->recovery_reason) {
|
if (shared->recovery_reason) {
|
||||||
/* Recovery mode; just verify the EC is in RO code */
|
/* Recovery mode; just verify the EC is in RO code */
|
||||||
@@ -409,6 +413,24 @@ VbError_t VbEcSoftwareSync(VbSharedDataHeader *shared) {
|
|||||||
return VBERROR_SUCCESS;
|
return VBERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Get hash of EC-RW */
|
||||||
|
rv = VbExEcHashRW(&ec_hash, &ec_hash_size);
|
||||||
|
if (rv) {
|
||||||
|
VBDEBUG(("VbEcSoftwareSync() - VbExEcHashRW() returned %d\n", rv));
|
||||||
|
VbSetRecoveryRequest(VBNV_RECOVERY_EC_SOFTWARE_SYNC);
|
||||||
|
return VBERROR_EC_REBOOT_TO_RO_REQUIRED;
|
||||||
|
}
|
||||||
|
VBDEBUG(("VbEcSoftwareSync() - hash len = %d\n", ec_hash_size));
|
||||||
|
|
||||||
|
/* Get expected EC-RW code */
|
||||||
|
rv = VbExEcGetExpectedRW(shared->firmware_index, &expected, &expected_size);
|
||||||
|
if (rv) {
|
||||||
|
VBDEBUG(("VbEcSoftwareSync() - VbExEcGetExpectedRW() returned %d\n", rv));
|
||||||
|
VbSetRecoveryRequest(VBNV_RECOVERY_EC_SOFTWARE_SYNC);
|
||||||
|
return VBERROR_EC_REBOOT_TO_RO_REQUIRED;
|
||||||
|
}
|
||||||
|
VBDEBUG(("VbEcSoftwareSync() - expected len = %d\n", expected_size));
|
||||||
|
|
||||||
/* TODO: verify EC-RW hash vs. expected code */
|
/* TODO: verify EC-RW hash vs. expected code */
|
||||||
|
|
||||||
if (in_rw) {
|
if (in_rw) {
|
||||||
|
|||||||
@@ -173,8 +173,8 @@ VbError_t VbExEcHashRW(const uint8_t **hash, int *hash_size) {
|
|||||||
return VBERROR_SUCCESS;
|
return VBERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
VbError_t VbExEcGetExpectedRW(enum VbSelectFirmware_t select, uint8_t **image,
|
VbError_t VbExEcGetExpectedRW(enum VbSelectFirmware_t select,
|
||||||
int *image_size) {
|
const uint8_t **image, int *image_size) {
|
||||||
static uint8_t fake_image[64] = {5, 6, 7, 8};
|
static uint8_t fake_image[64] = {5, 6, 7, 8};
|
||||||
*image = fake_image;
|
*image = fake_image;
|
||||||
*image_size = sizeof(fake_image);
|
*image_size = sizeof(fake_image);
|
||||||
|
|||||||
Reference in New Issue
Block a user