xtpmeventlog

package
v0.0.0-...-f44e450 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Copyright 2023 Meta Platforms, Inc. and affiliates.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Copyright 2023 Meta Platforms, Inc. and affiliates.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrNoPCR0DATALog

type ErrNoPCR0DATALog struct{}

ErrNoPCR0DATALog means there is no log entry, corresponding to PCR0_DATA measurement.

func (ErrNoPCR0DATALog) Error

func (err ErrNoPCR0DATALog) Error() string

Error implements interface "error".

type ErrPCR0DataLogTooSmall

type ErrPCR0DataLogTooSmall struct {
	Data []byte
}

ErrPCR0DataLogTooSmall means found log entry has too small data which does not contain the original data of pcr.Measurement is a known format.

It might mean that the firmware does not support this extension.

func (ErrPCR0DataLogTooSmall) Error

func (err ErrPCR0DataLogTooSmall) Error() string

Error implements interface "error".

type PCR0DATALog

type PCR0DATALog struct {
	Description       string
	ACM_POLICY_STATUS uint64
	ACMHeaderSVN      uint16
	ACMSignatureAlgo  TPM_ALG_ID
	ACMSignature      []byte `count_type:"uint16_le"`
	KMSignatureAlgo   TPM_ALG_ID
	KMSignature       []byte `count_type:"uint16_le"`
	BPMSignatureAlgo  TPM_ALG_ID
	BPMSignature      []byte `count_type:"uint16_le"`
	IBBDigests        TPML_DIGEST_VALUES
	OriginalPCR0      TPML_DIGEST_VALUES
}

The initial description of the structure is:

type EventData struct {
	DescriptionSize   uint16
	DescriptionString [DescriptionSize]uint8
	ACM_POLICY_STATUS uint64
	ACMHeaderSVN      uint16
	ACMSignatureAlgo  TPM_ALG_ID
	ACMSignatureSize  uint16 // to know the size of the signature, to know where it ends
	ACMSignature      [ACMSignatureSize]uint8
	KMSignatureAlgo   TPM_ALG_ID
	KMSignatureSize   uint16 // to know the size of the signature, to know where it ends
	KMSignature       [KMSignatureSize ]uint8
	BPMSignatureAlgo  TPM_ALG_ID
	BPMSignatureSize  uint16 // to know the size of the signature, to know where it ends
	BPMSignature      [BPMSignatureSize]uint8
	IBBDigests        TPML_DIGEST_VALUES
	OriginalPCR0      TPML_DIGEST_VALUES
}

func ExtractPCR0DATALog

func ExtractPCR0DATALog(
	eventLog *tpmeventlog.TPMEventLog,
	hashAlgo tpmeventlog.TPMAlgorithm,
) (*PCR0DATALog, []byte, error)

ExtractPCR0DATALog extracts raw PCR0_DATA measurements from EventLog (if it is there).

func ParsePCR0DATALog

func ParsePCR0DATALog(logEntry []byte) (*PCR0DATALog, error)

ParsePCR0DATALog parses PCR0_DATA log entry data to pcr.Measurement.

func (*PCR0DATALog) Measurement

func (s *PCR0DATALog) Measurement(hashAlgo cbnt.Algorithm) (*pcr.Measurement, error)

Measurement returns the PCR0_DATA pcr.Measurement expected according to the EventLog entry.

func (*PCR0DATALog) OriginalPCR0ForHash

func (s *PCR0DATALog) OriginalPCR0ForHash(hashAlgo cbnt.Algorithm) []byte

OriginalPCR0ForHash returns the original PCR0 (right after PCR0_DATA measurement) for a specified hashing algorithm PCR0 bank.

This is a value of low importance. It allows to simplify diagnostics if PCR0_DATA measurement was wrong (or even missing). The idea is that when something is wrong and our bruteforcers do no help, we at least may see if the problem with measurements is in PCR0_DATA or after it (which should help with diagnostics and reduce time-to-understand an issue).

type TPMI_ALG_HASH

type TPMI_ALG_HASH = TPM_ALG_ID

According to documentation TPMI_ALG_HASH is an enumeration, thus we assume it has the same size as TPM_ALG_ID.

type TPML_DIGEST_VALUES

type TPML_DIGEST_VALUES struct {
	Digests []TPMT_HA `count_type:"uint32_le"`
}

re-used from https://trustedcomputinggroup.org/wp-content/uploads/TPM-Rev-2.0-Part-2-Structures-01.38.pdf

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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