mssim

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: LGPL-3.0 Imports: 10 Imported by: 3

Documentation

Overview

Package mssim provides an interface for communicating with a TPM simulator

Index

Constants

View Source
const (
	DefaultPort uint = 2321
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Device added in v1.1.0

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

Device describes a TPM simulator device.

var (
	DefaultDevice *Device = &Device{port: DefaultPort}
)

func NewDevice added in v1.1.0

func NewDevice(host string, port uint) *Device

NewDevice returns a new device structure for the specified host and port.

func NewLocalDevice added in v1.1.0

func NewLocalDevice(port uint) *Device

NewLocalDevice returns a new device structure for the specified port on the local machine.

func (*Device) Host added in v1.1.0

func (d *Device) Host() string

Host is the host that the TPM simulator is running on.

func (*Device) Open added in v1.1.0

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

Open implements tpm2.TPMDevice.Open.

The returned transport will automatically retry commands that fail with TPM_RC_RETRY or TPM_RC_YIELDED. It will also retry commands that fail with TPM_RC_TESTING if the command wasn't TPM_CC_SELF_TEST.

func (*Device) Port added in v1.1.0

func (d *Device) Port() uint

Port is the port number of the TPM simulator's command channel. Its platform channel runs on the next port number.

func (*Device) String added in v1.1.0

func (d *Device) String() string

String implements fmt.Stringer.

type PlatformCommandError deprecated

type PlatformCommandError struct {
	Code uint32
	// contains filtered or unexported fields
}

PlatformCommandError corresponds to an error code in response to a platform command executed on a TPM simulator.

Deprecated: This never returned.

func (*PlatformCommandError) Error

func (e *PlatformCommandError) Error() string

type Tcti deprecated

type Tcti = Transport

Tcti represents a connection to a TPM simulator that implements the Microsoft TPM2 simulator interface.

Deprecated: Use Transport.

type Transport added in v1.4.0

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

Transport represents a connection to a TPM simulator that implements the Microsoft TPM2 simulator interface.

func OpenConnection deprecated

func OpenConnection(host string, port uint) (*Transport, error)

OpenConnection attempts to open a connection to a TPM simulator on the specified host and port. The port argument corresponds to the TPM command server. The simulator will also provide a platform server on port+1. If host is an empty string, it defaults to "localhost".

If successful, it returns a new Transport instance which can be passed to tpm2.NewTPMContext.

Deprecated: Use NewDevice, NewLocalDevice or DefaultDevice.

func (*Transport) Close added in v1.4.0

func (t *Transport) Close() (err error)

Close implements tpm2.Transport.Close.

func (*Transport) Read added in v1.4.0

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

Read implements tpm2.Transport.Read.

func (*Transport) Reset added in v1.4.0

func (t *Transport) Reset() error

Reset submits the reset command on the platform connection, which initiates a reset of the TPM simulator and results in the execution of _TPM_Init().

func (*Transport) Stop added in v1.4.0

func (t *Transport) Stop() (out error)

Stop submits a stop command on both the TPM command and platform channels, which initiates a shutdown of the TPM simulator.

func (*Transport) Write added in v1.4.0

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

Write implements tpm2.Transport.Write.

Jump to

Keyboard shortcuts

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