drivers/wifi: Remove unnecessary data structure copy
[coreboot2.git] / src / security / tpm / tss2.h
blob16ccf5db6fbff80ea15687e56238643603180c1d
1 /* SPDX-License-Identifier: BSD-3-Clause */
3 #ifndef TSS2_H_
4 #define TSS2_H_
6 #include <types.h>
7 #include <vb2_sha.h>
9 #include <security/tpm/tss/tcg-2.0/tss_structures.h>
10 #include <security/tpm/tss_errors.h>
13 * TPM2-specific
15 * Some operations don't have counterparts in standard and are directly exposed
16 * here.
18 * Other operations are applicable to both TPM versions and have wrappers which
19 * pick the implementation based on version determined during initialization via
20 * tlcl_lib_init().
24 * Define a TPM2 space. The define space command TPM command used by the tlcl
25 * layer offers the ability to use custom nv attributes and policies.
27 tpm_result_t tlcl2_define_space(uint32_t space_index, size_t space_size,
28 const TPMA_NV nv_attributes,
29 const uint8_t *nv_policy, size_t nv_policy_size);
32 * Issue TPM2_GetCapability command
34 tpm_result_t tlcl2_get_capability(TPM_CAP capability, uint32_t property,
35 uint32_t property_count,
36 TPMS_CAPABILITY_DATA *capability_data);
38 /* Issue TPM2_NV_SetBits command */
39 tpm_result_t tlcl2_set_bits(uint32_t index, uint64_t bits);
42 * Makes tlcl2_process_command available for on top implementations of
43 * custom tpm standards like cr50
45 void *tlcl2_process_command(TPM_CC command, void *command_body);
47 /* Return digest size of hash algorithm */
48 uint16_t tlcl2_get_hash_size_from_algo(TPMI_ALG_HASH hash_algo);
50 /**
51 * Set Clear Control. The TPM error code is returned.
53 tpm_result_t tlcl2_clear_control(bool disable);
55 /**
56 * Make an NV Ram location read_only. The TPM error code is returned.
58 tpm_result_t tlcl2_lock_nv_write(uint32_t index);
60 /**
61 * Disable platform hierarchy. Specific to TPM2. The TPM error code is returned.
63 tpm_result_t tlcl2_disable_platform_hierarchy(void);
66 * Declarations for "private" functions which are dispatched to by tss/tss.c
67 * based on TPM family.
70 tpm_result_t tlcl2_save_state(void);
71 tpm_result_t tlcl2_resume(void);
72 tpm_result_t tlcl2_startup(void);
73 tpm_result_t tlcl2_self_test_full(void);
74 tpm_result_t tlcl2_read(uint32_t index, void *data, uint32_t length);
75 tpm_result_t tlcl2_write(uint32_t index, const void *data, uint32_t length);
76 tpm_result_t tlcl2_assert_physical_presence(void);
77 tpm_result_t tlcl2_physical_presence_cmd_enable(void);
78 tpm_result_t tlcl2_finalize_physical_presence(void);
79 tpm_result_t tlcl2_force_clear(void);
80 tpm_result_t tlcl2_extend(int pcr_num, const uint8_t *digest_data,
81 enum vb2_hash_algorithm digest_algo);
83 #endif /* TSS2_H_ */