coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
tspi.h File Reference
#include <security/tpm/tss.h>
#include <commonlib/tcpa_log_serialized.h>
#include <commonlib/region.h>
#include <vb2_api.h>
Include dependency graph for tspi.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define TPM_PCR_MAX_LEN   64
 
#define HASH_DATA_CHUNK_SIZE   1024
 

Functions

struct tcpa_tabletcpa_log_init (void)
 Get the pointer to the single instance of global tcpa log data, and initialize it when necessary. More...
 
void tcpa_preram_log_clear (void)
 Clears the pre-RAM tcpa log data and initializes any content with default values. More...
 
void tcpa_log_add_table_entry (const char *name, const uint32_t pcr, enum vb2_hash_algorithm digest_algo, const uint8_t *digest, const size_t digest_len)
 Add table entry for cbmem TCPA log. More...
 
void tcpa_log_dump (void *unused)
 Dump TCPA log entries on console. More...
 
uint32_t tpm_extend_pcr (int pcr, enum vb2_hash_algorithm digest_algo, const uint8_t *digest, size_t digest_len, const char *name)
 Ask vboot for a digest and extend a TPM PCR with it. More...
 
uint32_t tpm_clear_and_reenable (void)
 Issue a TPM_Clear and re-enable/reactivate the TPM. More...
 
uint32_t tpm_setup (int s3flag)
 Start the TPM and establish the root of trust. More...
 
uint32_t tpm_measure_region (const struct region_device *rdev, uint8_t pcr, const char *rname)
 Measure a given region device and extend given PCR with the result. More...
 

Macro Definition Documentation

◆ HASH_DATA_CHUNK_SIZE

#define HASH_DATA_CHUNK_SIZE   1024

Definition at line 12 of file tspi.h.

◆ TPM_PCR_MAX_LEN

#define TPM_PCR_MAX_LEN   64

Definition at line 11 of file tspi.h.

Function Documentation

◆ tcpa_log_add_table_entry()

void tcpa_log_add_table_entry ( const char *  name,
const uint32_t  pcr,
enum vb2_hash_algorithm  digest_algo,
const uint8_t digest,
const size_t  digest_len 
)

Add table entry for cbmem TCPA log.

Parameters
nameName of the hashed data
pcrPCR used to extend hashed data
diget_algosets the digest algorithm
digestsets the hash extended into the tpm
digest_lenthe length of the digest

Definition at line 79 of file log.c.

References BIOS_WARNING, tcpa_entry::digest, tcpa_entry::digest_length, tcpa_entry::digest_type, tcpa_table::entries, tcpa_table::max_entries, memcpy(), name, tcpa_entry::name, tcpa_table::num_entries, tcpa_entry::pcr, printk, strncpy(), TCPA_DIGEST_MAX_LENGTH, tcpa_log_init(), TCPA_PCR_HASH_LEN, and TCPA_PCR_HASH_NAME.

Referenced by tpm_extend_pcr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tcpa_log_dump()

void tcpa_log_dump ( void unused)

Dump TCPA log entries on console.

Definition at line 54 of file log.c.

References BIOS_INFO, tcpa_entry::digest, tcpa_entry::digest_length, tcpa_entry::digest_type, tcpa_table::entries, tcpa_entry::name, tcpa_table::num_entries, tcpa_entry::pcr, printk, and tcpa_log_init().

Here is the call graph for this function:

◆ tcpa_log_init()

struct tcpa_table* tcpa_log_init ( void  )

Get the pointer to the single instance of global tcpa log data, and initialize it when necessary.

Definition at line 33 of file log.c.

References cbmem_possibly_online(), CONFIG, ENV_ROMSTAGE, and tcpa_cbmem_init().

Referenced by tcpa_log_add_table_entry(), tcpa_log_dump(), and tspi_measure_cache_to_pcr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tcpa_preram_log_clear()

void tcpa_preram_log_clear ( void  )

Clears the pre-RAM tcpa log data and initializes any content with default values.

Definition at line 116 of file log.c.

References BIOS_INFO, tcpa_table::max_entries, MAX_TCPA_LOG_ENTRIES, tcpa_table::num_entries, and printk.

Referenced by tspi_init_crtm().

Here is the caller graph for this function:

◆ tpm_clear_and_reenable()

uint32_t tpm_clear_and_reenable ( void  )

Issue a TPM_Clear and re-enable/reactivate the TPM.

Returns
TPM_SUCCESS on success. If not a tpm error is returned

Definition at line 192 of file tspi.c.

References BIOS_ERR, BIOS_INFO, printk, tlcl_force_clear(), tlcl_set_deactivated(), tlcl_set_enable(), and TPM_SUCCESS.

Referenced by _factory_initialize_tpm(), safe_define_space(), safe_write(), and vb2ex_tpm_clear_owner().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tpm_extend_pcr()

uint32_t tpm_extend_pcr ( int  pcr,
enum vb2_hash_algorithm  digest_algo,
const uint8_t digest,
size_t  digest_len,
const char *  name 
)

Ask vboot for a digest and extend a TPM PCR with it.

Parameters
pcrsets the pcr index
diget_algosets the digest algorithm
digestsets the hash to extend into the tpm
digest_lenthe length of the digest
namesets additional info where the digest comes from
Returns
TPM_SUCCESS on success. If not a tpm error is returned

Definition at line 220 of file tspi.c.

References BIOS_DEBUG, BIOS_ERR, CONFIG, name, NULL, printk, tcpa_log_add_table_entry(), tlcl_extend(), tlcl_lib_init(), TPM_E_IOERROR, TPM_SUCCESS, and tspi_tpm_is_setup().

Referenced by tspi_cbfs_measurement(), and vboot_extend_pcr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tpm_measure_region()

uint32_t tpm_measure_region ( const struct region_device rdev,
uint8_t  pcr,
const char *  rname 
)

Measure a given region device and extend given PCR with the result.

Parameters
*rdevPointer to the region device to measure
pcrIndex of the PCR which will be extended by this measure
*rnameName of the region that is measured
Returns
TPM error code in case of error otherwise TPM_SUCCESS

Referenced by tspi_init_crtm().

Here is the caller graph for this function:

◆ tpm_setup()

uint32_t tpm_setup ( int  s3flag)

Start the TPM and establish the root of trust.

Parameters
s3flagtells the tpm setup if we wake up from a s3 state on x86
Returns
TPM_SUCCESS on success. If not a tpm error is returned

Definition at line 135 of file tspi.c.

References BIOS_DEBUG, BIOS_ERR, BIOS_INFO, CONFIG, printk, tlcl_assert_physical_presence(), tlcl_lib_init(), tlcl_physical_presence_cmd_enable(), tlcl_startup(), TPM_E_INVALID_POSTINIT, tpm_is_setup, tpm_setup_epilogue(), tpm_setup_s3_helper(), TPM_SUCCESS, and tspi_measure_cache_to_pcr().

Referenced by bootblock_main_with_timestamp(), init_tpm_dev(), psp_verstage_s0i3_resume(), and vboot_setup_tpm().

Here is the call graph for this function:
Here is the caller graph for this function: