Documentation
¶
Index ¶
- Constants
- func DecryptPrivKey(data []byte, password string) (crypto.PrivateKey, error)
- func GenECCKey(curve int, password string, ...) error
- func GenRSAKey(len int, password string, ...) error
- func ParseFITEntries(image []byte) (bpm *fit.EntryBootPolicyManifestRecord, km *fit.EntryKeyManifestRecord, ...)
- func PrintStructures(image []byte) error
- func ReadPubKey(path string) (crypto.PublicKey, error)
- func SaneMEBootGuardProvisioning(v bgheader.BootGuardVersion, fws *FirmwareStatus6, bgi *BGInfo) (bool, error)
- func StitchFITEntries(biosFilename string, acm, bpm, km []byte) error
- func StrictSaneBootGuardProvisioning(v bgheader.BootGuardVersion, fws *FirmwareStatus6, bgi *BGInfo) (bool, error)
- func ValidTXTRegister(hw hwapi.LowLevelHardwareInterfaces) (bool, error)
- func WriteCBnTStructures(image []byte, bpmFile, kmFile, acmFile *os.File) error
- type BGInfo
- type BootGuard
- func NewBPM(bpm io.ReadSeeker) (*BootGuard, error)
- func NewBPMAndKM(bpm io.ReadSeeker, km io.ReadSeeker) (*BootGuard, error)
- func NewBPMAndKMFromBIOS(biosFilepath string, jsonFilepath *os.File) (*BootGuard, error)
- func NewKM(km io.ReadSeeker) (*BootGuard, error)
- func NewVData(vdata VersionedData) (*BootGuard, error)
- func (b *BootGuard) BPMCryptoSecure() (bool, error)
- func (b *BootGuard) BPMKeyMatchKMHash() (bool, error)
- func (b *BootGuard) CalculateNEMSize(image []byte, acm *tools.ACM) (uint16, error)
- func (b *BootGuard) CreateIBBDigest(biosFilepath string) error
- func (b *BootGuard) CreateIBBSegments(seElement uint8, flags uint16, imagepath string) error
- func (b *BootGuard) GetBPMPubHash(pubkey crypto.PublicKey, hashAlgo string) error
- func (b *BootGuard) GetIBBsDigest(image []byte, hashAlgo string) (digest []byte, err error)
- func (b *BootGuard) IBBsMatchBPMDigest(image []byte) (bool, error)
- func (b *BootGuard) KMCryptoSecure() (bool, error)
- func (b *BootGuard) KMHasBPMHash() (bool, error)
- func (b *BootGuard) PrintBPM()
- func (b *BootGuard) PrintKM()
- func (b *BootGuard) ReadJSON(filepath string) error
- func (b *BootGuard) SaneBPMSecurityProps() (bool, error)
- func (b *BootGuard) SignBPM(signAlgo, hashAlgo string, privkey crypto.PrivateKey) ([]byte, error)
- func (b *BootGuard) SignKM(signAlgo string, signer crypto.Signer) ([]byte, error)
- func (b *BootGuard) StitchBPM(pubKey crypto.PublicKey, signature []byte) ([]byte, error)
- func (b *BootGuard) StitchKM(pubKey crypto.PublicKey, signature []byte) ([]byte, error)
- func (b *BootGuard) StrictSaneBPMSecurityProps() (bool, error)
- func (b *BootGuard) ValidateBPM() error
- func (b *BootGuard) ValidateKM() error
- func (b *BootGuard) ValidateMEAgainstManifests(fws *FirmwareStatus6) (bool, error)
- func (b *BootGuard) VerifyBPM() error
- func (b *BootGuard) VerifyKM() error
- func (b *BootGuard) WriteBPM() ([]byte, error)
- func (b *BootGuard) WriteJSON(f *os.File) error
- func (b *BootGuard) WriteKM() ([]byte, error)
- type CMOSIoAddress
- type FirmwareStatus1
- type FirmwareStatus6
- type IbbSegment
- type KeyHash
- type Pcr0Data
- type Pcr7Data
- type PowerDownRequest
- type TPMNvAddress
- type VersionedData
Constants ¶
const ( // Intel ME Config Space access IntelCSMEDeviceID = 16 IntelSPSDeviceID = 22 IntelBus = 0 IntelFunction = 0 // Boot Guard MSR BootGuardACMInfoMSR = 0x13a // Error Enforcement Policy EnforcementPolicyDoNothing = 0 EnforcementPolicyShutdownSomehow = 2 EnforcementPolicyShutdownImmediately = 3 EnforcementPolicyShutdownInThirtyMinutes = 1 )
Variables ¶
This section is empty.
Functions ¶
func DecryptPrivKey ¶
func DecryptPrivKey(data []byte, password string) (crypto.PrivateKey, error)
DecryptPrivKey takes the encrypted Key as byte slice and the password to decrypt the private key and returns it with it's type.
func GenECCKey ¶
func GenECCKey(curve int, password string, kmPubFile, kmPrivFile, bpmPubFile, bpmPrivFile *os.File) error
GenECCKey takes the required curve, two boolean to decide for KM and BPM key and a path to create a ECDSA key pair and writes its public and private keys to files.
func GenRSAKey ¶
func GenRSAKey(len int, password string, kmPubFile, kmPrivFile, bpmPubFile, bpmPrivFile *os.File) error
GenRSAKey takes the required keylength, two boolean to decide for KM and BPM key and a path to create a RSA key pair and writes its public and private keys to files.
func ParseFITEntries ¶
func ParseFITEntries(image []byte) (bpm *fit.EntryBootPolicyManifestRecord, km *fit.EntryKeyManifestRecord, acm *fit.EntrySACM, err error)
ParseFITEntries takes a firmware image and extract Boot policy manifest, key manifest and acm information.
func PrintStructures ¶
PrintStructures takes a firmware image and prints boot policy manifest, key manifest, ACM, chipset, processor and tpm information if available.
func ReadPubKey ¶
ReadPubKey ready a pem encoded RSA/ECC public key file
func SaneMEBootGuardProvisioning ¶
func SaneMEBootGuardProvisioning(v bgheader.BootGuardVersion, fws *FirmwareStatus6, bgi *BGInfo) (bool, error)
SaneMEBootGuardProvisioning validates during runtime ME bootguard provisioning
func StitchFITEntries ¶
StitchFITEntries takes a firmware filename, an acm, a boot policy manifest and a key manifest as byte slices and writes the information into the Firmware Interface Table of the firmware image.
func StrictSaneBootGuardProvisioning ¶ added in v2.8.0
func StrictSaneBootGuardProvisioning(v bgheader.BootGuardVersion, fws *FirmwareStatus6, bgi *BGInfo) (bool, error)
func ValidTXTRegister ¶ added in v2.8.0
func ValidTXTRegister(hw hwapi.LowLevelHardwareInterfaces) (bool, error)
Types ¶
type BGInfo ¶
type BootGuard ¶
type BootGuard struct {
VData VersionedData `json:"bootguard"`
Version bgheader.BootGuardVersion
}
BootGuard unification structure, operates on manifests and reader
func NewBPMAndKM ¶
func NewBPMAndKM(bpm io.ReadSeeker, km io.ReadSeeker) (*BootGuard, error)
func NewBPMAndKMFromBIOS ¶
func NewVData ¶
func NewVData(vdata VersionedData) (*BootGuard, error)
func (*BootGuard) BPMCryptoSecure ¶
BPMCryptoSecure verifies that BPM uses sane crypto algorithms
func (*BootGuard) BPMKeyMatchKMHash ¶
BPMKeyMatchKMHash verifies that BPM pubkey hash matches KM hash of Boot Policy
func (*BootGuard) CalculateNEMSize ¶
CalculateNEMSize calculates No Eviction Memory and returns it as count of 4K pages.
func (*BootGuard) CreateIBBDigest ¶ added in v2.8.0
CreateIBBDigest generates a Boot Policy Manifest with the given config and firmware image
func (*BootGuard) CreateIBBSegments ¶ added in v2.8.0
CreateIBBSegments takes a firmware image, searches files for additional IBBSegment, supports coreboot and UEFI EDK2
func (*BootGuard) GetBPMPubHash ¶
GetBPMPubHash takes the path to public BPM signing key and hash algorithm and returns a hash with hashAlg of pub BPM singing key
func (*BootGuard) GetIBBsDigest ¶
func (*BootGuard) IBBsMatchBPMDigest ¶
IBBsMatchBPMDigest verifies that FIT measurements match final digest in BPM
func (*BootGuard) KMCryptoSecure ¶
KMCryptoSecure verifies that KM uses sane crypto algorithms
func (*BootGuard) KMHasBPMHash ¶
KMHasBPMHash verifies that KM has the correctly signed BPM hash
func (*BootGuard) PrintBPM ¶
func (b *BootGuard) PrintBPM()
PrintBPM prints the boot policy manifest in human readable
func (*BootGuard) PrintKM ¶
func (b *BootGuard) PrintKM()
PrintKM prints the key manifest in human readable
func (*BootGuard) SaneBPMSecurityProps ¶
SaneBPMSecurityProps verifies that BPM contains security properties set accordingly to spec
func (*BootGuard) StrictSaneBPMSecurityProps ¶ added in v2.8.0
StrictSaneBPMSecurityProps verifies that BPM contains security properties more strictly
func (*BootGuard) ValidateBPM ¶
ValidateBPM reads from a binary, parses into the boot policy manifest structure and validates the structure
func (*BootGuard) ValidateKM ¶
ValidateKM reads from a binary source, parses into the key manifest structure and validates the structure
func (*BootGuard) ValidateMEAgainstManifests ¶
func (b *BootGuard) ValidateMEAgainstManifests(fws *FirmwareStatus6) (bool, error)
ValidateMEAgainstManifests validates during runtime ME configuation with BootGuard KM & BPM manifests
type CMOSIoAddress ¶
type CMOSIoAddress struct {
MediaType uint8
IndexRegisterAddress uint16
DataRegisterAddress uint16
BitFieldWidth uint8
BitFieldPosition uint8
IndexOffset uint8
}
CMOSIoAddress holds information about the location of on-demand power down requests in CMOS. The structure is a substructure used in PowerDownRequest structure.
type FirmwareStatus1 ¶ added in v2.8.0
type FirmwareStatus1 struct {
WorkingState uint32
MfgMode bool
FPTBad bool
OperatingState uint32
FWInitComplete bool
FTBUPLoaded bool
FWUpdateInProgress bool
ErrorCode uint32
OperatingMode uint32
ResetCount uint32
BootOptionPresent bool
BISTFinished bool
BISTTestState bool
BISTResetRequest bool
}
func GetHFSTS1 ¶ added in v2.8.0
func GetHFSTS1(hw hwapi.LowLevelHardwareInterfaces) (*FirmwareStatus1, error)
type FirmwareStatus6 ¶
type FirmwareStatus6 struct {
ForceACMBootPolicy bool
CPUDebugDisabled bool
BSPInitDisabled bool
ProtectBIOSEnvironment bool
BypassBootPolicy bool
BootPolicyInvalid bool
ErrorEnforcementPolicy uint32
MeasuredBootPolicy bool
VerifiedBootPolicy bool
ACMSVN uint32
KMSVN uint32
BPMSVN uint32
KMID uint32
BootPolicyManifestExecutionStatus bool
Error bool
BootGuardDisable bool
FPFDisable bool
FPFLock bool
TXTSupported bool
}
func GetHFSTS6 ¶ added in v2.8.0
func GetHFSTS6(hw hwapi.LowLevelHardwareInterfaces) (*FirmwareStatus6, error)
type IbbSegment ¶
type IbbSegment struct {
Offset uint32 `json:"offset"` //
Size uint32 `json:"size"` //
Flags uint16 `json:"flags"` //
}
IbbSegment exports the struct of IBB Segments
type KeyHash ¶
type KeyHash struct {
Usage uint64 `json:"usage"` //
Hash string `json:"hash"` //
Algorithm cbnt.Algorithm `json:"algorithm"` //
}
KeyHash export for usage as cmd line argument type
type Pcr0Data ¶
type Pcr0Data struct {
ACMPolicyStatus uint64
ACMSVN uint16
ACMSignature []byte
KMSignature []byte
BPMSignature []byte
BPMIBBDigest []byte
}
Pcr0Data represents the data hashed into PCR0 of the TPM by S-ACM
type Pcr7Data ¶
type Pcr7Data struct {
ACMPolicyStatus uint64
ACMSVN uint16
ACMKeyHash [32]byte
BPMKey [32]byte
BPMKeyHash []byte
}
Pcr7Data represents the data hashed into PCR7 of the TPM by S-ACM optionally
type PowerDownRequest ¶
type PowerDownRequest struct {
ID uint64 `default:"0x5F5F504452535F5F"`
Version uint8 `default:"0x10"`
SizeOfData uint16 `default:"0"`
Reserved uint8 `default:"0"`
PDReqMedia []byte
}
PowerDownRequest holds information of the storage location for the on-demand power down variable. Field: PDReqMedia holds an union of 1 CMOSIoAddress or array of 1:3 TPMNvAddress
type TPMNvAddress ¶
type TPMNvAddress struct {
MediaType uint8
NVIndex uint32
BitFieldWidth uint8
BitFieldPosition uint8
IndexOffset uint8
}
TPMNvAddress holds information about the location of on-demand power down requests in TPM NVRAM. The structure is a substructure used in PowerDownRequest structure.
type VersionedData ¶
type VersionedData struct {
BGbpm *bgbootpolicy.Manifest `json:"v1-bootpolicy,omitempty"`
BGkm *bgkey.Manifest `json:"v1-keymanifest,omitempty"`
CBNTbpm *cbntbootpolicy.Manifest `json:"v2-bootpolicy,omitempty"`
CBNTkm *cbntkey.Manifest `json:"v2-keymanifest,omitempty"`
}
Options contains all version bootguard options