summaryrefslogtreecommitdiff
path: root/board/cr50
diff options
context:
space:
mode:
authorMary Ruthven <mruthven@chromium.org>2022-08-18 14:22:23 -0500
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-11-02 23:46:48 +0000
commit97c4de9fdb47232a5ff14682ebd9e7c2d9c40f38 (patch)
tree692ee62ce6bf9b24a1c35627af7f8769c6bf1c58 /board/cr50
parentb9d1609c4c96c592ac9bf2c64b54c784412b5617 (diff)
downloadchrome-ec-97c4de9fdb47232a5ff14682ebd9e7c2d9c40f38.tar.gz
usb_spi: move validate_ranges_sha print to usb_spi_sha256_update
A future cl will call usb_spi_sha256_update in more places. Move the range print statement into usb_spi_sha256_update, so we don't need to print the range in multiple places later. BUG=b:236844541 TEST=make -j BOARD=cr50 Change-Id: I9475d14ea0d65be1ad68f606252d50d9af964253 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3840652 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Diffstat (limited to 'board/cr50')
-rw-r--r--board/cr50/usb_spi.c9
-rw-r--r--board/cr50/usb_spi_board.h2
2 files changed, 8 insertions, 3 deletions
diff --git a/board/cr50/usb_spi.c b/board/cr50/usb_spi.c
index 964077cb4e..3516fa717a 100644
--- a/board/cr50/usb_spi.c
+++ b/board/cr50/usb_spi.c
@@ -705,10 +705,15 @@ int usb_spi_read_buffer(void *buf, unsigned int offset, size_t bytes)
}
int usb_spi_sha256_update(struct sha256_ctx *ctx, uint32_t offset,
- uint32_t size)
+ uint32_t size, bool print_range)
{
uint8_t data[SPI_HASH_CHUNK_SIZE];
+ if (print_range) {
+ CPRINTS("%s: %x:%x", __func__, offset, size);
+ /* Make sure the message gets out before verification starts. */
+ cflush();
+ }
while (size) {
const int this_chunk = MIN(size, SPI_HASH_CHUNK_SIZE);
@@ -761,7 +766,7 @@ static enum vendor_cmd_rc spi_hash_sha256(uint8_t *dest, uint32_t offset,
if (usb_spi_sha256_start(&sha) != EC_SUCCESS)
return VENDOR_RC_INTERNAL_ERROR;
- if (usb_spi_sha256_update(&sha, offset, size) != EC_SUCCESS)
+ if (usb_spi_sha256_update(&sha, offset, size, false) != EC_SUCCESS)
return VENDOR_RC_READ_FLASH_FAIL;
usb_spi_sha256_final(&sha, dest, SHA256_DIGEST_SIZE);
diff --git a/board/cr50/usb_spi_board.h b/board/cr50/usb_spi_board.h
index 064b261709..d1dd59239f 100644
--- a/board/cr50/usb_spi_board.h
+++ b/board/cr50/usb_spi_board.h
@@ -6,7 +6,7 @@
int usb_spi_sha256_start(struct sha256_ctx *ctx);
int usb_spi_sha256_update(struct sha256_ctx *ctx, uint32_t offset,
- uint32_t size);
+ uint32_t size, bool print_range);
void usb_spi_sha256_final(struct sha256_ctx *ctx, void *digest,
size_t digest_size);