include/linux/tpm.h
Source file repositories/reference/linux-study-clean/include/linux/tpm.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/tpm.h- Extension
.h- Size
- 14578 bytes
- Lines
- 573
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/hw_random.hlinux/acpi.hlinux/cdev.hlinux/fs.hlinux/highmem.hcrypto/hash_info.hcrypto/aes.hlinux/unaligned.h
Detected Declarations
struct tpm_chipstruct trusted_key_payloadstruct trusted_key_optionsstruct tpm2_authstruct tpm_digeststruct tpm_bank_infostruct tpm_class_opsstruct tpm_spacestruct tpm_bios_logstruct tpm_chip_seqopsstruct tpm_chipstruct tpm_headerstruct tpm_bufstruct tpm2_hashenum tpm2_session_typesenum tpm_algorithmsenum tpm2_curvesenum TPM_OPS_FLAGSenum tpm_durationenum tpm2_constenum tpm2_timeoutsenum tpm2_durationsenum tpm2_structuresenum tpm2_return_codesenum tpm2_command_codesenum tpm2_permanent_handlesenum tpm2_mso_typeenum tpm2_capabilitiesenum tpm2_propertiesenum tpm2_startup_typesenum tpm2_cc_attrsenum tpm_chip_flagsenum tpm_buf_flagsenum tpm2_object_attributesenum tpm2_session_attributesfunction tpm2_handle_msofunction tpm_is_firmware_upgradefunction tpm2_rc_valuefunction tpm_transmit_cmdfunction tpm_buf_append_empty_authfunction tpm_is_tpm2function tpm_pcr_readfunction tpm_pcr_extendfunction tpm_get_randomfunction tpm_buf_append_empty_authfunction tpm2_start_auth_sessionfunction tpm2_end_auth_sessionfunction tpm_buf_check_hmac_response
Annotated Snippet
struct tpm_digest {
u16 alg_id;
u8 digest[TPM2_MAX_DIGEST_SIZE];
} __packed;
struct tpm_bank_info {
u16 alg_id;
u16 digest_size;
u16 crypto_id;
};
enum TPM_OPS_FLAGS {
TPM_OPS_AUTO_STARTUP = BIT(0),
};
struct tpm_class_ops {
unsigned int flags;
const u8 req_complete_mask;
const u8 req_complete_val;
bool (*req_canceled)(struct tpm_chip *chip, u8 status);
int (*recv) (struct tpm_chip *chip, u8 *buf, size_t len);
int (*send)(struct tpm_chip *chip, u8 *buf, size_t bufsiz,
size_t cmd_len);
void (*cancel) (struct tpm_chip *chip);
u8 (*status) (struct tpm_chip *chip);
void (*update_timeouts)(struct tpm_chip *chip,
unsigned long *timeout_cap);
void (*update_durations)(struct tpm_chip *chip,
unsigned long *duration_cap);
int (*go_idle)(struct tpm_chip *chip);
int (*cmd_ready)(struct tpm_chip *chip);
int (*request_locality)(struct tpm_chip *chip, int loc);
int (*relinquish_locality)(struct tpm_chip *chip, int loc);
void (*clk_enable)(struct tpm_chip *chip, bool value);
};
#define TPM_NUM_EVENT_LOG_FILES 3
/* Indexes the duration array */
enum tpm_duration {
TPM_SHORT = 0,
TPM_MEDIUM = 1,
TPM_LONG = 2,
TPM_LONG_LONG = 3,
TPM_UNDEFINED,
TPM_NUM_DURATIONS = TPM_UNDEFINED,
};
#define TPM_PPI_VERSION_LEN 3
struct tpm_space {
u32 context_tbl[3];
u8 *context_buf;
u32 session_tbl[3];
u8 *session_buf;
u32 buf_size;
};
struct tpm_bios_log {
void *bios_event_log;
void *bios_event_log_end;
};
struct tpm_chip_seqops {
struct tpm_chip *chip;
const struct seq_operations *seqops;
};
/* fixed define for the curve we use which is NIST_P256 */
#define EC_PT_SZ 32
/*
* fixed define for the size of a name. This is actually HASHALG size
* plus 2, so 32 for SHA256
*/
#define TPM2_NAME_SIZE 34
/*
* The maximum size for an object context
*/
#define TPM2_MAX_CONTEXT_SIZE 4096
struct tpm_chip {
struct device dev;
struct device devs;
struct cdev cdev;
struct cdev cdevs;
/* A driver callback under ops cannot be run unless ops_sem is held
* (sometimes implicitly, eg for the sysfs code). ops becomes null
Annotation
- Immediate include surface: `linux/hw_random.h`, `linux/acpi.h`, `linux/cdev.h`, `linux/fs.h`, `linux/highmem.h`, `crypto/hash_info.h`, `crypto/aes.h`, `linux/unaligned.h`.
- Detected declarations: `struct tpm_chip`, `struct trusted_key_payload`, `struct trusted_key_options`, `struct tpm2_auth`, `struct tpm_digest`, `struct tpm_bank_info`, `struct tpm_class_ops`, `struct tpm_space`, `struct tpm_bios_log`, `struct tpm_chip_seqops`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.