coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
tss.h File Reference
Include dependency graph for tss.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

uint32_t tlcl_lib_init (void)
 Call this first. More...
 
uint32_t tlcl_send_receive (const uint8_t *request, uint8_t *response, int max_length)
 Perform a raw TPM request/response transaction. More...
 
uint32_t tlcl_startup (void)
 Send a TPM_Startup(ST_CLEAR). More...
 
uint32_t tlcl_resume (void)
 Resume by sending a TPM_Startup(ST_STATE). More...
 
uint32_t tlcl_save_state (void)
 Save TPM state by sending either TPM_SaveState() (TPM1.2) or TPM_Shutdown(ST_STATE) (TPM2.0). More...
 
uint32_t tlcl_self_test_full (void)
 Run the self test. More...
 
uint32_t tlcl_continue_self_test (void)
 Run the self test in the background. More...
 
uint32_t tlcl_write (uint32_t index, const void *data, uint32_t length)
 Write [length] bytes of [data] to space at [index]. More...
 
uint32_t tlcl_read (uint32_t index, void *data, uint32_t length)
 Read [length] bytes from space at [index] into [data]. More...
 
uint32_t tlcl_assert_physical_presence (void)
 Assert physical presence in software. More...
 
uint32_t tlcl_physical_presence_cmd_enable (void)
 Enable the physical presence command. More...
 
uint32_t tlcl_finalize_physical_presence (void)
 Finalize the physical presence settings: software PP is enabled, hardware PP is disabled, and the lifetime lock is set. More...
 
uint32_t tlcl_set_nv_locked (void)
 Set the nvLocked bit. More...
 
uint32_t tlcl_force_clear (void)
 Issue a ForceClear. More...
 
uint32_t tlcl_clear_control (bool disable)
 Set Clear Control. More...
 
uint32_t tlcl_set_global_lock (void)
 Set the bGlobalLock flag, which only a reboot can clear. More...
 
uint32_t tlcl_lock_nv_write (uint32_t index)
 Make an NV Ram location read_only. More...
 
uint32_t tlcl_extend (int pcr_num, const uint8_t *in_digest, uint8_t *out_digest)
 Perform a TPM_Extend. More...
 
uint32_t tlcl_disable_platform_hierarchy (void)
 Disable platform hierarchy. More...
 
uint32_t tlcl_get_permissions (uint32_t index, uint32_t *permissions)
 Get the permission bits for the NVRAM space with |index|. More...
 

Function Documentation

◆ tlcl_assert_physical_presence()

uint32_t tlcl_assert_physical_presence ( void  )

Assert physical presence in software.

The TPM error code is returned.

Definition at line 249 of file tss.c.

References s_tpm_ppassert_cmd::buffer, send(), tpm_ppassert_cmd, TPM_SUCCESS, and VBDEBUG.

Referenced by tpm_setup().

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

◆ tlcl_clear_control()

uint32_t tlcl_clear_control ( bool  disable)

Set Clear Control.

The TPM error code is returned.

Definition at line 168 of file tss.c.

References BIOS_INFO, tpm2_clear_control_cmd::disable, tpm2_response::hdr, printk, TPM2_ClearControl, tpm_header::tpm_code, TPM_E_IOERROR, tpm_process_command(), and TPM_SUCCESS.

Here is the call graph for this function:

◆ tlcl_continue_self_test()

uint32_t tlcl_continue_self_test ( void  )

Run the self test in the background.

Definition at line 184 of file tss.c.

References s_tpm_continueselftest_cmd::buffer, tlcl_send_receive_no_retry(), tpm_continueselftest_cmd, TPM_LARGE_ENOUGH_COMMAND_SIZE, and VBDEBUG.

Referenced by tlcl_send_receive().

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

◆ tlcl_disable_platform_hierarchy()

uint32_t tlcl_disable_platform_hierarchy ( void  )

Disable platform hierarchy.

Specific to TPM2. The TPM error code is returned.

Definition at line 421 of file tss.c.

References tpm2_hierarchy_control_cmd::enable, tpm2_response::hdr, TPM2_Hierarchy_Control, tpm_header::tpm_code, TPM_E_INTERNAL_INCONSISTENCY, tpm_process_command(), TPM_RH_PLATFORM, and TPM_SUCCESS.

Referenced by psp_verstage_s0i3_resume().

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

◆ tlcl_extend()

◆ tlcl_finalize_physical_presence()

uint32_t tlcl_finalize_physical_presence ( void  )

Finalize the physical presence settings: software PP is enabled, hardware PP is disabled, and the lifetime lock is set.

The TPM error code is returned.

Definition at line 261 of file tss.c.

References BIOS_INFO, s_tpm_finalizepp_cmd::buffer, printk, send(), tpm_finalizepp_cmd, TPM_SUCCESS, and VBDEBUG.

Referenced by _factory_initialize_tpm().

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

◆ tlcl_force_clear()

uint32_t tlcl_force_clear ( void  )

Issue a ForceClear.

The TPM error code is returned.

Definition at line 273 of file tss.c.

References BIOS_INFO, s_tpm_forceclear_cmd::buffer, tpm2_response::hdr, NULL, printk, send(), TPM2_Clear, tpm_header::tpm_code, TPM_E_IOERROR, tpm_forceclear_cmd, tpm_process_command(), TPM_SUCCESS, and VBDEBUG.

Referenced by tpm_clear_and_reenable().

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

◆ tlcl_get_permissions()

