gitee.com/mirrors_u-root/u-root@v7.0.0+incompatible/pkg/tss/structures.go (about) 1 // Copyright 2020 the u-root Authors. All rights reserved 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package tss 6 7 import ( 8 "crypto" 9 "fmt" 10 "io" 11 ) 12 13 // TCGVendorID TPM manufacturer id 14 type TCGVendorID uint32 15 16 func (id TCGVendorID) String() string { 17 18 s, ok := vendors[id] 19 if !ok { 20 return fmt.Sprintf("unknown TPM vendor (%d)", id) 21 } 22 return s 23 } 24 25 var vendors = map[TCGVendorID]string{ 26 1095582720: "AMD", 27 1096043852: "Atmel", 28 1112687437: "Broadcom", 29 1229081856: "IBM", 30 1213220096: "HPE", 31 1297303124: "Microsoft", 32 1229346816: "Infineon", 33 1229870147: "Intel", 34 1279610368: "Lenovo", 35 1314082080: "National Semiconductor", 36 1314150912: "Nationz", 37 1314145024: "Nuvoton Technology", 38 1363365709: "Qualcomm", 39 1397576515: "SMSC", 40 1398033696: "ST Microelectronics", 41 1397576526: "Samsung", 42 1397641984: "Sinosun", 43 1415073280: "Texas Instruments", 44 1464156928: "Winbond", 45 1380926275: "Fuzhou Rockchip", 46 1196379975: "Google", 47 } 48 49 // PCR encapsulates the value of a PCR at a point in time. 50 type PCR struct { 51 Index int 52 Digest []byte 53 DigestAlg crypto.Hash 54 } 55 56 // TPM interfaces with a TPM device on the system. 57 type TPM struct { 58 Version TPMVersion 59 Interf TPMInterface 60 61 SysPath string 62 RWC io.ReadWriteCloser 63 } 64 65 // probedTPM identifies a TPM device on the system, which 66 // is a candidate for being used. 67 type probedTPM struct { 68 Version TPMVersion 69 Path string 70 } 71 72 // TPMInfo contains information about the version & interface 73 // of an open TPM. 74 type TPMInfo struct { 75 Version TPMVersion 76 Interface TPMInterface 77 VendorInfo string 78 Manufacturer TCGVendorID 79 80 // FirmwareVersionMajor and FirmwareVersionMinor describe 81 // the firmware version of the TPM, but are only available 82 // for TPM 2.0 devices. 83 FirmwareVersionMajor int 84 FirmwareVersionMinor int 85 }