common

package
v0.0.0-...-a7f31ed Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KB = 1024
	MB = 1024 * KB
)

Variables

This section is empty.

Functions

func CompareStringSliceMap

func CompareStringSliceMap(s []string, m map[string]bool) error

func ComputeConfigElementSha

func ComputeConfigElementSha(h hash.Hash, msg interface{})

func CreateBaseConfig

func CreateBaseConfig(u uuid.UUID) []byte

func CreateBaseDeviceOptions

func CreateBaseDeviceOptions(_ uuid.UUID) []byte

func CreateBaseGlobalOptions

func CreateBaseGlobalOptions() []byte

func EqualStringSlice

func EqualStringSlice(a, b []string) bool

func EqualUUIDSlice

func EqualUUIDSlice(a, b []*uuid.UUID) bool

func GetOnboardCertName

func GetOnboardCertName(cn string) string

func MismatchedErrors

func MismatchedErrors(e1, e2 error) bool

func RandomString

func RandomString(len int) string

Types

type ApiRequest

type ApiRequest struct {
	Timestamp time.Time `json:"timestamp"`
	UUID      uuid.UUID `json:"uuid,omitempty"`
	ClientIP  string    `json:"client-ip"`
	Forwarded string    `json:"forwarded,omitempty"`
	Method    string    `json:"method"`
	URL       string    `json:"url"`
}

ApiRequest stores information about requests from EVE

type BigData

type BigData interface {
	Get(index int) ([]byte, error)
	Reader() (ChunkReader, error)
	Write(b []byte) (int, error)
}

type ChunkReader

type ChunkReader interface {
	// Next will return reader for the next chunk and the size of the chunk
	// in case of no next chunk available, will return io.EOF
	Next() (io.Reader, int64, error)
}

ChunkReader provides ability to request reader for the data for every available chunk device managers stores the data in separate chunks (e.g. files/slices/messages) we need readers for every chunk to be separated to be able to process data before present

type DeviceOptions

type DeviceOptions struct {
	Nonce               string                     `json:"nonce"`
	IntegrityToken      string                     `json:"integrityToken"`
	ReceivedPCRTemplate *PCRTemplate               `json:"receivedPCRTemplate"`
	Attested            bool                       `json:"attested"`
	EventLog            []*attest.TpmEventLogEntry `json:"eventLog,omitempty"`
}

DeviceOptions stores received nonce, PCRTemplate structure received from device and IntegrityToken generated by controller

type DeviceStorage

type DeviceStorage struct {
	Cert        *x509.Certificate
	Info        BigData
	Metrics     BigData
	Logs        BigData
	Requests    BigData
	FlowMessage BigData
	Certs       BigData
	AppLogs     map[uuid.UUID]BigData
	CurrentLog  int
	Config      []byte
	AttestCerts []byte
	StorageKeys []byte
	Serial      string
	Onboard     *x509.Certificate
	Options     []byte // stores json representation of DeviceOptions
}

func (*DeviceStorage) AddAppLog

func (d *DeviceStorage) AddAppLog(instanceID uuid.UUID, b []byte) error

func (*DeviceStorage) AddFlowRecord

func (d *DeviceStorage) AddFlowRecord(b []byte) error

func (*DeviceStorage) AddInfo

func (d *DeviceStorage) AddInfo(b []byte) error

func (*DeviceStorage) AddLogs

func (d *DeviceStorage) AddLogs(b []byte) error

func (*DeviceStorage) AddMetrics

func (d *DeviceStorage) AddMetrics(b []byte) error

func (*DeviceStorage) AddRequest

func (d *DeviceStorage) AddRequest(b []byte) error

type FullCertsEntry

type FullCertsEntry struct {
	*logs.LogEntry
	Image      string `json:"image,omitempty"`      // SW image the log got emitted from
	EveVersion string `json:"eveVersion,omitempty"` // EVE software version
}

type FullLogEntry

type FullLogEntry struct {
	*logs.LogEntry
	Image      string `json:"image,omitempty"`      // SW image the log got emitted from
	EveVersion string `json:"eveVersion,omitempty"` // EVE software version
}

func (FullLogEntry) Json

func (f FullLogEntry) Json() ([]byte, error)

Bytes convenience to convert to json bytes

type GlobalOptions

type GlobalOptions struct {
	EnforceTemplateAttestation bool           `json:"enforceTemplateAttestation"`
	PCRTemplates               []*PCRTemplate `json:"PCRTemplates"`
}

GlobalOptions configure controller behaviour for attestation requests

type InvalidCertError

type InvalidCertError struct {
	Err string
}

InvalidCertError error representing that a certificate is not valid

func (*InvalidCertError) Error

func (n *InvalidCertError) Error() string

type InvalidSerialError

type InvalidSerialError struct {
	Err string
}

InvalidSerialError error representing that a serial is not valid

func (*InvalidSerialError) Error

func (n *InvalidSerialError) Error() string

type MaxSizes

type MaxSizes struct {
	MaxLogSize         int
	MaxInfoSize        int
	MaxMetricSize      int
	MaxRequestsSize    int
	MaxAppLogsSize     int
	MaxFlowMessageSize int
}

MaxSizes defines maximum sizes of objects storage

type NotFoundError

type NotFoundError struct {
	Err string
}

NotFoundError error representing that an item was not found

func (*NotFoundError) Error

func (n *NotFoundError) Error() string

type PCRTemplate

type PCRTemplate struct {
	EveVersion      string      `json:"eveVersion"`
	FirmwareVersion string      `json:"firmwareVersion"`
	PCRValues       []*PCRValue `json:"PCRValues"`
}

PCRTemplate stores template with EVE version, Firmware version, GPSInfo and set of PCRValues

type PCRValue

type PCRValue struct {
	Index uint32 `json:"index"`
	Value string `json:"value"` // may contain '*' to allow any value in template
}

PCRValue stores one single PCR value from TPM, from a particular hash bank

type UsedSerialError

type UsedSerialError struct {
	Err string
}

UsedSerialError error representing that a serial was used already

func (*UsedSerialError) Error

func (n *UsedSerialError) Error() string

type Zcerts

type Zcerts struct {
	Certs []*certs.ZCert `json:"certs,omitempty"` // EVE device certs
}

Jump to

Keyboard shortcuts

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