uint32_t tlcl_get_permissions ( uint32_t  index,
uint32_t permissions 
)

Get the permission bits for the NVRAM space with |index|.

Definition at line 355 of file tss.c.

References s_tpm_getpermissions_cmd::buffer, from_tpm_uint32(), s_tpm_getpermissions_cmd::index, kNvDataPublicPermissionsOffset, kTpmResponseHeaderLength, memcpy(), tlcl_send_receive(), to_tpm_uint32(), tpm_getpermissions_cmd, TPM_LARGE_ENOUGH_COMMAND_SIZE, and TPM_SUCCESS.

Referenced by antirollback_read_space_kernel().

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

◆ tlcl_lib_init()

uint32_t tlcl_lib_init ( void  )

Call this first.

Returns 0 if success, nonzero if error.

Definition at line 145 of file tss.c.

References BIOS_ERR, printk, tis_init(), tis_open(), and tlcl_init_done.

Referenced by mainboard_update_soc_chip_config(), mrc_cache_update_hash(), mrc_cache_verify_hash(), tpm_extend_pcr(), tpm_setup(), and vboot_save_data().

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

◆ tlcl_lock_nv_write()

uint32_t tlcl_lock_nv_write ( uint32_t  index)

Make an NV Ram location read_only.

The TPM error code is returned.

Definition at line 276 of file tss.c.

References BIOS_INFO, tpm2_response::hdr, HR_NV_INDEX, tpm2_nv_write_lock_cmd::nvIndex, printk, TPM2_NV_WriteLock, tpm_header::tpm_code, TPM_E_IOERROR, tpm_process_command(), and TPM_SUCCESS.

Here is the call graph for this function:

◆ tlcl_physical_presence_cmd_enable()

uint32_t tlcl_physical_presence_cmd_enable ( void  )

Enable the physical presence command.

The TPM error code is returned.

Definition at line 255 of file tss.c.

References BIOS_INFO, s_tpm_ppenable_cmd::buffer, printk, send(), tpm_ppenable_cmd, TPM_SUCCESS, and VBDEBUG.

Referenced by tpm_setup().

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

◆ tlcl_read()

◆ tlcl_resume()

uint32_t tlcl_resume ( void  )

Resume by sending a TPM_Startup(ST_STATE).

The TPM error code is returned (0 for success).

Definition at line 166 of file tss.c.

References s_tpm_resume_cmd::buffer, send(), tlcl_send_startup(), tpm_resume_cmd, TPM_SU_STATE, and VBDEBUG.

Referenced by tpm_setup_s3_helper().

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

◆ tlcl_save_state()

uint32_t tlcl_save_state ( void  )

Save TPM state by sending either TPM_SaveState() (TPM1.2) or TPM_Shutdown(ST_STATE) (TPM2.0).

The TPM error code is returned (0 for success).

Definition at line 172 of file tss.c.

References s_tpm_savestate_cmd::buffer, send(), tlcl_send_shutdown(), tpm_savestate_cmd, TPM_SU_STATE, and VBDEBUG.

Here is the call graph for this function:

◆ tlcl_self_test_full()

uint32_t tlcl_self_test_full ( void  )

Run the self test.

Note—this is synchronous. To run this in parallel with other firmware, use ContinueSelfTest(). The TPM error code is returned.

Definition at line 178 of file tss.c.

References BIOS_INFO, s_tpm_selftestfull_cmd::buffer, tpm2_response::hdr, printk, send(), TPM2_SelfTest, tpm_header::tpm_code, tpm_process_command(), tpm_selftestfull_cmd, TPM_SUCCESS, VBDEBUG, and tpm2_self_test::yes_no.

Referenced by factory_initialize_tpm().

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

◆ tlcl_send_receive()

uint32_t tlcl_send_receive ( const uint8_t request,
uint8_t response,
int  max_length 
)

Perform a raw TPM request/response transaction.

Definition at line 104 of file tss.c.

References tlcl_continue_self_test(), tlcl_send_receive_no_retry(), TPM_E_DOING_SELFTEST, TPM_E_NEEDS_SELFTEST, and TPM_SUCCESS.

Referenced by send(), tlcl_extend(), tlcl_get_permanent_flags(), tlcl_get_permissions(), tlcl_read(), and tlcl_write().

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

◆ tlcl_set_global_lock()

uint32_t tlcl_set_global_lock ( void  )

Set the bGlobalLock flag, which only a reboot can clear.

The TPM error code is returned.

Definition at line 328 of file tss.c.

References NULL, tlcl_write(), TPM_NV_INDEX0, and VBDEBUG.

Referenced by antirollback_lock_space_firmware().

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

◆ tlcl_set_nv_locked()

uint32_t tlcl_set_nv_locked ( void  )

Set the nvLocked bit.

The TPM error code is returned.

Definition at line 267 of file tss.c.

References tlcl_define_space(), TPM_NV_INDEX_LOCK, and VBDEBUG.

Referenced by _factory_initialize_tpm().

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

◆ tlcl_startup()

uint32_t tlcl_startup ( void  )

Send a TPM_Startup(ST_CLEAR).

The TPM error code is returned (0 for success).

Definition at line 160 of file tss.c.

References s_tpm_startup_cmd::buffer, send(), tlcl_send_startup(), tpm_startup_cmd, TPM_SU_CLEAR, and VBDEBUG.

Referenced by tpm_setup().

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

◆ tlcl_write()