diff options
author | Mary Ruthven <mruthven@chromium.org> | 2022-08-18 16:49:18 -0500 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-08-27 04:30:48 +0000 |
commit | 9f0ed15c133c1ee33de032da69ba045fdbae9516 (patch) | |
tree | b7947bf3a795f3b97b74ccd4522394842a38e361 /common | |
parent | 32c80cad1ed85114adc2981e7a169cc747ab6b88 (diff) | |
download | chrome-ec-9f0ed15c133c1ee33de032da69ba045fdbae9516.tar.gz |
apro: add compile time check to verify max AP RO data sizestabilize-15086.B-cr50_stabstabilize-15083.B-cr50_stabfirmware-ti50-prepvt-15086.B-cr50_stabfirmware-ti50-mp-15224.B-cr50_stab
Use a build assert to verify the header, hash, and maximum number of RO
ranges can fit in the AP RO space.
BUG=none
TEST=none
Change-Id: I4ecd12ba06e1af524d6ae38a16211ffddeabb8f9
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3840986
Commit-Queue: Andrey Pronin <apronin@chromium.org>
Reviewed-by: Andrey Pronin <apronin@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/ap_ro_integrity_check.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/common/ap_ro_integrity_check.c b/common/ap_ro_integrity_check.c index c08faa3eeb..9d34bc4318 100644 --- a/common/ap_ro_integrity_check.c +++ b/common/ap_ro_integrity_check.c @@ -113,6 +113,14 @@ struct ap_ro_check_header { uint32_t checksum; }; +/* + * Saved AP RO data includes the ap ro check header, the sha digest of the + * firmware and the RO ranges. Make sure the header, digest, and maximum number + * of ranges fit in the AP RO space. + */ +BUILD_ASSERT(AP_RO_DATA_SPACE_SIZE >= + sizeof(struct ap_ro_check_header) + SHA256_DIGEST_SIZE + + APRO_MAX_NUM_RANGES * sizeof(struct ro_range)); /* Format of the AP RO check information saved in the H1 flash page. */ struct ap_ro_check { struct ap_ro_check_header header; |