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: Allow for tpm2.OpenTPM() to use default paths on Linux #256

Merged
merged 1 commit into from
Jul 27, 2021

Conversation

josephlr
Copy link
Member

This allows users to easily to "the right thing" on Linux, which is to try to open /dev/tpmrm0 and then fall back to /dev/tpm0 if the RM doesn't exist. This is what tpm2-tss does.

Signed-off-by: Joe Richey joerichey@google.com

switch len(path) {
case 0:
tpm, err = tpmutil.OpenTPM("/dev/tpmrm0")
if os.IsNotExist(err) {
Copy link
Contributor

Choose a reason for hiding this comment

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

we should use errors.Is(err, os.ErrNotExist) https://golang.org/src/os/error.go?s=3221:3252#L82

@alexmwu
Copy link
Contributor

alexmwu commented Jul 1, 2021

This PR is technically a breaking change, if anyone depends on the signature of OpenTPM on non Windows GOOSes. See https://blog.golang.org/module-compatibility#TOC_2. We may want to update the minor version.

This is a _breaking_ change.

Signed-off-by: Joe Richey <joerichey@google.com>
@josephlr josephlr merged commit b3942ee into google:master Jul 27, 2021
@josephlr josephlr deleted the open branch July 27, 2021 05:53
@josephlr
Copy link
Member Author

Discussed offline w/ Alex and Maintainers, we will have a minor breaking release of go-tpm to include this and other changes.

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