ovmf

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SNPSECMEM SectionType = iota + 1
	SNPSecrets
	CPUID
	SNPKernelHashes SectionType = 0x10

	FOUR_GB                 = 0x100000000
	OVMF_TABLE_FOOTER_GUID  = "96b582de-1fb2-45f7-baea-a366c55a082d"
	SEV_HASH_TABLE_RV_GUID  = "7255371f-3a3b-4b04-927b-1da6efa8d454"
	SEV_ES_RESET_BLOCK_GUID = "00f771de-1a7e-4fcb-890e-68c77e2fb44e"
	OVMF_SEV_META_DATA_GUID = "dc886566-984a-4798-a75e-5585a7bf67cc"
)

Variables

This section is empty.

Functions

func LittleEndianBytes

func LittleEndianBytes(bytes [16]byte) [16]byte

Types

type FooterTableEntry

type FooterTableEntry struct {
	Size uint16
	Guid [16]byte
}

func NewFooterTableEntry

func NewFooterTableEntry(data []byte) (*FooterTableEntry, error)

type MetadataHeader

type MetadataHeader struct {
	Signature [4]uint8
	// Size describes how big the metadata section is.
	Size    uint32
	Version uint32
	// NumItems describes how many MetadataSection items there are.
	NumItems uint32
}

func NewMetadataHeader

func NewMetadataHeader(data []byte) (*MetadataHeader, error)

func (*MetadataHeader) Verify

func (h *MetadataHeader) Verify() error

type MetadataSection

type MetadataSection struct {
	// GPA is the Guest Physical Adress of the page. The GPA becomes part of the launch digest.
	GPA  uint32
	Size uint32
	// SectionTypeInt is the Section Type of the described page. The type becomes part of the launch digest.
	SectionTypeInt uint32
}

func NewMetadataSectionDesc

func NewMetadataSectionDesc(data []byte) (*MetadataSection, error)

func (*MetadataSection) MarshalJSON

func (m *MetadataSection) MarshalJSON() ([]byte, error)

MarshalJSON is a custom marshaller for MetadataSection. It converts the GPA and Size to hex strings.

func (*MetadataSection) SectionType

func (o *MetadataSection) SectionType() (SectionType, error)

func (*MetadataSection) UnmarshalJSON

func (m *MetadataSection) UnmarshalJSON(data []byte) error

UnmarshalJSON is a custom unmarshaller for MetadataSection. It converts the GPA and Size from hex strings.

type MetadataWrapper

type MetadataWrapper struct {
	MetadataItems []MetadataSection
	ResetEIP      uint32
	OVMFHash      []byte
}

MetadataWrapper replaces the OVMF binary when using an OVMF hash. It contains the metadata items and the reset EIP that have been parsed from the binary before.

func NewMetadataWrapper

func NewMetadataWrapper(ovmf OVMF, ovmfHash []byte) (*MetadataWrapper, error)

func (*MetadataWrapper) MarshalJSON

func (m *MetadataWrapper) MarshalJSON() ([]byte, error)

MarshalJSON is a custom marshaller for MetadataSection. It converts the GPA and Size to hex strings.

func (*MetadataWrapper) UnmarshalJSON

func (m *MetadataWrapper) UnmarshalJSON(data []byte) error

UnmarshalJSON is a custom unmarshaller for MetadataSection. It converts the GPA and Size from hex strings.

type OVMF

type OVMF struct {
	// contains filtered or unexported fields
}

func New

func New(filename string) (OVMF, error)

func NewFromAPIObject

func NewFromAPIObject(apiObject MetadataWrapper) (OVMF, error)

NewFromAPIObject creates an OVMF object from an APIObject. This OVMF object can only be used in conjunction with a OVMF Hash, as the data property is not

func (*OVMF) Data

func (o *OVMF) Data() []byte

func (*OVMF) GPA

func (o *OVMF) GPA() int

func (*OVMF) MetadataItems

func (o *OVMF) MetadataItems() []MetadataSection

func (*OVMF) SevESResetEIP

func (o *OVMF) SevESResetEIP() (uint32, error)

func (*OVMF) TableItem

func (o *OVMF) TableItem(guid string) ([]byte, error)

type SectionType

type SectionType int

Jump to

Keyboard shortcuts

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