mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-22 05:27:08 +00:00
feature/tpm: return opening errors from both /dev/tpmrm0 and /dev/tpm0 (#18071)
This might help users diagnose why TPM access is failing for tpmrm0. Fixes #18026 Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
package tpm
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/google/go-tpm/tpm2/transport"
|
||||
"github.com/google/go-tpm/tpm2/transport/linuxtpm"
|
||||
)
|
||||
@@ -13,5 +15,10 @@ func open() (transport.TPMCloser, error) {
|
||||
if err == nil {
|
||||
return tpm, nil
|
||||
}
|
||||
return linuxtpm.Open("/dev/tpm0")
|
||||
errs := []error{err}
|
||||
tpm, err = linuxtpm.Open("/dev/tpm0")
|
||||
if err == nil {
|
||||
return tpm, nil
|
||||
}
|
||||
return nil, errors.Join(errs...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user