diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2016-07-16 18:05:46 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2016-07-17 14:50:35 +0000 |
commit | 78910aeabed52dc05880a2efe0300be2f697da87 (patch) | |
tree | c66bf08f19c2bb750d595d4eee1f47d0b6b886f3 | |
parent | 1075ae505bc1ed80c5066cb6bd0a2b21714ad5e4 (diff) | |
download | chrome-ec-78910aeabed52dc05880a2efe0300be2f697da87.tar.gz |
CR50: add previously missing NV RAM commits
Writing into NV RAM is a two phase process, the data does not make it
into the flash unless it is explicitly committed.
BRANCH=ToT
BUG=chrome-os-partner:43025
TEST=certificates are now present after device is rebooted.
Change-Id: I13274616424c273dab4557374b27e0937e0e5976
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/361092
-rw-r--r-- | board/cr50/tpm2/manufacture.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/board/cr50/tpm2/manufacture.c b/board/cr50/tpm2/manufacture.c index fb165fef8c..7f230aed6d 100644 --- a/board/cr50/tpm2/manufacture.c +++ b/board/cr50/tpm2/manufacture.c @@ -384,6 +384,7 @@ static int store_cert(enum cros_perso_component_type component_type, NV_DefineSpace_In define_space; TPMA_NV space_attributes; NV_Write_In in; + int rv; /* Clear up structures potentially uszed only partially. */ memset(&define_space, 0, sizeof(define_space)); @@ -438,10 +439,10 @@ static int store_cert(enum cros_perso_component_type component_type, memcpy(in.data.t.buffer, cert->cert, cert->cert_len); in.offset = 0; - if (TPM2_NV_Write(&in) == TPM_RC_SUCCESS) - return 1; - else - return 0; + rv = TPM2_NV_Write(&in) == TPM_RC_SUCCESS; + rv &= NvCommit(); + + return rv; } static uint32_t hw_key_ladder_step(uint32_t cert) @@ -563,7 +564,7 @@ static int store_eps(uint8_t eps[PRIMARY_SEED_SIZE]) /* Persist the seed to flash. */ NvWriteReserved(NV_EP_SEED, &gp.EPSeed); - return 1; + return NvCommit(); } static void manufacture_complete(void) |