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: Add more tests with the role field populated #361

Merged

Conversation

chrisccoulson
Copy link
Collaborator

The vast majority of tests were performed with the role field empty, which isn't going to be the typical situation.

@chrisccoulson chrisccoulson marked this pull request as ready for review January 16, 2025 16:01
The vast majority of tests were performed with the role field empty,
which isn't going to be the typical situation.
@chrisccoulson chrisccoulson force-pushed the tpm2-add-extra-seal-tests branch from c376989 to cd33a6f Compare January 16, 2025 16:01
Copy link
Collaborator

@pedronis pedronis left a comment

Choose a reason for hiding this comment

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

thank you

@chrisccoulson chrisccoulson merged commit 4ebbc42 into canonical:master Jan 17, 2025
2 checks passed
chrisccoulson added a commit to chrisccoulson/secboot that referenced this pull request Jan 22, 2025
PR canonical#361 addressed the issue that most tpm2 tests were being performed
with an empty role, which isn't realistic. It turns out that I missed a
few places, particularly in some of the platform tests, that if I had
fixed in the previous PR, would have noticed that the role parameter
isn't being passed through the platform interface (this would get picked
up when changing a password because key validate would fail).

This addresses this, and fixes tests in the top-level package to catch
it as well.

Note that I'm using the same value in most tests - my normal approach to
unit testing is to test each input with at least more than one value,
but the tests in the top-level secboot package and the tpm2 sub-package
are getting a bit complicated with a lot of inconsistencies in their
approach to testing. I have issues canonical#329 and canonical#330 open to refactor the
tests so they are structured in a more consistent way, like the tests
for the recently added plainkey platform are.
chrisccoulson added a commit that referenced this pull request Jan 27, 2025
Fix plumbing of the role via the PlatformKeyDataHandler interface.

PR #361 addressed the issue that most tpm2 tests were being performed with an empty role, which isn't realistic. It turns out that I missed a few places, particularly in some of the platform tests, that if I had fixed in the previous PR, would have noticed that the role parameter isn't being passed through the platform interface (this would get picked up when changing a password because key validation would fail).

This addresses this, and fixes tests in the top-level package to catch it as well.

Note that I'm using the same value in most tests - my normal approach to unit testing is to test each input with at least more than one value, but the tests in the top-level secboot package and the tpm2 sub-package are getting a bit complicated with a lot of inconsistencies in their approach to testing. I have issues #329 and #330 open to refactor the tests so they are structured in a more consistent way, like the tests for the recently added plainkey platform are.
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