Documentation ¶
Index ¶
- Variables
- type Algorithm
- func (a Algorithm) Hash() (hash.Hash, error)
- func (a Algorithm) IsNull() bool
- func (v Algorithm) PrettyString(depth uint, withHeader bool, opts ...pretty.Option) string
- func (v Algorithm) ReadFrom(r io.Reader) (int64, error)
- func (a Algorithm) String() string
- func (v Algorithm) TotalSize() uint64
- func (v Algorithm) WriteTo(w io.Writer) (int64, error)
- type BitSize
- func (ks BitSize) InBits() uint16
- func (ks BitSize) InBytes() uint16
- func (v BitSize) PrettyString(depth uint, withHeader bool, opts ...pretty.Option) string
- func (v BitSize) ReadFrom(r io.Reader) (int64, error)
- func (ks *BitSize) SetInBits(amountOfBits uint16)
- func (ks *BitSize) SetInBytes(amountOfBytes uint16)
- func (v BitSize) TotalSize() uint64
- func (v BitSize) WriteTo(w io.Writer) (int64, error)
- type ChipsetACModuleInformation
- func (s *ChipsetACModuleInformation) AcmRevisionOffset() uint64
- func (s *ChipsetACModuleInformation) AcmRevisionTotalSize() uint64
- func (s *ChipsetACModuleInformation) AcmVersionOffset() uint64
- func (s *ChipsetACModuleInformation) AcmVersionTotalSize() uint64
- func (s *ChipsetACModuleInformation) CapabilitiesOffset() uint64
- func (s *ChipsetACModuleInformation) CapabilitiesTotalSize() uint64
- func (s *ChipsetACModuleInformation) ChipsetACMTypeOffset() uint64
- func (s *ChipsetACModuleInformation) ChipsetACMTypeTotalSize() uint64
- func (s *ChipsetACModuleInformation) ChipsetIDListOffset() uint64
- func (s *ChipsetACModuleInformation) ChipsetIDListTotalSize() uint64
- func (s *ChipsetACModuleInformation) LengthOffset() uint64
- func (s *ChipsetACModuleInformation) LengthTotalSize() uint64
- func (s *ChipsetACModuleInformation) MinMleHeaderVerOffset() uint64
- func (s *ChipsetACModuleInformation) MinMleHeaderVerTotalSize() uint64
- func (s *ChipsetACModuleInformation) OsSinitDataVerOffset() uint64
- func (s *ChipsetACModuleInformation) OsSinitDataVerTotalSize() uint64
- func (s *ChipsetACModuleInformation) PrettyString(depth uint, withHeader bool, opts ...pretty.Option) string
- func (s *ChipsetACModuleInformation) ProcessorIDListOffset() uint64
- func (s *ChipsetACModuleInformation) ProcessorIDListTotalSize() uint64
- func (s *ChipsetACModuleInformation) ReadFrom(r io.Reader) (int64, error)
- func (s *ChipsetACModuleInformation) Rehash()
- func (s *ChipsetACModuleInformation) RehashRecursive()
- func (s *ChipsetACModuleInformation) TotalSize() uint64
- func (s *ChipsetACModuleInformation) UUIDOffset() uint64
- func (s *ChipsetACModuleInformation) UUIDTotalSize() uint64
- func (s *ChipsetACModuleInformation) Validate() error
- func (s *ChipsetACModuleInformation) VersionOffset() uint64
- func (s *ChipsetACModuleInformation) VersionTotalSize() uint64
- func (s *ChipsetACModuleInformation) WriteTo(w io.Writer) (int64, error)
- type ChipsetACModuleInformationV5
- func (s *ChipsetACModuleInformationV5) BaseOffset() uint64
- func (s *ChipsetACModuleInformationV5) BaseTotalSize() uint64
- func (s *ChipsetACModuleInformationV5) PrettyString(depth uint, withHeader bool, opts ...pretty.Option) string
- func (s *ChipsetACModuleInformationV5) ReadFrom(r io.Reader) (int64, error)
- func (s *ChipsetACModuleInformationV5) Rehash()
- func (s *ChipsetACModuleInformationV5) RehashRecursive()
- func (s *ChipsetACModuleInformationV5) TPMInfoListOffset() uint64
- func (s *ChipsetACModuleInformationV5) TPMInfoListTotalSize() uint64
- func (s *ChipsetACModuleInformationV5) TotalSize() uint64
- func (s *ChipsetACModuleInformationV5) Validate() error
- func (s *ChipsetACModuleInformationV5) WriteTo(w io.Writer) (int64, error)
- type Element
- type ElementsContainer
- type HashList
- func (s *HashList) ListOffset() uint64
- func (s *HashList) ListTotalSize() uint64
- func (s *HashList) PrettyString(depth uint, withHeader bool, opts ...pretty.Option) string
- func (s *HashList) ReadFrom(r io.Reader) (int64, error)
- func (s *HashList) Rehash()
- func (s *HashList) RehashRecursive()
- func (s *HashList) SizeOffset() uint64
- func (s *HashList) SizeTotalSize() uint64
- func (s *HashList) TotalSize() uint64
- func (s *HashList) Validate() error
- func (s *HashList) WriteTo(w io.Writer) (int64, error)
- type HashStructure
- func (s *HashStructure) HashAlgOffset() uint64
- func (s *HashStructure) HashAlgTotalSize() uint64
- func (s *HashStructure) HashBufferOffset() uint64
- func (s *HashStructure) HashBufferTotalSize() uint64
- func (s *HashStructure) PrettyString(depth uint, withHeader bool, opts ...pretty.Option) string
- func (s *HashStructure) ReadFrom(r io.Reader) (int64, error)
- func (s *HashStructure) Rehash()
- func (s *HashStructure) RehashRecursive()
- func (s *HashStructure) TotalSize() uint64
- func (s *HashStructure) Validate() error
- func (s *HashStructure) WriteTo(w io.Writer) (int64, error)
- type Key
- func (s *Key) DataOffset() uint64
- func (s *Key) DataTotalSize() uint64
- func (s *Key) KeyAlgOffset() uint64
- func (s *Key) KeyAlgTotalSize() uint64
- func (s *Key) KeySizeOffset() uint64
- func (s *Key) KeySizeTotalSize() uint64
- func (s *Key) PrettyString(depth uint, withHeader bool, opts ...pretty.Option) string
- func (k *Key) PrintBPMPubKey(bpmAlg Algorithm) error
- func (k *Key) PrintKMPubKey(kmAlg Algorithm) error
- func (k Key) PubKey() (crypto.PublicKey, error)
- func (s *Key) ReadFrom(r io.Reader) (int64, error)
- func (s *Key) Rehash()
- func (s *Key) RehashRecursive()
- func (k *Key) SetPubKey(key crypto.PublicKey) error
- func (s *Key) TotalSize() uint64
- func (s *Key) Validate() error
- func (s *Key) VersionOffset() uint64
- func (s *Key) VersionTotalSize() uint64
- func (s *Key) WriteTo(w io.Writer) (int64, error)
- type KeySignature
- func (s *KeySignature) FillSignature(signAlgo Algorithm, pubKey crypto.PublicKey, signedData []byte, ...) error
- func (s *KeySignature) KeyOffset() uint64
- func (s *KeySignature) KeyTotalSize() uint64
- func (s *KeySignature) PrettyString(depth uint, withHeader bool, opts ...pretty.Option) string
- func (s *KeySignature) ReadFrom(r io.Reader) (int64, error)
- func (s *KeySignature) Rehash()
- func (s *KeySignature) RehashRecursive()
- func (s *KeySignature) SetSignature(signAlgo Algorithm, hashAlgo Algorithm, privKey crypto.Signer, ...) error
- func (s *KeySignature) SetSignatureAuto(privKey crypto.Signer, signedData []byte) error
- func (s *KeySignature) SignatureOffset() uint64
- func (s *KeySignature) SignatureTotalSize() uint64
- func (s *KeySignature) TotalSize() uint64
- func (s *KeySignature) Validate() error
- func (s *KeySignature) Verify(signedData []byte) error
- func (s *KeySignature) VersionOffset() uint64
- func (s *KeySignature) VersionTotalSize() uint64
- func (s *KeySignature) WriteTo(w io.Writer) (int64, error)
- type Manifest
- type SVN
- type Signature
- func (s *Signature) DataOffset() uint64
- func (s *Signature) DataTotalSize() uint64
- func (m *Signature) FillSignature(signAlgo Algorithm, pubKey crypto.PublicKey, signedData []byte, ...) error
- func (s *Signature) HashAlgOffset() uint64
- func (s *Signature) HashAlgTotalSize() uint64
- func (s *Signature) KeySizeOffset() uint64
- func (s *Signature) KeySizeTotalSize() uint64
- func (s *Signature) PrettyString(depth uint, withHeader bool, opts ...pretty.Option) string
- func (s *Signature) ReadFrom(r io.Reader) (int64, error)
- func (s *Signature) Rehash()
- func (s *Signature) RehashRecursive()
- func (m *Signature) SetSignature(signAlgo Algorithm, hashAlgo Algorithm, privKey crypto.Signer, ...) error
- func (m *Signature) SetSignatureByData(sig SignatureDataInterface, hashAlgo Algorithm) error
- func (m *Signature) SetSignatureData(sig SignatureDataInterface) error
- func (s *Signature) SigSchemeOffset() uint64
- func (s *Signature) SigSchemeTotalSize() uint64
- func (m Signature) SignatureData() (SignatureDataInterface, error)
- func (s *Signature) TotalSize() uint64
- func (s *Signature) Validate() error
- func (s *Signature) VersionOffset() uint64
- func (s *Signature) VersionTotalSize() uint64
- func (s *Signature) WriteTo(w io.Writer) (int64, error)
- type SignatureDataInterface
- type SignatureECDSA
- type SignatureRSAASA
- type SignatureRSAPSS
- type SignatureSM2
- type StructInfo
- func (s *StructInfo) ElementSizeOffset() uint64
- func (s *StructInfo) ElementSizeTotalSize() uint64
- func (s *StructInfo) IDOffset() uint64
- func (s *StructInfo) IDTotalSize() uint64
- func (s *StructInfo) PrettyString(depth uint, withHeader bool, opts ...pretty.Option) string
- func (s *StructInfo) ReadFrom(r io.Reader) (int64, error)
- func (s *StructInfo) Rehash()
- func (s *StructInfo) RehashRecursive()
- func (s StructInfo) StructInfo() StructInfo
- func (s *StructInfo) TotalSize() uint64
- func (s *StructInfo) Validate() error
- func (s *StructInfo) Variable0Offset() uint64
- func (s *StructInfo) Variable0TotalSize() uint64
- func (s *StructInfo) VersionOffset() uint64
- func (s *StructInfo) VersionTotalSize() uint64
- func (s *StructInfo) WriteTo(w io.Writer) (int64, error)
- type Structure
- type StructureID
- type TPM2PCRExtendPolicySupport
- func (v TPM2PCRExtendPolicySupport) PrettyString(depth uint, withHeader bool, opts ...pretty.Option) string
- func (v TPM2PCRExtendPolicySupport) ReadFrom(r io.Reader) (int64, error)
- func (v TPM2PCRExtendPolicySupport) TotalSize() uint64
- func (v TPM2PCRExtendPolicySupport) WriteTo(w io.Writer) (int64, error)
- type TPMCapabilities
- func (v TPMCapabilities) PrettyString(depth uint, withHeader bool, opts ...pretty.Option) string
- func (v TPMCapabilities) ReadFrom(r io.Reader) (int64, error)
- func (cap TPMCapabilities) TPM2PCRExtendPolicySupport() TPM2PCRExtendPolicySupport
- func (cap TPMCapabilities) TPMFamilySupport() TPMFamilySupport
- func (v TPMCapabilities) TotalSize() uint64
- func (v TPMCapabilities) WriteTo(w io.Writer) (int64, error)
- type TPMFamilySupport
- func (familySupport TPMFamilySupport) IsDiscreteTPM12Supported() bool
- func (familySupport TPMFamilySupport) IsDiscreteTPM20Supported() bool
- func (familySupport TPMFamilySupport) IsFirmwareTPM20Supported() bool
- func (v TPMFamilySupport) PrettyString(depth uint, withHeader bool, opts ...pretty.Option) string
- func (v TPMFamilySupport) ReadFrom(r io.Reader) (int64, error)
- func (v TPMFamilySupport) TotalSize() uint64
- func (v TPMFamilySupport) WriteTo(w io.Writer) (int64, error)
- type TPMInfoList
- func (s *TPMInfoList) AlgorithmsOffset() uint64
- func (s *TPMInfoList) AlgorithmsTotalSize() uint64
- func (s *TPMInfoList) CapabilitiesOffset() uint64
- func (s *TPMInfoList) CapabilitiesTotalSize() uint64
- func (s *TPMInfoList) PrettyString(depth uint, withHeader bool, opts ...pretty.Option) string
- func (s *TPMInfoList) ReadFrom(r io.Reader) (int64, error)
- func (s *TPMInfoList) Rehash()
- func (s *TPMInfoList) RehashRecursive()
- func (s *TPMInfoList) TotalSize() uint64
- func (s *TPMInfoList) Validate() error
- func (s *TPMInfoList) WriteTo(w io.Writer) (int64, error)
Constants ¶
This section is empty.
Variables ¶
var ( // RandReader exports the rand.Reader RandReader = rand.Reader )
var ( // StrictOrderCheck defines if elements order checks should be performed. // For example in the Boot Policy Manifest elements could be in a wrong // order. And we still can parse it, but in this way `*Offset` methods // could be confusing, since they will show the offset as they will // be written (not as they were parsed). // // We require a strict order because it is explicitly required // in the documentation #575623: // // > The order of the elements and the order of the fields within each // > element are architectural and must be followed. StrictOrderCheck = true )
Functions ¶
This section is empty.
Types ¶
type Algorithm ¶
type Algorithm uint16
Algorithm represents a crypto algorithm value.
const ( AlgUnknown Algorithm = 0x0000 AlgRSA Algorithm = 0x0001 AlgSHA1 Algorithm = 0x0004 AlgSHA256 Algorithm = 0x000B AlgSHA384 Algorithm = 0x000C AlgSHA512 Algorithm = 0x000D AlgNull Algorithm = 0x0010 AlgSM3 Algorithm = 0x0012 AlgRSASSA Algorithm = 0x0014 AlgRSAPSS Algorithm = 0x0016 AlgECDSA Algorithm = 0x0018 AlgSM2 Algorithm = 0x001b AlgECC Algorithm = 0x0023 )
Supported algorithms
func GetAlgFromString ¶
func (Algorithm) Hash ¶
Hash returns a crypto.Hash based on the given id. An error is returned if the given algorithm is not a hash algorithm or is not available.
func (Algorithm) PrettyString ¶
PrettyString returns the bits of the flags in an easy-to-read format.
type BitSize ¶
type BitSize uint16
BitSize is a size in bits.
func (BitSize) PrettyString ¶
PrettyString returns the bits of the flags in an easy-to-read format.
func (*BitSize) SetInBytes ¶
SetInBytes sets the size in bytes.
type ChipsetACModuleInformation ¶
type ChipsetACModuleInformation struct { UUID [16]byte ChipsetACMType uint8 Version uint8 Length uint16 ChipsetIDList uint32 OsSinitDataVer uint32 MinMleHeaderVer uint32 Capabilities uint32 AcmVersion uint8 AcmRevision [3]uint8 ProcessorIDList uint32 }
ChipsetACModuleInformation represents Chipset AC Module Information Table parts for all versions
func NewChipsetACModuleInformation ¶
func NewChipsetACModuleInformation() *ChipsetACModuleInformation
NewChipsetACModuleInformation returns a new instance of ChipsetACModuleInformation with all default values set.
func (*ChipsetACModuleInformation) AcmRevisionOffset ¶
func (s *ChipsetACModuleInformation) AcmRevisionOffset() uint64
AcmRevisionOffset returns the offset in bytes of field AcmRevision
func (*ChipsetACModuleInformation) AcmRevisionTotalSize ¶
func (s *ChipsetACModuleInformation) AcmRevisionTotalSize() uint64
AcmRevisionSize returns the size in bytes of the value of field AcmRevision
func (*ChipsetACModuleInformation) AcmVersionOffset ¶
func (s *ChipsetACModuleInformation) AcmVersionOffset() uint64
AcmVersionOffset returns the offset in bytes of field AcmVersion
func (*ChipsetACModuleInformation) AcmVersionTotalSize ¶
func (s *ChipsetACModuleInformation) AcmVersionTotalSize() uint64
AcmVersionSize returns the size in bytes of the value of field AcmVersion
func (*ChipsetACModuleInformation) CapabilitiesOffset ¶
func (s *ChipsetACModuleInformation) CapabilitiesOffset() uint64
CapabilitiesOffset returns the offset in bytes of field Capabilities
func (*ChipsetACModuleInformation) CapabilitiesTotalSize ¶
func (s *ChipsetACModuleInformation) CapabilitiesTotalSize() uint64
CapabilitiesSize returns the size in bytes of the value of field Capabilities
func (*ChipsetACModuleInformation) ChipsetACMTypeOffset ¶
func (s *ChipsetACModuleInformation) ChipsetACMTypeOffset() uint64
ChipsetACMTypeOffset returns the offset in bytes of field ChipsetACMType
func (*ChipsetACModuleInformation) ChipsetACMTypeTotalSize ¶
func (s *ChipsetACModuleInformation) ChipsetACMTypeTotalSize() uint64
ChipsetACMTypeSize returns the size in bytes of the value of field ChipsetACMType
func (*ChipsetACModuleInformation) ChipsetIDListOffset ¶
func (s *ChipsetACModuleInformation) ChipsetIDListOffset() uint64
ChipsetIDListOffset returns the offset in bytes of field ChipsetIDList
func (*ChipsetACModuleInformation) ChipsetIDListTotalSize ¶
func (s *ChipsetACModuleInformation) ChipsetIDListTotalSize() uint64
ChipsetIDListSize returns the size in bytes of the value of field ChipsetIDList
func (*ChipsetACModuleInformation) LengthOffset ¶
func (s *ChipsetACModuleInformation) LengthOffset() uint64
LengthOffset returns the offset in bytes of field Length
func (*ChipsetACModuleInformation) LengthTotalSize ¶
func (s *ChipsetACModuleInformation) LengthTotalSize() uint64
LengthSize returns the size in bytes of the value of field Length
func (*ChipsetACModuleInformation) MinMleHeaderVerOffset ¶
func (s *ChipsetACModuleInformation) MinMleHeaderVerOffset() uint64
MinMleHeaderVerOffset returns the offset in bytes of field MinMleHeaderVer
func (*ChipsetACModuleInformation) MinMleHeaderVerTotalSize ¶
func (s *ChipsetACModuleInformation) MinMleHeaderVerTotalSize() uint64
MinMleHeaderVerSize returns the size in bytes of the value of field MinMleHeaderVer
func (*ChipsetACModuleInformation) OsSinitDataVerOffset ¶
func (s *ChipsetACModuleInformation) OsSinitDataVerOffset() uint64
OsSinitDataVerOffset returns the offset in bytes of field OsSinitDataVer
func (*ChipsetACModuleInformation) OsSinitDataVerTotalSize ¶
func (s *ChipsetACModuleInformation) OsSinitDataVerTotalSize() uint64
OsSinitDataVerSize returns the size in bytes of the value of field OsSinitDataVer
func (*ChipsetACModuleInformation) PrettyString ¶
func (s *ChipsetACModuleInformation) PrettyString(depth uint, withHeader bool, opts ...pretty.Option) string
PrettyString returns the content of the structure in an easy-to-read format.
func (*ChipsetACModuleInformation) ProcessorIDListOffset ¶
func (s *ChipsetACModuleInformation) ProcessorIDListOffset() uint64
ProcessorIDListOffset returns the offset in bytes of field ProcessorIDList
func (*ChipsetACModuleInformation) ProcessorIDListTotalSize ¶
func (s *ChipsetACModuleInformation) ProcessorIDListTotalSize() uint64
ProcessorIDListSize returns the size in bytes of the value of field ProcessorIDList
func (*ChipsetACModuleInformation) ReadFrom ¶
func (s *ChipsetACModuleInformation) ReadFrom(r io.Reader) (int64, error)
ReadFrom reads the ChipsetACModuleInformation from 'r' in format defined in the document #575623.
func (*ChipsetACModuleInformation) Rehash ¶
func (s *ChipsetACModuleInformation) Rehash()
Rehash sets values which are calculated automatically depending on the rest data. It is usually about the total size field of an element.
func (*ChipsetACModuleInformation) RehashRecursive ¶
func (s *ChipsetACModuleInformation) RehashRecursive()
RehashRecursive calls Rehash (see below) recursively.
func (*ChipsetACModuleInformation) TotalSize ¶
func (s *ChipsetACModuleInformation) TotalSize() uint64
Size returns the total size of the ChipsetACModuleInformation.
func (*ChipsetACModuleInformation) UUIDOffset ¶
func (s *ChipsetACModuleInformation) UUIDOffset() uint64
UUIDOffset returns the offset in bytes of field UUID
func (*ChipsetACModuleInformation) UUIDTotalSize ¶
func (s *ChipsetACModuleInformation) UUIDTotalSize() uint64
UUIDSize returns the size in bytes of the value of field UUID
func (*ChipsetACModuleInformation) Validate ¶
func (s *ChipsetACModuleInformation) Validate() error
Validate (recursively) checks the structure if there are any unexpected values. It returns an error if so.
func (*ChipsetACModuleInformation) VersionOffset ¶
func (s *ChipsetACModuleInformation) VersionOffset() uint64
VersionOffset returns the offset in bytes of field Version
func (*ChipsetACModuleInformation) VersionTotalSize ¶
func (s *ChipsetACModuleInformation) VersionTotalSize() uint64
VersionSize returns the size in bytes of the value of field Version
type ChipsetACModuleInformationV5 ¶
type ChipsetACModuleInformationV5 struct { Base ChipsetACModuleInformation TPMInfoList uint32 }
ChipsetACModuleInformationV5 represents Chipset AC Module Information Table for version >= 5
func NewChipsetACModuleInformationV5 ¶
func NewChipsetACModuleInformationV5() *ChipsetACModuleInformationV5
NewChipsetACModuleInformationV5 returns a new instance of ChipsetACModuleInformationV5 with all default values set.
func ParseChipsetACModuleInformation ¶
func ParseChipsetACModuleInformation(r io.Reader) (int64, ChipsetACModuleInformationV5, error)
ParseChipsetACModuleInformation parses Chipset AC Module Information Table according to the version
func (*ChipsetACModuleInformationV5) BaseOffset ¶
func (s *ChipsetACModuleInformationV5) BaseOffset() uint64
BaseOffset returns the offset in bytes of field Base
func (*ChipsetACModuleInformationV5) BaseTotalSize ¶
func (s *ChipsetACModuleInformationV5) BaseTotalSize() uint64
BaseSize returns the size in bytes of the value of field Base
func (*ChipsetACModuleInformationV5) PrettyString ¶
func (s *ChipsetACModuleInformationV5) PrettyString(depth uint, withHeader bool, opts ...pretty.Option) string
PrettyString returns the content of the structure in an easy-to-read format.
func (*ChipsetACModuleInformationV5) ReadFrom ¶
func (s *ChipsetACModuleInformationV5) ReadFrom(r io.Reader) (int64, error)
ReadFrom reads the ChipsetACModuleInformationV5 from 'r' in format defined in the document #575623.
func (*ChipsetACModuleInformationV5) Rehash ¶
func (s *ChipsetACModuleInformationV5) Rehash()
Rehash sets values which are calculated automatically depending on the rest data. It is usually about the total size field of an element.
func (*ChipsetACModuleInformationV5) RehashRecursive ¶
func (s *ChipsetACModuleInformationV5) RehashRecursive()
RehashRecursive calls Rehash (see below) recursively.
func (*ChipsetACModuleInformationV5) TPMInfoListOffset ¶
func (s *ChipsetACModuleInformationV5) TPMInfoListOffset() uint64
TPMInfoListOffset returns the offset in bytes of field TPMInfoList
func (*ChipsetACModuleInformationV5) TPMInfoListTotalSize ¶
func (s *ChipsetACModuleInformationV5) TPMInfoListTotalSize() uint64
TPMInfoListSize returns the size in bytes of the value of field TPMInfoList
func (*ChipsetACModuleInformationV5) TotalSize ¶
func (s *ChipsetACModuleInformationV5) TotalSize() uint64
Size returns the total size of the ChipsetACModuleInformationV5.
func (*ChipsetACModuleInformationV5) Validate ¶
func (s *ChipsetACModuleInformationV5) Validate() error
Validate (recursively) checks the structure if there are any unexpected values. It returns an error if so.
type Element ¶
type Element interface { Structure ReadDataFrom(r io.Reader) (int64, error) GetStructInfo() StructInfo SetStructInfo(StructInfo) }
Element is an abstraction of an element of a manifest.
type ElementsContainer ¶
ElementsContainer is an abstraction of set of elements of a manifest (for example: the root structure of BPM).
type HashList ¶
type HashList struct { Size uint16 `rehashValue:"TotalSize()" json:"hlSize"` List []HashStructure `json:"hlList"` }
HashList describes multiple digests
func NewHashList ¶
func NewHashList() *HashList
NewHashList returns a new instance of HashList with all default values set.
func (*HashList) ListOffset ¶
ListOffset returns the offset in bytes of field List
func (*HashList) ListTotalSize ¶
ListSize returns the size in bytes of the value of field List
func (*HashList) PrettyString ¶
PrettyString returns the content of the structure in an easy-to-read format.
func (*HashList) ReadFrom ¶
ReadFrom reads the HashList from 'r' in format defined in the document #575623.
func (*HashList) Rehash ¶
func (s *HashList) Rehash()
Rehash sets values which are calculated automatically depending on the rest data. It is usually about the total size field of an element.
func (*HashList) RehashRecursive ¶
func (s *HashList) RehashRecursive()
RehashRecursive calls Rehash (see below) recursively.
func (*HashList) SizeOffset ¶
SizeOffset returns the offset in bytes of field Size
func (*HashList) SizeTotalSize ¶
SizeSize returns the size in bytes of the value of field Size
type HashStructure ¶
type HashStructure struct { HashAlg Algorithm `default:"0x10" json:"hsAlg"` HashBuffer []byte `json:"hsBuffer"` }
HashStructure describes a digest.
func NewHashStructure ¶
func NewHashStructure() *HashStructure
NewHashStructure returns a new instance of HashStructure with all default values set.
func (*HashStructure) HashAlgOffset ¶
func (s *HashStructure) HashAlgOffset() uint64
HashAlgOffset returns the offset in bytes of field HashAlg
func (*HashStructure) HashAlgTotalSize ¶
func (s *HashStructure) HashAlgTotalSize() uint64
HashAlgSize returns the size in bytes of the value of field HashAlg
func (*HashStructure) HashBufferOffset ¶
func (s *HashStructure) HashBufferOffset() uint64
HashBufferOffset returns the offset in bytes of field HashBuffer
func (*HashStructure) HashBufferTotalSize ¶
func (s *HashStructure) HashBufferTotalSize() uint64
HashBufferSize returns the size in bytes of the value of field HashBuffer
func (*HashStructure) PrettyString ¶
PrettyString returns the content of the structure in an easy-to-read format.
func (*HashStructure) ReadFrom ¶
func (s *HashStructure) ReadFrom(r io.Reader) (int64, error)
ReadFrom reads the HashStructure from 'r' in format defined in the document #575623.
func (*HashStructure) Rehash ¶
func (s *HashStructure) Rehash()
Rehash sets values which are calculated automatically depending on the rest data. It is usually about the total size field of an element.
func (*HashStructure) RehashRecursive ¶
func (s *HashStructure) RehashRecursive()
RehashRecursive calls Rehash (see below) recursively.
func (*HashStructure) TotalSize ¶
func (s *HashStructure) TotalSize() uint64
Size returns the total size of the HashStructure.
func (*HashStructure) Validate ¶
func (s *HashStructure) Validate() error
Validate (recursively) checks the structure if there are any unexpected values. It returns an error if so.
type Key ¶
type Key struct { KeyAlg Algorithm `json:"keyAlg"` Version uint8 `require:"0x10" json:"keyVersion"` KeySize BitSize `json:"keyBitsize"` Data []byte `countValue:"keyDataSize()" json:"keyData"` }
Key is a public key of an asymmetric crypto keypair.
func (*Key) DataOffset ¶
DataOffset returns the offset in bytes of field Data
func (*Key) DataTotalSize ¶
DataSize returns the size in bytes of the value of field Data
func (*Key) KeyAlgOffset ¶
KeyAlgOffset returns the offset in bytes of field KeyAlg
func (*Key) KeyAlgTotalSize ¶
KeyAlgSize returns the size in bytes of the value of field KeyAlg
func (*Key) KeySizeOffset ¶
KeySizeOffset returns the offset in bytes of field KeySize
func (*Key) KeySizeTotalSize ¶
KeySizeSize returns the size in bytes of the value of field KeySize
func (*Key) PrettyString ¶
PrettyString returns the content of the structure in an easy-to-read format.
func (*Key) PrintBPMPubKey ¶
PrintBPMPubKey prints the BPM public signing key hash to fuse into the Intel ME
func (*Key) PrintKMPubKey ¶
PrintKMPubKey prints the KM public signing key hash to fuse into the Intel ME
func (*Key) Rehash ¶
func (s *Key) Rehash()
Rehash sets values which are calculated automatically depending on the rest data. It is usually about the total size field of an element.
func (*Key) RehashRecursive ¶
func (s *Key) RehashRecursive()
RehashRecursive calls Rehash (see below) recursively.
func (*Key) Validate ¶
Validate (recursively) checks the structure if there are any unexpected values. It returns an error if so.
func (*Key) VersionOffset ¶
VersionOffset returns the offset in bytes of field Version
func (*Key) VersionTotalSize ¶
VersionSize returns the size in bytes of the value of field Version
type KeySignature ¶
type KeySignature struct { Version uint8 `require:"0x10" json:"ksVersion,omitempty"` Key Key `json:"ksKey"` Signature Signature `json:"ksSignature"` }
KeySignature combines a public key and a signature in a single structure.
func NewKeySignature ¶
func NewKeySignature() *KeySignature
NewKeySignature returns a new instance of KeySignature with all default values set.
func (*KeySignature) FillSignature ¶
func (s *KeySignature) FillSignature(signAlgo Algorithm, pubKey crypto.PublicKey, signedData []byte, hashAlgo Algorithm) error
FillSignature sets a signature and all the values of KeyManifest, accordingly to arguments signAlgo, pubKey and signedData.
if signAlgo is zero then it is detected automatically, based on the type of the provided private key.
func (*KeySignature) KeyOffset ¶
func (s *KeySignature) KeyOffset() uint64
KeyOffset returns the offset in bytes of field Key
func (*KeySignature) KeyTotalSize ¶
func (s *KeySignature) KeyTotalSize() uint64
KeySize returns the size in bytes of the value of field Key
func (*KeySignature) PrettyString ¶
PrettyString returns the content of the structure in an easy-to-read format.
func (*KeySignature) ReadFrom ¶
func (s *KeySignature) ReadFrom(r io.Reader) (int64, error)
ReadFrom reads the KeySignature from 'r' in format defined in the document #575623.
func (*KeySignature) Rehash ¶
func (s *KeySignature) Rehash()
Rehash sets values which are calculated automatically depending on the rest data. It is usually about the total size field of an element.
func (*KeySignature) RehashRecursive ¶
func (s *KeySignature) RehashRecursive()
RehashRecursive calls Rehash (see below) recursively.
func (*KeySignature) SetSignature ¶
func (s *KeySignature) SetSignature(signAlgo Algorithm, hashAlgo Algorithm, privKey crypto.Signer, signedData []byte) error
SetSignature generates a signature and sets all the values of KeyManifest, accordingly to arguments signAlgo, privKey and signedData.
if signAlgo is zero then it is detected automatically, based on the type of the provided private key.
func (*KeySignature) SetSignatureAuto ¶
func (s *KeySignature) SetSignatureAuto(privKey crypto.Signer, signedData []byte) error
SetSignatureAuto generates a signature and sets all the values of KeyManifest, accordingly to arguments privKey and signedData.
Signing algorithm will be detected automatically based on the type of the provided private key.
func (*KeySignature) SignatureOffset ¶
func (s *KeySignature) SignatureOffset() uint64
SignatureOffset returns the offset in bytes of field Signature
func (*KeySignature) SignatureTotalSize ¶
func (s *KeySignature) SignatureTotalSize() uint64
SignatureSize returns the size in bytes of the value of field Signature
func (*KeySignature) TotalSize ¶
func (s *KeySignature) TotalSize() uint64
Size returns the total size of the KeySignature.
func (*KeySignature) Validate ¶
func (s *KeySignature) Validate() error
Validate (recursively) checks the structure if there are any unexpected values. It returns an error if so.
func (*KeySignature) Verify ¶
func (s *KeySignature) Verify(signedData []byte) error
Verify verifies the builtin signature with the builtin public key.
func (*KeySignature) VersionOffset ¶
func (s *KeySignature) VersionOffset() uint64
VersionOffset returns the offset in bytes of field Version
func (*KeySignature) VersionTotalSize ¶
func (s *KeySignature) VersionTotalSize() uint64
VersionSize returns the size in bytes of the value of field Version
type Signature ¶
type Signature struct { SigScheme Algorithm `json:"sigScheme"` Version uint8 `require:"0x10" json:"sigVersion,omitempty"` KeySize BitSize `json:"sigKeysize,omitempty"` HashAlg Algorithm `json:"sigHashAlg"` Data []byte `countValue:"KeySize.InBytes()" prettyValue:"dataPrettyValue()" json:"sigData"` }
Signature exports the Signature structure
func NewSignature ¶
func NewSignature() *Signature
NewSignature returns a new instance of Signature with all default values set.
func (*Signature) DataOffset ¶
DataOffset returns the offset in bytes of field Data
func (*Signature) DataTotalSize ¶
DataSize returns the size in bytes of the value of field Data
func (*Signature) FillSignature ¶
func (m *Signature) FillSignature(signAlgo Algorithm, pubKey crypto.PublicKey, signedData []byte, hashAlgo Algorithm) error
FillSignature sets the signature accordingly to arguments signAlgo, pubKey and signedData; and sets all the fields of the structure Signature.
if signAlgo is zero then it is detected automatically, based on the type of the provided private key.
func (*Signature) HashAlgOffset ¶
HashAlgOffset returns the offset in bytes of field HashAlg
func (*Signature) HashAlgTotalSize ¶
HashAlgSize returns the size in bytes of the value of field HashAlg
func (*Signature) KeySizeOffset ¶
KeySizeOffset returns the offset in bytes of field KeySize
func (*Signature) KeySizeTotalSize ¶
KeySizeSize returns the size in bytes of the value of field KeySize
func (*Signature) PrettyString ¶
PrettyString returns the content of the structure in an easy-to-read format.
func (*Signature) ReadFrom ¶
ReadFrom reads the Signature from 'r' in format defined in the document #575623.
func (*Signature) Rehash ¶
func (s *Signature) Rehash()
Rehash sets values which are calculated automatically depending on the rest data. It is usually about the total size field of an element.
func (*Signature) RehashRecursive ¶
func (s *Signature) RehashRecursive()
RehashRecursive calls Rehash (see below) recursively.
func (*Signature) SetSignature ¶
func (m *Signature) SetSignature(signAlgo Algorithm, hashAlgo Algorithm, privKey crypto.Signer, signedData []byte) error
SetSignature calculates the signature accordingly to arguments signAlgo, privKey and signedData; and sets all the fields of the structure Signature.
if signAlgo is zero then it is detected automatically, based on the type of the provided private key.
func (*Signature) SetSignatureByData ¶
func (m *Signature) SetSignatureByData(sig SignatureDataInterface, hashAlgo Algorithm) error
SetSignatureByData sets all the fields of the structure Signature by accepting one of these types as the input argument `sig`: * SignatureRSAPSS * SignatureRSAASA * SignatureECDSA * SignatureSM2
func (*Signature) SetSignatureData ¶
func (m *Signature) SetSignatureData(sig SignatureDataInterface) error
SetSignatureData sets the value of the field Data by accepting one of these types as the input argument `sig`: * SignatureRSAPSS * SignatureRSAASA * SignatureECDSA * SignatureSM2
func (*Signature) SigSchemeOffset ¶
SigSchemeOffset returns the offset in bytes of field SigScheme
func (*Signature) SigSchemeTotalSize ¶
SigSchemeSize returns the size in bytes of the value of field SigScheme
func (Signature) SignatureData ¶
func (m Signature) SignatureData() (SignatureDataInterface, error)
SignatureData parses field Data and returns the signature as one of these types: * SignatureRSAPSS * SignatureRSAASA * SignatureECDSA * SignatureSM2
func (*Signature) Validate ¶
Validate (recursively) checks the structure if there are any unexpected values. It returns an error if so.
func (*Signature) VersionOffset ¶
VersionOffset returns the offset in bytes of field Version
func (*Signature) VersionTotalSize ¶
VersionSize returns the size in bytes of the value of field Version
type SignatureDataInterface ¶
type SignatureDataInterface interface { fmt.Stringer // Verify returns nil if signedData was indeed signed by key pk, and // returns an appropriate error otherwise. Verify(pk crypto.PublicKey, hashAlgo Algorithm, signedData []byte) error }
SignatureDataInterface is the interface which abstracts all the signature data types.
func NewSignatureByData ¶
func NewSignatureByData( signAlgo Algorithm, pubKey crypto.PublicKey, signedData []byte, ) (SignatureDataInterface, error)
NewSignatureByData returns an implementation of SignatureDataInterface, accordingly to signAlgo, publicKey and signedData.
if signAlgo is zero then it is detected automatically, based on the type of the provided private key.
func NewSignatureData ¶
func NewSignatureData( signAlgo Algorithm, privKey crypto.Signer, signedData []byte, ) (SignatureDataInterface, error)
NewSignatureData returns an implementation of SignatureDataInterface, accordingly to signAlgo, privKey and signedData.
if signAlgo is zero then it is detected automatically, based on the type of the provided private key.
type SignatureECDSA ¶
type SignatureECDSA struct { // R is the R component of the signature. R *big.Int // S is the S component of the signature. S *big.Int }
SignatureECDSA is a structure with components of an ECDSA signature.
func (SignatureECDSA) String ¶
func (s SignatureECDSA) String() string
String implements fmt.Stringer
type SignatureRSAASA ¶
type SignatureRSAASA []byte
SignatureRSAASA is RSAASA signature bytes.
func (SignatureRSAASA) String ¶
func (s SignatureRSAASA) String() string
String implements fmt.Stringer
type SignatureRSAPSS ¶
type SignatureRSAPSS []byte
SignatureRSAPSS is RSAPSS signature bytes.
func (SignatureRSAPSS) String ¶
func (s SignatureRSAPSS) String() string
String implements fmt.Stringer
type SignatureSM2 ¶
type SignatureSM2 struct { // R is the R component of the signature. R *big.Int // S is the S component of the signature. S *big.Int }
SignatureSM2 is a structure with components of an SM2 signature.
type StructInfo ¶
type StructInfo struct { ID StructureID `json:"StructInfoID"` Version uint8 `json:"StructInfoVersion"` Variable0 uint8 `json:"StructInfoVariable0"` ElementSize uint16 `json:"StructInfoElementSize"` }
StructInfo is the common part of any structure of a manifest
func NewStructInfo ¶
func NewStructInfo() *StructInfo
NewStructInfo returns a new instance of StructInfo with all default values set.
func (*StructInfo) ElementSizeOffset ¶
func (s *StructInfo) ElementSizeOffset() uint64
ElementSizeOffset returns the offset in bytes of field ElementSize
func (*StructInfo) ElementSizeTotalSize ¶
func (s *StructInfo) ElementSizeTotalSize() uint64
ElementSizeSize returns the size in bytes of the value of field ElementSize
func (*StructInfo) IDOffset ¶
func (s *StructInfo) IDOffset() uint64
IDOffset returns the offset in bytes of field ID
func (*StructInfo) IDTotalSize ¶
func (s *StructInfo) IDTotalSize() uint64
IDSize returns the size in bytes of the value of field ID
func (*StructInfo) PrettyString ¶
PrettyString returns the content of the structure in an easy-to-read format.
func (*StructInfo) ReadFrom ¶
func (s *StructInfo) ReadFrom(r io.Reader) (int64, error)
ReadFrom reads the StructInfo from 'r' in format defined in the document #575623.
func (*StructInfo) Rehash ¶
func (s *StructInfo) Rehash()
Rehash sets values which are calculated automatically depending on the rest data. It is usually about the total size field of an element.
func (*StructInfo) RehashRecursive ¶
func (s *StructInfo) RehashRecursive()
RehashRecursive calls Rehash (see below) recursively.
func (StructInfo) StructInfo ¶
func (s StructInfo) StructInfo() StructInfo
StructInfo just returns StructInfo, it is a handy method if StructInfo is included anonymously to another type.
func (*StructInfo) TotalSize ¶
func (s *StructInfo) TotalSize() uint64
Size returns the total size of the StructInfo.
func (*StructInfo) Validate ¶
func (s *StructInfo) Validate() error
Validate (recursively) checks the structure if there are any unexpected values. It returns an error if so.
func (*StructInfo) Variable0Offset ¶
func (s *StructInfo) Variable0Offset() uint64
Variable0Offset returns the offset in bytes of field Variable0
func (*StructInfo) Variable0TotalSize ¶
func (s *StructInfo) Variable0TotalSize() uint64
Variable0Size returns the size in bytes of the value of field Variable0
func (*StructInfo) VersionOffset ¶
func (s *StructInfo) VersionOffset() uint64
VersionOffset returns the offset in bytes of field Version
func (*StructInfo) VersionTotalSize ¶
func (s *StructInfo) VersionTotalSize() uint64
VersionSize returns the size in bytes of the value of field Version
type Structure ¶
type Structure interface { io.ReaderFrom io.WriterTo TotalSize() uint64 // PrettyString returns the whole object as a structured string. PrettyString(depth uint, withHeader bool, opts ...pretty.Option) string }
Structure is an abstraction of a structure of a manifest.
type StructureID ¶
type StructureID [8]byte
StructureID is the magic ID string used to identify the structure type in the manifest
type TPM2PCRExtendPolicySupport ¶
type TPM2PCRExtendPolicySupport uint8
TPM2PCRExtendPolicySupport defined TPM2 PCR Extend policy support.
const ( TPM2PCRExtendIllegal TPM2PCRExtendPolicySupport = 0 TPM2PCRExtendMaximumAgilityPolicy TPM2PCRExtendPolicySupport = 1 TPM2PCRExtendMaximumPerformancePolicy TPM2PCRExtendPolicySupport = 2 TPM2PCRExtendBothPolicies TPM2PCRExtendPolicySupport = 3 )
Possible values of TPM2PCRExtendPolicySupport
func (TPM2PCRExtendPolicySupport) PrettyString ¶
func (v TPM2PCRExtendPolicySupport) PrettyString(depth uint, withHeader bool, opts ...pretty.Option) string
PrettyString returns the bits of the flags in an easy-to-read format.
func (TPM2PCRExtendPolicySupport) ReadFrom ¶
func (v TPM2PCRExtendPolicySupport) ReadFrom(r io.Reader) (int64, error)
ReadFrom reads the TPM2PCRExtendPolicySupport from 'r' in binary format.
func (TPM2PCRExtendPolicySupport) TotalSize ¶
func (v TPM2PCRExtendPolicySupport) TotalSize() uint64
TotalSize returns the total size measured through binary.Size.
type TPMCapabilities ¶
type TPMCapabilities uint32
TPMCapabilities defines TPM capabilities
func (TPMCapabilities) PrettyString ¶
PrettyString returns the bits of the flags in an easy-to-read format.
func (TPMCapabilities) ReadFrom ¶
func (v TPMCapabilities) ReadFrom(r io.Reader) (int64, error)
ReadFrom reads the TPMCapabilities from 'r' in binary format.
func (TPMCapabilities) TPM2PCRExtendPolicySupport ¶
func (cap TPMCapabilities) TPM2PCRExtendPolicySupport() TPM2PCRExtendPolicySupport
TPM2PCRExtendPolicySupport returns TPM2PCRExtendPolicySupport
func (TPMCapabilities) TPMFamilySupport ¶
func (cap TPMCapabilities) TPMFamilySupport() TPMFamilySupport
TPMFamilySupport returns TPMFamilySupport
func (TPMCapabilities) TotalSize ¶
func (v TPMCapabilities) TotalSize() uint64
TotalSize returns the total size measured through binary.Size.
type TPMFamilySupport ¶
type TPMFamilySupport uint8
TPMFamilySupport defines TPM family support
func (TPMFamilySupport) IsDiscreteTPM12Supported ¶
func (familySupport TPMFamilySupport) IsDiscreteTPM12Supported() bool
IsDiscreteTPM12Supported returns true if discrete TPM1.2 is supported. PrettyString-true: Discrete TPM1.2 is supported PrettyString-false: Discrete TPM1.2 is not supported
func (TPMFamilySupport) IsDiscreteTPM20Supported ¶
func (familySupport TPMFamilySupport) IsDiscreteTPM20Supported() bool
IsDiscreteTPM20Supported returns true if discrete TPM2.0 is supported. PrettyString-true: Discrete TPM2.0 is supported PrettyString-false: Discrete TPM2.0 is not supported
func (TPMFamilySupport) IsFirmwareTPM20Supported ¶
func (familySupport TPMFamilySupport) IsFirmwareTPM20Supported() bool
IsFirmwareTPM20Supported returns true if firmware TPM2.0 is supported. PrettyString-true: Firmware TPM2.0 is supported PrettyString-false: Firmware TPM2.0 is not supported
func (TPMFamilySupport) PrettyString ¶
PrettyString returns the bits of the flags in an easy-to-read format.
func (TPMFamilySupport) ReadFrom ¶
func (v TPMFamilySupport) ReadFrom(r io.Reader) (int64, error)
ReadFrom reads the TPMFamilySupport from 'r' in binary format.
func (TPMFamilySupport) TotalSize ¶
func (v TPMFamilySupport) TotalSize() uint64
TotalSize returns the total size measured through binary.Size.
type TPMInfoList ¶
type TPMInfoList struct { Capabilities TPMCapabilities Algorithms []Algorithm }
TPMInfoList represents TPM capabilities supported by ACM
func NewTPMInfoList ¶
func NewTPMInfoList() *TPMInfoList
NewTPMInfoList returns a new instance of TPMInfoList with all default values set.
func (*TPMInfoList) AlgorithmsOffset ¶
func (s *TPMInfoList) AlgorithmsOffset() uint64
AlgorithmsOffset returns the offset in bytes of field Algorithms
func (*TPMInfoList) AlgorithmsTotalSize ¶
func (s *TPMInfoList) AlgorithmsTotalSize() uint64
AlgorithmsSize returns the size in bytes of the value of field Algorithms
func (*TPMInfoList) CapabilitiesOffset ¶
func (s *TPMInfoList) CapabilitiesOffset() uint64
CapabilitiesOffset returns the offset in bytes of field Capabilities
func (*TPMInfoList) CapabilitiesTotalSize ¶
func (s *TPMInfoList) CapabilitiesTotalSize() uint64
CapabilitiesSize returns the size in bytes of the value of field Capabilities
func (*TPMInfoList) PrettyString ¶
PrettyString returns the content of the structure in an easy-to-read format.
func (*TPMInfoList) ReadFrom ¶
func (s *TPMInfoList) ReadFrom(r io.Reader) (int64, error)
ReadFrom reads the TPMInfoList from 'r' in format defined in the document #575623.
func (*TPMInfoList) Rehash ¶
func (s *TPMInfoList) Rehash()
Rehash sets values which are calculated automatically depending on the rest data. It is usually about the total size field of an element.
func (*TPMInfoList) RehashRecursive ¶
func (s *TPMInfoList) RehashRecursive()
RehashRecursive calls Rehash (see below) recursively.
func (*TPMInfoList) TotalSize ¶
func (s *TPMInfoList) TotalSize() uint64
Size returns the total size of the TPMInfoList.
func (*TPMInfoList) Validate ¶
func (s *TPMInfoList) Validate() error
Validate (recursively) checks the structure if there are any unexpected values. It returns an error if so.
Source Files ¶
- chipset_ac_module_information.go
- chipset_ac_module_information_manifestcodegen.go
- chipset_ac_module_information_nocodegen.go
- config.go
- crypto_routines.go
- crypto_routines_manifestcodegen.go
- hash.go
- hash_manifestcodegen.go
- key.go
- key_manifestcodegen.go
- key_signature.go
- key_signature_manifestcodegen.go
- signature.go
- signature_manifestcodegen.go
- signature_types.go
- structure.go
- structure_manifestcodegen.go
- svn.go
- tpm_info_list.go
- tpm_info_list_manifestcodegen.go