pcr

package
v0.0.0-...-6662a7b Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package pcr contains code that handles PCR operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateBankData

func CalculateBankData(pcrNumber int, alg tpm2.TPMAlgID, sectionData map[secureboot.Section]string, rsaKey RSAKey) ([]tpm2internal.BankData, error)

CalculateBankData calculates the PCR bank data for a given set of UKI file sections.

This mimics the process happening happening in the TPM when the UKI is being loaded.

Types

type Digest

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

Digest implements the PCR extension algorithm.

Each time `Extend` is called, the hash of the previous data is prepended to the hash of new data and hashed together.

The initial hash value is all zeroes.

func NewDigest

func NewDigest(alg crypto.Hash) *Digest

NewDigest creates a new Digest with the speified hash algorithm.

func (*Digest) Extend

func (d *Digest) Extend(data []byte)

Extend extends the current hash with the specified data.

func (*Digest) Hash

func (d *Digest) Hash() []byte

Hash returns the current hash value.

type RSAKey

type RSAKey interface {
	crypto.Signer
	PublicRSAKey() *rsa.PublicKey
}

RSAKey is the input for the CalculateBankData function.

type Signature

type Signature struct {
	Digest          string
	SignatureBase64 string
}

Signature returns the hashed signature digest and base64 encoded signature.

func Sign

func Sign(digest []byte, hash crypto.Hash, key crypto.Signer) (*Signature, error)

Sign the digest using specified hash and key.

Jump to

Keyboard shortcuts

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