tss: implement tlcl_save_state
commit2e690eeaf2c59070f74b01afb238c8a5208228f0
authorJoel Kitching <kitching@google.com>
Thu, 15 Nov 2018 08:48:53 +0000 (15 16:48 +0800)
committerPhilipp Deppenwiese <zaolin.daisuki@gmail.com>
Wed, 28 Nov 2018 18:32:59 +0000 (28 18:32 +0000)
treed83d2b153c93a74b29bc2eb326c120e98dfc24d1
parente102c5d54b79543eee34cf19bdbab7b25ef9417e
tss: implement tlcl_save_state

When an untrusted OS is running, we would like to use the Cr50
vendor-specific VENDOR_CC_TPM_MODE command to disable TPM.
Before doing this, we should save TPM state.  Implement
tlcl_save_state for this purpose.

This needs to live in coreboot codebase since on S3 resume path,
depthcharge is not reached.

Implement the function in both tcg-1.2 and tcg-2.0 for
completeness.

BUG=b:70681930,b:118202153
TEST=hack a call to tlcl_save_state into coreboot on S3 resume
     verify in AP console that it is called

Signed-off-by: Joel Kitching <kitching@google.com>
Change-Id: I8b51ca68456fc9b655e4dc2d0958b7c040d50510
Reviewed-on: https://review.coreboot.org/c/29646
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com>
src/security/tpm/tss.h
src/security/tpm/tss/tcg-1.2/tss.c
src/security/tpm/tss/tcg-2.0/tss.c
src/security/tpm/tss/tcg-2.0/tss_marshaling.c
src/security/tpm/tss/tcg-2.0/tss_structures.h