summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagendra modadugu <ngm@google.com>2016-07-13 00:47:06 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2016-07-13 13:57:56 +0000
commitd65cb2f69a9318e84b80f87448e0485951212c65 (patch)
treed8a71dfe2d876c28f4fc057ec72ff651b8a9bc66
parenta9c1fee1373b7db1fb81598f8177d0f3a4fe1d82 (diff)
downloadchrome-ec-d65cb2f69a9318e84b80f87448e0485951212c65.tar.gz
CR50: fix incorrect loop counter / limits
Fix mismatch between loop counter limit check and increment. Use byte offsets consistently, as these are what flash_physical_info_read expects. BUG=chrome-os-partner:43025,chrome-os-partner:47524,chrome-os-partner:50115 TEST=build succeeds Change-Id: Iec29b3a8a8ee0e82324a86011c792b42c0d0ba06 Signed-off-by: nagendra modadugu <ngm@google.com> Reviewed-on: https://chromium-review.googlesource.com/360251 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
-rw-r--r--board/cr50/tpm2/manufacture.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/board/cr50/tpm2/manufacture.c b/board/cr50/tpm2/manufacture.c
index e2bb19f417..01697af208 100644
--- a/board/cr50/tpm2/manufacture.c
+++ b/board/cr50/tpm2/manufacture.c
@@ -383,16 +383,14 @@ static int decrypt_and_copy_eps(void)
if (!compute_frk2(frk2))
return 0;
- for (i = 0; i < INFO1_EPS_SIZE / sizeof(uint32_t);
- i += sizeof(uint32_t)) {
+ for (i = 0; i < INFO1_EPS_SIZE; i += sizeof(uint32_t)) {
uint32_t word;
if (flash_physical_info_read_word(
INFO1_EPS_OFFSET + i, &word) != EC_SUCCESS)
return 0; /* Flash read INFO1 failed. */
/* gp is a TPM global state structure , declared in Global.h. */
- memcpy(gp.EPSeed.t.buffer + (i * sizeof(word)),
- &word, sizeof(word));
+ memcpy(gp.EPSeed.t.buffer + i, &word, sizeof(word));
}
/* One-time-pad decrypt EPS. */