tss

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: BSD-3-Clause Imports: 13 Imported by: 32

Documentation

Overview

Package tss provides TPM 1.2/2.0 core functionality and abstraction layer for high-level functions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PCR

type PCR struct {
	Index     int
	Digest    []byte
	DigestAlg crypto.Hash
}

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

type TCGVendorID

type TCGVendorID uint32

TCGVendorID TPM manufacturer id

func (TCGVendorID) String

func (id TCGVendorID) String() string

type TPM

type TPM struct {
	Version TPMVersion
	Interf  TPMInterface
	// TODO: Remove SysPath from this structure: it is a
	// leaky abstraction and other u-root code appears not
	// to be using it.
	SysPath string
	RWC     io.ReadWriteCloser
}

TPM interfaces with a TPM device on the system.

func NewTPM

func NewTPM() (*TPM, error)

NewTPM initializes access to the TPM based on the config provided.

func (*TPM) ClearOwnership

func (t *TPM) ClearOwnership(ownerAuth string) error

ClearOwnership tries to clear all credentials on a TPM

func (*TPM) Close

func (t *TPM) Close() error

Close closes the TPM socket and wipe locked buffers

func (*TPM) Extend

func (t *TPM) Extend(hash []byte, pcrIndex uint32) error

Extend extends a hash into a pcrIndex with a specific hash algorithm

func (*TPM) GetVersion

func (t *TPM) GetVersion() TPMVersion

GetVersion returns the TPM version

func (*TPM) Info

func (t *TPM) Info() (*TPMInfo, error)

Info returns information about the TPM.

func (*TPM) Measure

func (t *TPM) Measure(data []byte, pcrIndex uint32) error

Measure measures data with a specific hash algorithm and extends it into the pcrIndex

func (*TPM) MeasurementLog

func (t *TPM) MeasurementLog() ([]byte, error)

MeasurementLog reads the TCPA eventlog in binary format from the Linux kernel

func (*TPM) NVReadValue

func (t *TPM) NVReadValue(index uint32, ownerPassword string, size, offhandle uint32) ([]byte, error)

NVReadValue reads a value from a given NVRAM index Type and byte order for TPM1.2 interface: (offset uint32) Type and byte oder for TPM2.0 interface: (authhandle uint32)

func (*TPM) ReadPCR

func (t *TPM) ReadPCR(pcrIndex uint32) ([]byte, error)

ReadPCR reads a single PCR value by defining the pcrIndex

func (*TPM) ReadPCRs

func (t *TPM) ReadPCRs() ([]PCR, error)

ReadPCRs reads all PCRs into the PCR structure

func (*TPM) ReadPubEK

func (t *TPM) ReadPubEK(ownerPW string) ([]byte, error)

ReadPubEK reads the Endorsement public key

func (*TPM) ResetLockValue

func (t *TPM) ResetLockValue(ownerPW string) (bool, error)

ResetLockValue resets the password counter to zero

func (*TPM) TakeOwnership

func (t *TPM) TakeOwnership(newAuth, newSRKAuth string) error

TakeOwnership owns the TPM with an owner/srk password

type TPMInfo

type TPMInfo struct {
	Version      TPMVersion
	Interface    TPMInterface
	VendorInfo   string
	Manufacturer TCGVendorID

	// FirmwareVersionMajor and FirmwareVersionMinor describe
	// the firmware version of the TPM, but are only available
	// for TPM 2.0 devices.
	FirmwareVersionMajor int
	FirmwareVersionMinor int
}

TPMInfo contains information about the version & interface of an open TPM.

type TPMInterface

type TPMInterface uint8

TPMInterface indicates how the client communicates with the TPM.

const (
	TPMInterfaceDirect TPMInterface = iota
	TPMInterfaceKernelManaged
	TPMInterfaceDaemonManaged
)

TPM interfaces

type TPMVersion

type TPMVersion uint8

TPMVersion is used to configure a preference in which TPM to use, if multiple are available.

const (
	TPMVersionAgnostic TPMVersion = iota
	TPMVersion12
	TPMVersion20
)

TPM versions

Jump to

Keyboard shortcuts

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