coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
tspi.c File Reference
#include <console/console.h>
#include <security/tpm/tspi/crtm.h>
#include <security/tpm/tspi.h>
#include <security/tpm/tss.h>
#include <assert.h>
#include <security/vboot/misc.h>
#include <vb2_api.h>
#include <vb2_sha.h>
Include dependency graph for tspi.c:

Go to the source code of this file.

Functions

static uint32_t tpm_setup_s3_helper (void)
 
static uint32_t tpm_setup_epilogue (uint32_t result)
 
static int tspi_tpm_is_setup (void)
 
uint32_t tpm_setup (int s3flag)
 Start the TPM and establish the root of trust. More...
 
uint32_t tpm_clear_and_reenable (void)
 Issue a TPM_Clear and re-enable/reactivate the TPM. 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...
 

Variables

static int tpm_is_setup
 

Function Documentation

◆ 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_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:

◆ tpm_setup_epilogue()

static uint32_t tpm_setup_epilogue ( uint32_t  result)
static

Definition at line 80 of file tspi.c.

References BIOS_INFO, post_code, POST_TPM_FAILURE, printk, and TPM_SUCCESS.

Referenced by tpm_setup().

Here is the caller graph for this function:

◆ tpm_setup_s3_helper()

static uint32_t tpm_setup_s3_helper ( void  )
static

Definition at line 54 of file tspi.c.

References BIOS_ERR, BIOS_INFO, printk, tlcl_resume(), TPM_E_INVALID_POSTINIT, and TPM_SUCCESS.

Referenced by tpm_setup().

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

◆ tspi_tpm_is_setup()

static int tspi_tpm_is_setup ( void  )
inlinestatic

Definition at line 91 of file tspi.c.

References CONFIG, ENV_BOOTBLOCK, ENV_RAMSTAGE, tpm_is_setup, vboot_logic_executed(), and verification_should_run().

Referenced by tpm_extend_pcr().

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

Variable Documentation

◆ tpm_is_setup

int tpm_is_setup
static

Definition at line 90 of file tspi.c.

Referenced by tpm_setup(), and tspi_tpm_is_setup().