linux

package
v1.7.4 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 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. The returned transport cannot be used from multiple goroutines simultaneously.

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. It is safe to use this from multiple goroutines simultaneously.

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. It is safe to use this from multiple goroutines simultaneously.

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. It is safe to call this function from multiple goroutines simultaneously.

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. It is safe to call this function from multiple goroutines simultaneously.

func ListTPM2Devices added in v1.1.0

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

ListTPMDevices returns a list of all TPM2 devices. It is safe to call this function from multiple goroutines simultaneously.

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. It is safe to call this function from multiple goroutines simultaneously.

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. It is not intended to be used from multiple goroutines simultaneously.

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