Documentation
¶
Overview ¶
Package cel contains some basic operations of Canonical Eventlog. Based on Canonical EventLog Spec (Draft) Version: TCG_IWG_CEL_v1_r0p37.
Index ¶
Constants ¶
const ( // FakeEventType indicates the CELR event is a Fake content type. FakeEventType uint8 = 222 // FakeEventMR is the PCR which should be used for FakeEventType events. FakeEventMR = 23 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CEL ¶
type CEL interface {
// Records returns all the records in the CEL.
Records() []Record
// AppendEvent appends a new record to the CEL.
AppendEvent(Content, []crypto.Hash, int, MRExtender) error
// EncodeCEL returns the TLV encoding of the CEL.
EncodeCEL(*bytes.Buffer) error
// Replay verifies the contents of the event log with the given MR bank.
Replay(register.MRBank) error
// MRType returns the measurement register type used in the CEL.
MRType() MRType
}
CEL represents a Canonical Event Log, which contains a list of Records.
func DecodeToCEL ¶
DecodeToCEL will read the buf for CEL, will return err if the buffer is not complete.
func NewConfComputeMR ¶
func NewConfComputeMR() CEL
NewConfComputeMR returns a CEL with events measured in confidential computing measurement registers.
type FakeTlv ¶
FakeTlv is a specific TLV created for testing.
func (FakeTlv) GenerateDigest ¶
GenerateDigest generates the digest for the given fake TLV. The whole TLV struct will be marshaled to bytes and feed into the hash algo.
type MRExtender ¶
MRExtender extends an implementation-specific measurement register at the specified bank and index with the supplied digest.
type MRType ¶
type MRType TopLevelEventType
MRType represents the type of measurement register used in the CEL for field CEL_PCR_NVindex TLV.
type Record ¶
type Record struct {
RecNum uint64
// Generic Measurement Register index number, register type
// is determined by IndexType
Index uint8
IndexType uint8
Digests map[crypto.Hash][]byte
Content TLV
}
Record represents a Canonical Eventlog Record.
type TLV ¶
TLV definition according to CEL spec TCG_IWG_CEL_v1_r0p37, page 16. Length is implicitly defined by len(Value), using uint32 big-endian when encoding.
func (TLV) MarshalBinary ¶
MarshalBinary marshals a TLV to a byte slice.
func (TLV) ParseToFakeTlv ¶
ParseToFakeTlv constructs a FakeTlv from a TLV. It will check for the correct fake event type, and unmarshal the nested event.
func (*TLV) UnmarshalBinary ¶
UnmarshalBinary unmarshal a byte slice to a TLV.
type TopLevelEventType ¶
type TopLevelEventType uint8
TopLevelEventType represents the CEL spec's known CELR data types for TPMS_CEL_EVENT.