Improve error messages on windows

This commit is contained in:
Tom D'Netto 2019-04-11 10:20:46 -07:00 committed by DenisKarch
parent b128fd7448
commit 24ccdf576a

View File

@ -54,13 +54,13 @@ func probeSystemTPMs() ([]probedTPM, error) {
info, err := pcp.TPMInfo() info, err := pcp.TPMInfo()
if err != nil { if err != nil {
return nil, err return nil, fmt.Errorf("TPMInfo() failed: %v", err)
} }
var out probedTPM var out probedTPM
out.Version, err = tbsConvertVersion(info.TBSInfo) out.Version, err = tbsConvertVersion(info.TBSInfo)
if err != nil { if err != nil {
return nil, err return nil, fmt.Errorf("tbsConvertVersion(%v) failed: %v", info.TBSInfo.TPMVersion, err)
} }
return []probedTPM{out}, nil return []probedTPM{out}, nil
@ -80,16 +80,16 @@ func tbsConvertVersion(info tbsDeviceInfo) (TPMVersion, error) {
func openTPM(tpm probedTPM) (*TPM, error) { func openTPM(tpm probedTPM) (*TPM, error) {
pcp, err := openPCP() pcp, err := openPCP()
if err != nil { if err != nil {
return nil, err return nil, fmt.Errorf("openPCP() failed: %v", err)
} }
info, err := pcp.TPMInfo() info, err := pcp.TPMInfo()
if err != nil { if err != nil {
return nil, err return nil, fmt.Errorf("TPMInfo() failed: %v", err)
} }
vers, err := tbsConvertVersion(info.TBSInfo) vers, err := tbsConvertVersion(info.TBSInfo)
if err != nil { if err != nil {
return nil, err return nil, fmt.Errorf("tbsConvertVersion(%v) failed: %v", info.TBSInfo.TPMVersion, err)
} }
return &TPM{ return &TPM{