measure

package
v2.0.0-...-338d27a Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Authentihash

func Authentihash(r io.Reader, h crypto.Hash) ([]byte, error)

Authentihash returns the PE/COFF hash / Authentihash of a file.

func DescribeBootStages

func DescribeBootStages(w io.Writer, bootStages []EFIBootStage) error

DescribeBootStages prints a description of the EFIBootStages to a writer.

func DescribeLinuxLoad2

func DescribeLinuxLoad2(w io.Writer, cmdline []byte, initrdDigest [32]byte) error

DescribeLinuxLoad2 describes the expected measurements for the Linux LOAD_FILE2 protocol.

func DescribeUKISections

func DescribeUKISections(w io.Writer, ukiSections []pesection.PESection) error

DescribeUKISections describes the expected measurements for the UKI sections.

func PredictPCR11

func PredictPCR11(simulator *Simulator, ukiSections []pesection.PESection) error

PredictPCR11 predicts the PCR11 value based on the components of unified kernel images.

func PredictPCR4

func PredictPCR4(simulator *Simulator, efiBootStages []EFIBootStage) error

PredictPCR4 predicts the PCR4 value based on the EFIBootStages.

func PredictPCR9

func PredictPCR9(simulator *Simulator, cmdline []byte, initrdDigest [32]byte) error

PredictPCR9 predicts the PCR9 value based on the kernel command line and initrd.

Types

type Digest256

type Digest256 [32]byte

Digest256 is a 256-bit digest value (sha256).

func (Digest256) MarshalJSON

func (d Digest256) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

type EFIBootStage

type EFIBootStage struct {
	Name   string
	Digest [32]byte
}

EFIBootStage is a stage (bootloader) of the EFI boot process.

type Event

type Event struct {
	PCRIndex    uint32
	Digest      Digest256
	Data        []byte `json:",omitempty"`
	Description string
}

Event is a pcr extend event.

type EventLog

type EventLog struct {
	Events []Event
}

EventLog is a list of events.

type PCR256

type PCR256 [32]byte

PCR256 is a 256-bit PCR value.

func EVEFIActionPCR256

func EVEFIActionPCR256() PCR256

EVEFIActionPCR256 returns the expected PCR256 value for EV_EFI_ACTION.

func EVSeparatorPCR256

func EVSeparatorPCR256() PCR256

EVSeparatorPCR256 returns the expected PCR256 value for EV_SEPARATOR.

func ZeroPCR256

func ZeroPCR256() PCR256

ZeroPCR256 returns a zeroed PCR256 value.

func (PCR256) MarshalJSON

func (p PCR256) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

type PCR256Bank

type PCR256Bank map[uint32]PCR256

PCR256Bank is a map of PCR index to PCR256 value.

type Simulator

type Simulator struct {
	Bank     PCR256Bank `json:"measurements"`
	EventLog EventLog
}

Simulator is a TPM PCR simulator.

func NewDefaultSimulator

func NewDefaultSimulator() *Simulator

NewDefaultSimulator returns a new Simulator with default PCR values.

func (*Simulator) ExtendPCR

func (s *Simulator) ExtendPCR(index uint32, digest [32]byte, data []byte, description string) error

ExtendPCR extends the PCR at index with the digest and data.

Jump to

Keyboard shortcuts

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