diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2016-07-16 18:14:02 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2016-07-17 14:50:40 +0000 |
commit | 61a0fe734e808d1dbdf56fb6023e04adf66553b3 (patch) | |
tree | 3f2dad0ece90033b30b0de107d4c596879e3641e | |
parent | 78910aeabed52dc05880a2efe0300be2f697da87 (diff) | |
download | chrome-ec-61a0fe734e808d1dbdf56fb6023e04adf66553b3.tar.gz |
CR50: do not try searching in uninitialized TPM NV RAM.
The manufacturing status check verifies if the proper certificates are
found in the device NV RAM. This check can not succeed unless NV RAM
metadata is initialized by calling _TPM_Init().
If the check shows that the device has not been through manufacturing
sequence yet, TPM_Manufacture() needs to be invoked to make sure that
all relevant TPM structures are initialized and properly stored in NV
RAM. _TPM_Init() needs to be invoked again after that.
BRANCH=ToT
BUG=chrome-os-partner:43025
TEST=restarting Kevin device with pre-manufactured CR50 takes it
through factory initialization on every reboot. Restarting Kevin
once TPM is through manufacturing process shows that the
previously saved rollback counters are preserved.
Change-Id: I80b69f2c4b8d0e4cca154db510867df39c707ce2
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/361093
Reviewed-by: Nagendra Modadugu <ngm@google.com>
-rw-r--r-- | common/tpm_registers.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/common/tpm_registers.c b/common/tpm_registers.c index 50b0d694af..aafce43fec 100644 --- a/common/tpm_registers.c +++ b/common/tpm_registers.c @@ -459,13 +459,24 @@ static void tpm_init(void) _plat__Signal_PowerOn(); /* - * If tpm has not been manufactured yet - run this on every startup. - * This will wipe out NV Ram, among other things. + * Make sure NV RAM metadata is initialzed, needed to check + * manufactured status. This is a speculative call which will have to + * be repeated in case the TPM has not been through the manufacturing + * sequence yet. + * + * No harm in calling it twice in that case. */ - if (!tpm_manufactured()) + _TPM_Init(); + + if (!tpm_manufactured()) { + /* + * If tpm has not been manufactured yet - this needs to run on + * every startup. It will wipe out NV RAM, among other things. + */ TPM_Manufacture(1); + _TPM_Init(); + } - _TPM_Init(); _plat__SetNvAvail(); } |