tbs

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Rendered for windows/amd64

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidContext    = errors.New("the specified context handle does not refer to a valid context")
	ErrUnavailableLog    = errors.New("event log is not available")
	ErrTpmDeviceNotFound = errors.New("a compatible TPM Security Device cannot be found on this computer")
)

Functions

func CancelCommands

func CancelCommands(ctx uintptr) error

CancelCommands cancels all outstanding commands for the specified context.

func CloseContext

func CloseContext(ctx uintptr) error

CloseContext closes a context handle, which releases resources associated with the context in TBS and closes the binding handle used to communicate with TBS.

func CreateContext

func CreateContext(version uint32, attr Attribute) (uintptr, error)

CreateContext creates a context handle that can be used to pass commands to TBS.

func CreateWindowsKey

func CreateWindowsKey(kh uint32) error

func GetDeviceId

func GetDeviceId() ([]byte, error)

func GetOwnerAuth

func GetOwnerAuth(ctx uintptr, oaType OwnerAuthType) ([]byte, error)

GetOwnerAuth retrieves the owner authorization of the TPM if the information is available in the local registry.

Only TPM2.0 or later is supported. Root privileges are required for execution.

func GetTCGLog

func GetTCGLog() ([]byte, error)

GetTCGLog Retrieves the most recent Windows Boot Configuration Log (WBCL), also referred to as a TCG log.

func GetTCGLogEx

func GetTCGLogEx(logType LogType) ([]byte, error)

GetTCGLogEx gets the Windows Boot Configuration Log (WBCL), also referred to as the TCG log, of the specified type.

func PhysicalPresenceCommand

func PhysicalPresenceCommand(ctx uintptr, command, out []byte) (uint32, error)

PhysicalPresenceCommand passes a physical presence ACPI command through TBS to the driver.

func RevokeAttestation

func RevokeAttestation() error

RevokeAttestation invalidates the PCRs if the ELAM driver detects a policy-violation (a rootkit, for example).

func SubmitCommand

func SubmitCommand(ctx uintptr, priority Priority, command, out []byte) (uint32, error)

SubmitCommand submits a Trusted Platform Module (TPM) command to TPM Base Services (TBS) for processing.

func SubmitCommandDirect added in v0.3.0

func SubmitCommandDirect(ctx uintptr, command, out []byte) (uint32, error)

func SubmitCommandNonBlocking

func SubmitCommandNonBlocking(ctx uintptr, priority Priority, command, out []byte) (uint32, error)

Types

type Attribute

type Attribute uint32
const (
	RequestRaw Attribute = 1 << iota
	IncludeTpm12
	IncludeTpm20
)

type Locality

type Locality uint32
const (
	LocalityZero  Locality = 0x00
	LocalityOne   Locality = 0x01
	LocalityTwo   Locality = 0x02
	LocalityThree Locality = 0x03
	LocalityFour  Locality = 0x04
)

type LogType

type LogType uint32
const (
	LogTypeSRTMCurrent LogType = iota // log associated with the current session (boot or resume)
	LogTypeDRTMCurrent                // log associated with the current session (boot or resume)
	LogTypeSRTMBoot                   // log associated with the most recent clean boot (SRTM log)
	LogTypeSRTMResume                 // log associated with the current resume from hibernation (SRTM log)
	LogTypeDRTMBoot                   // log associated with the most recent clean boot (DRTM log)
	LogTypeDRTMResume                 // log associated with the current resume from hibernation (DRTM log)
)

type OwnerAuthType

type OwnerAuthType uint32
const (
	OwnerAuthTypeFull                 OwnerAuthType = 1
	OwnerAuthTypeEndorsement20        OwnerAuthType = 12
	OwnerAuthTypeEndorsementStorage20 OwnerAuthType = 13
)

type Priority

type Priority uint32
const (
	PriorityLow    Priority = 0x64
	PriorityNormal Priority = 0xC8
	PriorityHigh   Priority = 0x12C
	PrioritySystem Priority = 0x190
	PriorityMax    Priority = 0x80000000
)

type TpmDeviceInfo

type TpmDeviceInfo struct {
	StructVersion uint32
	Version       uint32
	InterFaceType uint32
	ImpRevision   uint32
}

func GetDeviceInfo

func GetDeviceInfo() (*TpmDeviceInfo, error)

GetDeviceInfo obtains the version of the TPM on the computer.

Jump to

Keyboard shortcuts

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