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

swtpm: Implement CheckState interface function #556

Merged
merged 2 commits into from
Sep 25, 2021

Conversation

stefanberger
Copy link
Owner

This PR does some cleanup on the directory backend and implements a CheckState interface function for checking for availability of the permanent state blob on the backend.

@Etsukata Please have a look.

@coveralls
Copy link

coveralls commented Sep 24, 2021

Pull Request Test Coverage Report for Build 3482

  • 16 of 17 (94.12%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.02%) to 75.465%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/swtpm/swtpm_nvstore_dir.c 13 14 92.86%
Files with Coverage Reduction New Missed Lines %
src/swtpm/swtpm_nvstore.c 1 84.45%
Totals Coverage Status
Change from base Build 3466: 0.02%
Covered Lines: 5764
Relevant Lines: 7638

💛 - Coveralls

Copy link
Contributor

@Etsukata Etsukata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @stefanberger, I put a cleanup comment (nvdata). Other than that, it looks good to me.

@@ -1324,10 +1324,10 @@ int SWTPM_NVRAM_PrintJson(void)
TPM_RESULT rc = 0;
int ret = 0, n;
unsigned char *nvdata = NULL;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nvdata is no longer used. We can remove this.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Hadn't looked. Updated.

@stefanberger
Copy link
Owner Author

Thanks @stefanberger, I put a cleanup comment (nvdata). Other than that, it looks good to me.

Before it was also only looking for availability of the file, so now we have swtpm pretty much do the same and not try out the file.

@stefanberger stefanberger force-pushed the stefanberger/backend_is_available branch from c8267b5 to cc4a502 Compare September 25, 2021 03:50
Remove all interface functions from swtpm_nvstore_dir.h and make them
static in swtpm_nvstore_dir.c. This way we avoid direct calls to these
functions from elsewhere.

Move the declaration of the interface structure into swtpm_nvstore.h
to get rid of swtpm_nvstore_dir.h entirely.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
…blob

Implement a CheckState interface function for checking for the
TPM_PERMANENT_ALL_NAME blog. The dirctory backend does a simple stat on the
file without actually reading it, which otherwise may require the (correct)
key if it was encrypted.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
@stefanberger stefanberger force-pushed the stefanberger/backend_is_available branch from cc4a502 to e9c724d Compare September 25, 2021 03:54
Copy link
Contributor

@Etsukata Etsukata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good to me.

@stefanberger stefanberger changed the title Implement CheckState interface function swtpm: Implement CheckState interface function Sep 25, 2021
@stefanberger stefanberger merged commit 1b2b721 into master Sep 25, 2021
@stefanberger stefanberger deleted the stefanberger/backend_is_available branch September 25, 2021 12:59
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.

3 participants