key

package
v2.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2021 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UsageBPMSigningPKD is the bit meaning the digest could be used as
	// Boot Policy Manifest signing pubkey digest.
	UsageBPMSigningPKD = Usage(1 << iota)

	// UsageBPMSigningPKD is the bit meaning the digest could be used as
	// FIT Patch Manifest signing pubkey digest.
	UsageFITPatchManifestSigningPKD

	// UsageBPMSigningPKD is the bit meaning the digest could be used as
	// ACM Manifest signing pubkey digest.
	UsageACMManifestSigningPKD

	// UsageBPMSigningPKD is the bit meaning the digest could be used as
	// SDEV signing pubkey digest.
	UsageSDEVSigningPKD

	// UsageReserved is a reserved bit
	UsageReserved
)
View Source
const StructureIDManifest = "__KEYM__"

StructureIDManifest is the StructureID (in terms of the document #575623) of element 'Manifest'.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hash

type Hash struct {
	// Usage is the digest usage bitmask.
	//
	// More than one bit can be set to indicate shared digest usage.
	// Usage of bit 0 is normative; other usages are informative.
	Usage Usage `json:"hash_Usage"`

	// Digest is the actual digest.
	Digest manifest.HashStructure `json:"hash_Struct"`
}

Hash is "KM hash Structure" defined in document #575623.

func NewHash

func NewHash() *Hash

NewHash returns a new instance of Hash with all default values set.

func (*Hash) DigestOffset

func (s *Hash) DigestOffset() uint64

DigestOffset returns the offset in bytes of field Digest

func (*Hash) DigestTotalSize

func (s *Hash) DigestTotalSize() uint64

DigestSize returns the size in bytes of the value of field Digest

func (*Hash) PrettyString

func (s *Hash) PrettyString(depth uint, withHeader bool, opts ...pretty.Option) string

PrettyString returns the content of the structure in an easy-to-read format.

func (*Hash) ReadFrom

func (s *Hash) ReadFrom(r io.Reader) (int64, error)

ReadFrom reads the Hash from 'r' in format defined in the document #575623.

func (*Hash) Rehash

func (s *Hash) 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 (*Hash) RehashRecursive

func (s *Hash) RehashRecursive()

RehashRecursive calls Rehash (see below) recursively.

func (*Hash) TotalSize

func (s *Hash) TotalSize() uint64

Size returns the total size of the Hash.

func (*Hash) UsageOffset

func (s *Hash) UsageOffset() uint64

UsageOffset returns the offset in bytes of field Usage

func (*Hash) UsageTotalSize

func (s *Hash) UsageTotalSize() uint64

UsageSize returns the size in bytes of the value of field Usage

func (*Hash) Validate

func (s *Hash) Validate() error

Validate (recursively) checks the structure if there are any unexpected values. It returns an error if so.

func (*Hash) WriteTo

func (s *Hash) WriteTo(w io.Writer) (int64, error)

WriteTo writes the Hash into 'w' in format defined in the document #575623.

type Manifest

type Manifest struct {
	manifest.StructInfo `id:"__KEYM__" version:"0x21" var0:"0" var1:"0"`

	// KeyManifestSignatureOffset is Key Manifest KeySignature offset.
	//
	// The original name is "KeySignatureOffset" (in #575623).
	KeyManifestSignatureOffset uint16 `rehashValue:"KeyAndSignatureOffset()" json:"km_SigOffset,omitempty"`

	// Reserved2 is an alignment.
	Reserved2 [3]byte `json:"km_Reserved2,omitempty"`

	// Revision is the revision of the Key Manifest defined by the Platform
	// Manufacturer.
	Revision uint8 `json:"km_Revision"`

	// KMSVN is the Key Manifest Security Version Number.
	KMSVN manifest.SVN `json:"km_SVN"`

	// KMID is the Key Manifest Identifier.
	KMID uint8 `json:"km_ID"`

	// PubKeyHashAlg is the hash algorithm of OEM public key digest programmed
	// into the FPF.
	PubKeyHashAlg manifest.Algorithm `json:"km_PubKeyHashAlg"`

	// Hash is the slice of KMHASH_STRUCT (KHS) structures (see table 5-3
	// of the document #575623). Describes BPM pubkey digest (among other).
	Hash []Hash `json:"km_hash"`

	// KeyAndSignature is the Key Manifest signature.
	KeyAndSignature manifest.KeySignature `json:"km_KeySignature"`
}

PrettyString: Key Manifest

func NewManifest

func NewManifest() *Manifest

NewManifest returns a new instance of Manifest with all default values set.

func (*Manifest) GetStructInfo

func (s *Manifest) GetStructInfo() manifest.StructInfo

GetStructInfo returns current value of StructInfo of the structure.

StructInfo is a set of standard fields with presented in any element ("element" in terms of document #575623).

func (*Manifest) HashOffset

func (s *Manifest) HashOffset() uint64

HashOffset returns the offset in bytes of field Hash

func (*Manifest) HashTotalSize

func (s *Manifest) HashTotalSize() uint64

HashSize returns the size in bytes of the value of field Hash

func (*Manifest) KMIDOffset

func (s *Manifest) KMIDOffset() uint64

KMIDOffset returns the offset in bytes of field KMID

func (*Manifest) KMIDTotalSize

func (s *Manifest) KMIDTotalSize() uint64

KMIDSize returns the size in bytes of the value of field KMID

func (*Manifest) KMSVNOffset

func (s *Manifest) KMSVNOffset() uint64

KMSVNOffset returns the offset in bytes of field KMSVN

func (*Manifest) KMSVNTotalSize

func (s *Manifest) KMSVNTotalSize() uint64

KMSVNSize returns the size in bytes of the value of field KMSVN

func (*Manifest) KeyAndSignatureOffset

func (s *Manifest) KeyAndSignatureOffset() uint64

KeyAndSignatureOffset returns the offset in bytes of field KeyAndSignature

func (*Manifest) KeyAndSignatureTotalSize

func (s *Manifest) KeyAndSignatureTotalSize() uint64

KeyAndSignatureSize returns the size in bytes of the value of field KeyAndSignature

func (*Manifest) KeyManifestSignatureOffsetOffset

func (s *Manifest) KeyManifestSignatureOffsetOffset() uint64

KeyManifestSignatureOffsetOffset returns the offset in bytes of field KeyManifestSignatureOffset

func (*Manifest) KeyManifestSignatureOffsetTotalSize

func (s *Manifest) KeyManifestSignatureOffsetTotalSize() uint64

KeyManifestSignatureOffsetSize returns the size in bytes of the value of field KeyManifestSignatureOffset

func (*Manifest) PrettyString

func (s *Manifest) PrettyString(depth uint, withHeader bool, opts ...pretty.Option) string

PrettyString returns the content of the structure in an easy-to-read format.

func (*Manifest) Print

func (m *Manifest) Print()

Print prints the Key Manifest.

func (*Manifest) PubKeyHashAlgOffset

func (s *Manifest) PubKeyHashAlgOffset() uint64

PubKeyHashAlgOffset returns the offset in bytes of field PubKeyHashAlg

func (*Manifest) PubKeyHashAlgTotalSize

func (s *Manifest) PubKeyHashAlgTotalSize() uint64

PubKeyHashAlgSize returns the size in bytes of the value of field PubKeyHashAlg

func (*Manifest) ReadDataFrom

func (s *Manifest) ReadDataFrom(r io.Reader) (int64, error)

ReadDataFrom reads the Manifest from 'r' excluding StructInfo, in format defined in the document #575623.

func (*Manifest) ReadFrom

func (s *Manifest) ReadFrom(r io.Reader) (int64, error)

ReadFrom reads the Manifest from 'r' in format defined in the document #575623.

func (*Manifest) Rehash

func (s *Manifest) 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 (*Manifest) RehashRecursive

func (s *Manifest) RehashRecursive()

RehashRecursive calls Rehash (see below) recursively.

func (*Manifest) Reserved2Offset

func (s *Manifest) Reserved2Offset() uint64

Reserved2Offset returns the offset in bytes of field Reserved2

func (*Manifest) Reserved2TotalSize

func (s *Manifest) Reserved2TotalSize() uint64

Reserved2Size returns the size in bytes of the value of field Reserved2

func (*Manifest) RevisionOffset

func (s *Manifest) RevisionOffset() uint64

RevisionOffset returns the offset in bytes of field Revision

func (*Manifest) RevisionTotalSize

func (s *Manifest) RevisionTotalSize() uint64

RevisionSize returns the size in bytes of the value of field Revision

func (*Manifest) SetSignature

func (m *Manifest) SetSignature(
	algo manifest.Algorithm,
	privKey crypto.Signer,
	signedData []byte,
) error

func (*Manifest) SetStructInfo

func (s *Manifest) SetStructInfo(newStructInfo manifest.StructInfo)

SetStructInfo sets new value of StructInfo to the structure.

StructInfo is a set of standard fields with presented in any element ("element" in terms of document #575623).

func (*Manifest) StructInfoOffset

func (s *Manifest) StructInfoOffset() uint64

StructInfoOffset returns the offset in bytes of field StructInfo

func (*Manifest) StructInfoTotalSize

func (s *Manifest) StructInfoTotalSize() uint64

StructInfoSize returns the size in bytes of the value of field StructInfo

func (*Manifest) TotalSize

func (s *Manifest) TotalSize() uint64

Size returns the total size of the Manifest.

func (*Manifest) Validate

func (s *Manifest) Validate() error

Validate (recursively) checks the structure if there are any unexpected values. It returns an error if so.

func (*Manifest) WriteTo

func (s *Manifest) WriteTo(w io.Writer) (int64, error)

WriteTo writes the Manifest into 'w' in format defined in the document #575623.

type Usage

type Usage uint64

Usage is the digest usage bitmask.

More than one bit can be set to indicate shared digest usage. Usage of bit 0 is normative; other usages are informative.

func (Usage) IsSet

func (u Usage) IsSet(f Usage) bool

IsSet returns true if bits `f` are set in bitmask `u`.

func (Usage) PrettyString

func (flags Usage) PrettyString(depth uint, withHeader bool, opts ...pretty.Option) string

PrettyString returns the bits of the flags in an easy-to-read format.

func (*Usage) Set

func (u *Usage) Set(f Usage, v bool)

Set sets/unsets the bits of `f` in bitmask `u`.

To set the bits `v` should be true, to unset -- false.

func (Usage) String

func (u Usage) String() string

String implements fmt.Stringer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL