register

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package register contains measurement register-specific implementations.

Index

Constants

This section is empty.

Variables

View Source
var (
	HashSHA1   = HashAlg(tpm2.AlgSHA1)
	HashSHA256 = HashAlg(tpm2.AlgSHA256)
	HashSHA384 = HashAlg(tpm2.AlgSHA384)
)

Valid hash algorithms.

Functions

This section is empty.

Types

type HashAlg

type HashAlg uint8

HashAlg identifies a hashing Algorithm. Included for backcompat with the go-attestation API.

func (HashAlg) CryptoHash

func (a HashAlg) CryptoHash() crypto.Hash

CryptoHash turns the hash algo into a crypto.Hash

func (HashAlg) GoTPMAlg

func (a HashAlg) GoTPMAlg() tpm2.Algorithm

GoTPMAlg returns the go-tpm definition of this crypto.Hash, based on the TCG Algorithm Registry.

func (HashAlg) String

func (a HashAlg) String() string

String returns a human-friendly representation of the hash algorithm.

type MR

type MR interface {
	Idx() int
	Dgst() []byte
	DgstAlg() crypto.Hash
}

MR provides a generic interface for measurement registers to implement.

type MRBank

type MRBank interface {
	CryptoHash() (crypto.Hash, error)
	MRs() []MR
}

MRBank is a generic interface for a collection of measurement registers associated with the same hash algorithm.

type PCR

type PCR struct {
	Index     int
	Digest    []byte
	DigestAlg crypto.Hash
	// contains filtered or unexported fields
}

PCR encapsulates the value of a PCR at a point in time.

func (PCR) Dgst

func (p PCR) Dgst() []byte

Dgst gives the PCR digest.

func (PCR) DgstAlg

func (p PCR) DgstAlg() crypto.Hash

DgstAlg gives the PCR digest algorithm as a crypto.Hash.

func (PCR) Idx

func (p PCR) Idx() int

Idx gives the PCR index.

func (*PCR) QuoteVerified

func (p *PCR) QuoteVerified() bool

QuoteVerified returns true if the value of this PCR was previously verified against a Quote, in a call to AKPublic.Verify or AKPublic.VerifyAll. NOT for use in go-eventlog. Included for backcompat with the go-attestation API.

func (*PCR) SetQuoteVerified

func (p *PCR) SetQuoteVerified()

SetQuoteVerified sets that the quote verified is true. NOT for use in go-eventlog. Included for backcompat with the go-attestation API.

type PCRBank

type PCRBank struct {
	TCGHashAlgo pb.HashAlgo
	PCRs        []PCR
}

PCRBank is a bank of PCRs that all correspond to the same hash algorithm.

func (PCRBank) CryptoHash

func (b PCRBank) CryptoHash() (crypto.Hash, error)

CryptoHash returns the crypto.Hash algorithm related to the PCR bank.

func (PCRBank) MRs

func (b PCRBank) MRs() []MR

MRs returns a slice of MR from the PCR implementation.

type RTMR

type RTMR struct {
	// The RTMR Index, not the CC MR Index. e.g., for RTMR[1], put 1, not 2.
	Index  int
	Digest []byte
}

RTMR encapsulates the value of a TDX runtime measurement register at a point in time. The given RTMR must always have a SHA-384 digest.

func (RTMR) Dgst

func (r RTMR) Dgst() []byte

Dgst gives the RTMR digest.

func (RTMR) DgstAlg

func (r RTMR) DgstAlg() crypto.Hash

DgstAlg gives the RTMR digest algorithm as a crypto.Hash.

func (RTMR) Idx

func (r RTMR) Idx() int

Idx gives the RTMR index. Confusingly, MRTD uses CC Measurement Register Index 0, so RTMR0 uses 1. RTMR1 uses 2, and so on. https://cdrdv2-public.intel.com/726792/TDX%20Guest-Hypervisor%20Communication%20Interface_1.5_348552_004%20-%2020230317.pdf https://github.com/cc-api/cc-trusted-vmsdk/issues/50

type RTMRBank

type RTMRBank struct {
	RTMRs []RTMR
}

RTMRBank is a bank of RTMRs that all correspond to the SHA-384 algorithm.

func (*RTMRBank) CryptoHash

func (b *RTMRBank) CryptoHash() (crypto.Hash, error)

CryptoHash returns the crypto.Hash algorithm related to the RTMR bank.

func (RTMRBank) MRs

func (b RTMRBank) MRs() []MR

MRs returns a slice of MR from the RTMR implementation.

Jump to

Keyboard shortcuts

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