mssim

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: LGPL-3.0 Imports: 8 Imported by: 4

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.TCTI, error)

Open implements tpm2.TPMDevice.Open.

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) ShouldRetry added in v1.1.0

func (d *Device) ShouldRetry() bool

ShouldRetry implements tpm2.TPMDevice.ShouldRetry.

func (*Device) String added in v1.1.0

func (d *Device) String() string

String implements fmt.Stringer.

type PlatformCommandError

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.

func (*PlatformCommandError) Error

func (e *PlatformCommandError) Error() string

type Tcti

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

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

func OpenConnection deprecated

func OpenConnection(host string, port uint) (*Tcti, 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 Tcti instance which can be passed to tpm2.NewTPMContext.

Deprecated: Use NewDevice, NewLocalDevice or DefaultDevice.

func (*Tcti) Close

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

Close implements tpm2.TCTI.Close.

func (*Tcti) MakeSticky

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

MakeSticky implements tpm2.TCTI.MakeSticky.

func (*Tcti) Read

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

Read implmements tpm2.TCTI.Read.

func (*Tcti) Reset

func (t *Tcti) 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 (*Tcti) SetLocality

func (t *Tcti) SetLocality(locality uint8) error

SetLocality sets the locality to be used for the next command.

func (*Tcti) SetTimeout added in v1.1.0

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

func (*Tcti) Stop

func (t *Tcti) 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 (*Tcti) Write

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

Write implmements tpm2.TCTI.Write.

Jump to

Keyboard shortcuts

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