Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tpm2: Enable NVRAM in NVChip file case #35

Merged
merged 6 commits into from
Mar 26, 2019
Merged

tpm2: Enable NVRAM in NVChip file case #35

merged 6 commits into from
Mar 26, 2019

Conversation

stefanberger
Copy link
Owner

@stefanberger stefanberger commented Mar 23, 2019

When no callbacks are set and the plain NVChip file is used it wasn't
possible to save the state of the TPM 2 after a TPMLIB_Terminate()
TPMLIB_MainInit() sequence with a cached state (TPMLIB_SetState) since
in this case the NVRAM was not initialized. We now initialize the NV
in case no callback for restoring the state is set.

This series of patches fixes the issue and adds test cases around this.

@coveralls
Copy link

coveralls commented Mar 24, 2019

Pull Request Test Coverage Report for Build 509

  • 98 of 139 (70.5%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+1.0%) to 70.693%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/tpm_tpm2_interface.c 11 15 73.33%
tests/tpm2_pcr_read.c 34 50 68.0%
tests/tpm2_createprimary.c 53 74 71.62%
Totals Coverage Status
Change from base Build 481: 1.0%
Covered Lines: 673
Relevant Lines: 952

💛 - Coveralls

Split off the part that was handling the NVChip file in _plat__NVEnable
and call this new function _plat__NVEnable_ChipFile so we can call it
separately in case the caller works with the plain NVChip file.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
When no callbacks are set and the plain NVChip file is used it wasn't
possible to save the state of the TPM 2 after a TPMLIB_Terminate()
TPMLIB_MainInit() sequence with a cached state (TPMLIB_SetState) since
in this case the NVRAM was not initialized. We now initialize the NV
in case no callback for restoring the state is set.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
@stefanberger stefanberger force-pushed the master.next branch 2 times, most recently from 5153a9c to 9efd31f Compare March 25, 2019 23:54
@stefanberger stefanberger changed the title tests: Extend PCR and read again after restart of TPM with restored s… tpm2: Enable NVRAM in NVChip file case Mar 26, 2019
…tate

Extend the existing test case with extending PCR 10 and reading back
the result, then storing the state blobs and setting them and checking
the value of PCR 10 again.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Add a test case that test the restoring of the permanent
state that must have a persisted key.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
@stefanberger stefanberger force-pushed the master.next branch 2 times, most recently from 101041c to c631d95 Compare March 26, 2019 11:07
Leave a note in the TPMLIB_RegisterCallbacks() function about
the effects of leaving the store- and loaddata functions in the
interface unset.

Leave another not in TPMLIB_MainInit() to not use the library without
calling TPMLIB_RegiserCallbacks().

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants