linux

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: LGPL-3.0 Imports: 17 Imported by: 6

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 Device added in v1.4.0

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

Device represents a Linux TPM character device.

func (*Device) MajorVersion added in v1.4.0

func (d *Device) MajorVersion() TPMMajorVersion

MajorVersion indicates the TPM version.

func (*Device) Open added in v1.4.0

func (d *Device) Open() (tpm2.Transport, error)

Open implements tpm2.TPMDevice.Open.

func (*Device) PartialReadSupported added in v1.4.0

func (d *Device) PartialReadSupported() bool

PartialReadSupported indicates whether the TPM character device supports partial reads.

func (*Device) Path added in v1.4.0

func (d *Device) Path() string

Path returns the path of the character device.

func (*Device) String added in v1.4.0

func (d *Device) String() string

String implements fmt.Stringer.

func (*Device) SysfsPath added in v1.4.0

func (d *Device) SysfsPath() string

SysfsPath returns the path of the device in sysfs.

type RMDevice added in v1.4.0

type RMDevice struct {
	Device
	// contains filtered or unexported fields
}

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

func (*RMDevice) RawDevice added in v1.4.0

func (d *RMDevice) RawDevice() *RawDevice

RawDevice returns the corresponding raw device.

type RawDevice added in v1.4.0

type RawDevice struct {
	Device
	// contains filtered or unexported fields
}

RawDevice represents a raw Linux TPM character device.

func DefaultTPM2Device added in v1.1.0

func DefaultTPM2Device() (*RawDevice, 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() (*RawDevice, 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 []*RawDevice, err error)

ListTPMDevices returns a list of all TPM2 devices.

func ListTPMDevices added in v1.1.0

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

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

func (*RawDevice) PhysicalPresenceInterface added in v1.4.0

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

PhysicalPresenceInterface returns the physical presence interface associated with this device.

func (*RawDevice) ResourceManagedDevice added in v1.4.0

func (d *RawDevice) ResourceManagedDevice() (*RMDevice, error)

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

type TPMDevice deprecated added in v1.1.0

type TPMDevice = Device

TPMDevice represents a Linux TPM character device.

Deprecated: use Device.

type TPMDeviceRM deprecated added in v1.1.0

type TPMDeviceRM = RMDevice

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

Deprecated: use RMDevice.

type TPMDeviceRaw deprecated added in v1.1.0

type TPMDeviceRaw = RawDevice

TPMDeviceRaw represents a raw Linux TPM character device.

Deprecated: use RawDevice.

type TPMMajorVersion added in v1.2.0

type TPMMajorVersion int

TPMMajorVersion describes the major version of a TPM device.

const (
	TPMVersion1 TPMMajorVersion = 1
	TPMVersion2 TPMMajorVersion = 2
)

type Tcti deprecated added in v1.1.0

type Tcti = Transport

Tcti represents a connection to a Linux TPM character device.

Deprecated: Use Transport.

type TctiDevice deprecated

type TctiDevice = Transport

TctiDevice represents a connection to a Linux TPM character device.

Deprecated: Use Transport

type Transport added in v1.4.0

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

Transport represents a connection to a Linux TPM character device.

func OpenDevice deprecated

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

OpenDevice attempts to open a connection to the Linux TPM character device at the specified path. If successful, it returns a new Transport 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 RawDevice and RMDevice.

func (*Transport) Close added in v1.4.0

func (d *Transport) Close() error

Close implements tpm2.Transport.Close.

func (*Transport) Read added in v1.4.0

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

Read implmements tpm2.Transport.

func (*Transport) Write added in v1.4.0

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

Write implmements tpm2.Transport.

Jump to

Keyboard shortcuts

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