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 ( // CosEventType indicates the CELR event is a COS content // TODO: the value needs to be reserved in the CEL spec CosEventType uint8 = 80 // CosEventPCR is the PCR which should be used for CosEventType events. CosEventPCR = 13 )
Variables ¶
This section is empty.
Functions ¶
func FormatEnvVar ¶
FormatEnvVar takes in an environment variable name and its value, run some checks. Concats the name and value by '=' and returns it if valid; returns an error if the name or value is invalid.
func ParseEnvVar ¶
ParseEnvVar takes in environment variable as a string (foo=bar), parses it and returns its name and value, or an error if it fails the validation check.
Types ¶
type CEL ¶
type CEL struct {
Records []Record
}
CEL represents a Canonical Eventlog, 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 (*CEL) AppendEvent ¶
func (c *CEL) AppendEvent(tpm io.ReadWriteCloser, pcr int, hashAlgos []crypto.Hash, event Content) error
AppendEvent appends a new record to the CEL.
type CosTlv ¶
CosTlv is a specific event type created for the COS (Google Container-Optimized OS), used as a CEL content.
func (CosTlv) GenerateDigest ¶
GenerateDigest generates the digest for the given COS TLV. The whole TLV struct will be marshaled to bytes and feed into the hash algo.
type Record ¶
Record represents a Canonical Eventlog Record.
func DecodeToCELR ¶
DecodeToCELR will read the buf for the next CELR, will return err if failed to unmarshal a correct CELR TLV from the buffer.
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 UnmarshalFirstTLV ¶
UnmarshalFirstTLV reads and parse the first TLV from the bytes buffer. The function will return io.EOF if the buf ends unexpectedly or cannot fill the TLV.
func (TLV) MarshalBinary ¶
MarshalBinary marshals a TLV to a byte slice.
func (TLV) ParseToCosTlv ¶
ParseToCosTlv constructs a CosTlv from a TLV. It will check for the correct COS event type, and unmarshal the nested event.
func (*TLV) UnmarshalBinary ¶
UnmarshalBinary unmarshal a byte slice to a TLV.