abi

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Overview

Package abi provides Go representations and conversions for TDX attestation data structures

Index

Constants

View Source
const (
	// QuoteMinSize is the minimum specified size of TDX generated quote
	QuoteMinSize = 0x3FC
	// QuoteVersion currently in support
	QuoteVersion = 4
	// AttestationKeyType supported value
	AttestationKeyType = 2 // (ECDSA-256-with-P-256 curve)
	// TeeTDX  for Attestation
	TeeTDX = 0x00000081
	// TeeTcbSvnSize is the size of TEE_TCB_SVN field in TdQuoteBody
	TeeTcbSvnSize = 0x10
	// MrSeamSize is the size  of MR_SEAM field in TdQuoteBody
	MrSeamSize = 0x30
	// TdAttributesSize is the size  of TD_ATTRIBUTES field in TdQuoteBody
	TdAttributesSize = 0x08
	// XfamSize is the size of XFAM field in TdQuoteBody
	XfamSize = 0x08
	// MrTdSize is the size of MR_TD field in TdQuoteBody
	MrTdSize = 0x30
	// MrConfigIDSize is the size of MR_CONFIG_ID field in TdQuoteBody
	MrConfigIDSize = 0x30
	// MrOwnerSize is the size of MR_OWNER field in TdQuoteBody
	MrOwnerSize = 0x30
	// MrOwnerConfigSize is the size of MR_OWNER_CONFIG field in TdQuoteBody
	MrOwnerConfigSize = 0x30
	// RtmrSize is the size of Runtime extendable measurement register
	RtmrSize = 0x30
	// ReportDataSize is the size of ReportData field in TdQuoteBody
	ReportDataSize = 0x40
	// QeVendorIDSize is the size of QeVendorID field in Header
	QeVendorIDSize = 0x10
)

Variables

View Source
var (
	// ErrQuoteNil error returned when Quote is nil
	ErrQuoteNil = errors.New("quote is nil")

	// ErrQuoteV4Nil error returned when QuoteV4 is nil
	ErrQuoteV4Nil = errors.New("QuoteV4 is nil")

	// ErrQuoteV4AuthDataNil error returned when QuoteV4 Auth Data is nil
	ErrQuoteV4AuthDataNil = errors.New("QuoteV4 authData is nil")

	// ErrCertificationDataNil error returned when Certification Data is nil
	ErrCertificationDataNil = errors.New("certification data is nil")

	// ErrQeReportCertificationDataNil error returned when QE report certification data is nil
	ErrQeReportCertificationDataNil = errors.New("QE Report certification data is nil")

	// ErrQeAuthDataNil error returned when QE Auth Data is nil
	ErrQeAuthDataNil = errors.New("QE AuthData is nil")

	// ErrQeReportNil error returned when QE Report is nil
	ErrQeReportNil = errors.New("QE Report is nil")

	// ErrPckCertChainNil error returned when PCK Certificate Chain is nil
	ErrPckCertChainNil = errors.New("PCK certificate chain is nil")

	// ErrTDQuoteBodyNil error returned when TD quote body is nil
	ErrTDQuoteBodyNil = errors.New("TD quote body is nil")

	// ErrTeeType error returned when TEE type is not TDX
	ErrTeeType = errors.New("TEE type is not TDX")

	// ErrAttestationKeyType error returned when attestation key is not of expected type
	ErrAttestationKeyType = errors.New("attestation key type not supported")

	// ErrHeaderNil error returned when header is nil
	ErrHeaderNil = errors.New("header is nil")
)

Functions

func CheckQuoteV4

func CheckQuoteV4(quote *pb.QuoteV4) error

CheckQuoteV4 validates a quote protobuf by ensuring all parameters meet their required size

func EnclaveReportToAbiBytes

func EnclaveReportToAbiBytes(report *pb.EnclaveReport) ([]byte, error)

EnclaveReportToAbiBytes translates the EnclaveReport back into its little-endian ABI format

func HeaderToAbiBytes

func HeaderToAbiBytes(header *pb.Header) ([]byte, error)

HeaderToAbiBytes translates the Header back into its little-endian ABI format

func QuoteToAbiBytes

func QuoteToAbiBytes(quote any) ([]byte, error)

QuoteToAbiBytes translates the Quote back into its little-endian ABI format. Supported quote formats - QuoteV4.

func QuoteToProto

func QuoteToProto(b []uint8) (any, error)

QuoteToProto creates a Quote from the Intel's attestation quote byte array in Intel's ABI format. Supported quote formats - QuoteV4.

func SignatureToDER

func SignatureToDER(x []byte) ([]byte, error)

SignatureToDER converts the signature to DER format

func TdQuoteBodyToAbiBytes

func TdQuoteBodyToAbiBytes(tdQuoteBody *pb.TDQuoteBody) ([]byte, error)

TdQuoteBodyToAbiBytes translates the TDQuoteBody back into its little-endian ABI format

Types

This section is empty.

Jump to

Keyboard shortcuts

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