linux

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2023 License: LGPL-3.0 Imports: 16 Imported by: 11 modules, 7 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package linux provides an interface for communicating with TPMs using a Linux TPM character device

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrDefaultNotTPM2Device indicates that the default device is not a TPM device.
	ErrDefaultNotTPM2Device = errors.New("the default TPM device is not a TPM2 device")

	// ErrNoPhysicalPresenceInterface indicates that there is no physical presence interface
	// available for a TPM device.
	ErrNoPhysicalPresenceInterface = errors.New("no physical presence interface available")

	// ErrNoResourceManagedDevice indicates that a TPM device has no corresponding resource
	// managed device.
	ErrNoResourceManagedDevice = errors.New("no resource managed TPM device available")

	// ErrNoTPMDevices indicates that there are no TPM devices.
	ErrNoTPMDevices = errors.New("no TPM devices are available")
)

Functions

This section is empty.

Types

type TPMDevice added in v1.1.0

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

TPMDevice represents a Linux TPM character device.

func (*TPMDevice) MajorVersion added in v1.1.0

func (d *TPMDevice) MajorVersion() int

MajorVersion indicates the TPM version, either 1 or 2.

func (*TPMDevice) Open added in v1.1.0

func (d *TPMDevice) Open() (tpm2.TCTI, error)

Open implements tpm2.TPMDevice.Open.

func (*TPMDevice) Path added in v1.1.0

func (d *TPMDevice) Path() string

Path returns the path of the character device.

func (*TPMDevice) ShouldRetry added in v1.1.0

func (d *TPMDevice) ShouldRetry() bool

ShouldRetry implements tpm2.TPMDevice.ShouldRetry.

func (*TPMDevice) String added in v1.1.0

func (d *TPMDevice) String() string

String implements fmt.Stringer.

func (*TPMDevice) SysfsPath added in v1.1.0

func (d *TPMDevice) SysfsPath() string

SysfsPath returns the path of the device in sysfs.

type TPMDeviceRM added in v1.1.0

type TPMDeviceRM struct {
	TPMDevice
	// contains filtered or unexported fields
}

TPMDeviceRM represents a Linux TPM character device that makes use of the kernel resource manager.

func (*TPMDeviceRM) RawDevice added in v1.1.0

func (d *TPMDeviceRM) RawDevice() *TPMDeviceRaw

RawDevice returns the corresponding raw device.

type TPMDeviceRaw added in v1.1.0

type TPMDeviceRaw struct {
	TPMDevice
	// contains filtered or unexported fields
}

TPMDeviceRaw represents a raw Linux TPM character device.

func DefaultTPM2Device added in v1.1.0

func DefaultTPM2Device() (*TPMDeviceRaw, error)

DefaultTPM2Device returns the default TPM2 device. If there are no devices available, then ErrNoTPMDevices is returned. If the default TPM device is not a TPM2 device, then ErrDefaultNotTPM2Device is returned.

func DefaultTPMDevice added in v1.1.0

func DefaultTPMDevice() (*TPMDeviceRaw, error)

DefaultTPMDevice returns the default TPM device. If there are no devices available, then ErrNoTPMDevices is returned.

func ListTPM2Devices added in v1.1.0

func ListTPM2Devices() (out []*TPMDeviceRaw, err error)

ListTPMDevices returns a list of all TPM2 devices.

func ListTPMDevices added in v1.1.0

func ListTPMDevices() (out []*TPMDeviceRaw, err error)

ListTPMDevices returns a list of all TPM devices. Note that this returns all devices, regardless of version.

func (*TPMDeviceRaw) PhysicalPresenceInterface added in v1.1.0

func (d *TPMDeviceRaw) PhysicalPresenceInterface() (*ppi.PPI, error)

PhysicalPresenceInterface returns the physical presence interface associated with this device.

func (*TPMDeviceRaw) ResourceManagedDevice added in v1.1.0

func (d *TPMDeviceRaw) ResourceManagedDevice() (*TPMDeviceRM, error)

ResourceManagedDevice returns the corresponding resource managed device if one is available.

type Tcti added in v1.1.0

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

Tcti represents a connection to a Linux TPM character device.

func OpenDevice deprecated

func OpenDevice(path string) (*Tcti, error)

OpenDevice attempts to open a connection to the Linux TPM character device at the specified path. If successful, it returns a new TctiDevice instance which can be passed to tpm2.NewTPMContext. Failure to open the TPM character device will result in a *os.PathError being returned.

Deprecated: Use TPMDeviceRaw and TPMDeviceRM.

func (*Tcti) Close added in v1.1.0

func (d *Tcti) Close() error

Close implements tpm2.TCTI.Close.

func (*Tcti) MakeSticky added in v1.1.0

func (d *Tcti) MakeSticky(handle tpm2.Handle, sticky bool) error

MakeSticky implements tpm2.TCTI.MakeSticky.

func (*Tcti) Read added in v1.1.0

func (d *Tcti) Read(data []byte) (int, error)

Read implmements tpm2.TCTI.

func (*Tcti) SetTimeout added in v1.1.0

func (d *Tcti) SetTimeout(timeout time.Duration) error

SetTimeout implements tpm2.TCTI.SetTimeout.

func (*Tcti) Write added in v1.1.0

func (d *Tcti) Write(data []byte) (int, error)

Write implmements tpm2.TCTI.

type TctiDevice deprecated

type TctiDevice = Tcti

TctiDevice represents a connection to a Linux TPM character device.

Deprecated: Use Tcti

Jump to

Keyboard shortcuts

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