History

tpm: move tpm_chip definition to include/linux/tpm.h

The tpm_chip structure contains the list of PCR banks currently allocated in the TPM. When support for crypto agility will be added to the TPM driver, users of the driver have to provide a digest for each allocated bank to tpm_pcr_extend(). With this patch, they can obtain the PCR bank algorithms directly from chip->allocated_banks.

Roberto Sassu committed 7 years ago

Commit 901615c1 parent 879b5892 files · +95 −97Browse files

Showing the changes to include/linux (1 of 2 files). Show all

Unified · Split

include/linux/tpm.h+91−0
@@ -22,6 +22,10 @@ · 21 unmodified lines
2222 #ifndef __LINUX_TPM_H__
2323 #define __LINUX_TPM_H__
2424
25+#include <linux/hw_random.h>
26+#include <linux/acpi.h>
27+#include <linux/cdev.h>
28+#include <linux/fs.h>
2529 #include <crypto/hash_info.h>
2630
2731 #define TPM_DIGEST_SIZE 20 /* Max TPM v1.2 PCR size */
@@ -75,6 +79,93 @@ struct tpm_class_ops { · 47 unmodified lines
7579 void (*clk_enable)(struct tpm_chip *chip, bool value);
7680 };
7781
82+#define TPM_NUM_EVENT_LOG_FILES 3
83+
84+/* Indexes the duration array */
85+enum tpm_duration {
86+ TPM_SHORT = 0,
87+ TPM_MEDIUM = 1,
88+ TPM_LONG = 2,
89+ TPM_LONG_LONG = 3,
90+ TPM_UNDEFINED,
91+ TPM_NUM_DURATIONS = TPM_UNDEFINED,
92+};
93+
94+#define TPM_PPI_VERSION_LEN 3
95+
96+struct tpm_space {
97+ u32 context_tbl[3];
98+ u8 *context_buf;
99+ u32 session_tbl[3];
100+ u8 *session_buf;
101+};
102+
103+struct tpm_bios_log {
104+ void *bios_event_log;
105+ void *bios_event_log_end;
106+};
107+
108+struct tpm_chip_seqops {
109+ struct tpm_chip *chip;
110+ const struct seq_operations *seqops;
111+};
112+
113+struct tpm_chip {
114+ struct device dev;
115+ struct device devs;
116+ struct cdev cdev;
117+ struct cdev cdevs;
118+
119+ /* A driver callback under ops cannot be run unless ops_sem is held
120+ * (sometimes implicitly, eg for the sysfs code). ops becomes null
121+ * when the driver is unregistered, see tpm_try_get_ops.
122+ */
123+ struct rw_semaphore ops_sem;
124+ const struct tpm_class_ops *ops;
125+
126+ struct tpm_bios_log log;
127+ struct tpm_chip_seqops bin_log_seqops;
128+ struct tpm_chip_seqops ascii_log_seqops;
129+
130+ unsigned int flags;
131+
132+ int dev_num; /* /dev/tpm# */
133+ unsigned long is_open; /* only one allowed */
134+
135+ char hwrng_name[64];
136+ struct hwrng hwrng;
137+
138+ struct mutex tpm_mutex; /* tpm is processing */
139+
140+ unsigned long timeout_a; /* jiffies */
141+ unsigned long timeout_b; /* jiffies */
142+ unsigned long timeout_c; /* jiffies */
143+ unsigned long timeout_d; /* jiffies */
144+ bool timeout_adjusted;
145+ unsigned long duration[TPM_NUM_DURATIONS]; /* jiffies */
146+ bool duration_adjusted;
147+
148+ struct dentry *bios_dir[TPM_NUM_EVENT_LOG_FILES];
149+
150+ const struct attribute_group *groups[3];
151+ unsigned int groups_cnt;
152+
153+ u32 nr_allocated_banks;
154+ struct tpm_bank_info *allocated_banks;
155+#ifdef CONFIG_ACPI
156+ acpi_handle acpi_dev_handle;
157+ char ppi_version[TPM_PPI_VERSION_LEN + 1];
158+#endif /* CONFIG_ACPI */
159+
160+ struct tpm_space work_space;
161+ u32 last_cc;
162+ u32 nr_commands;
163+ u32 *cc_attrs_tbl;
164+
165+ /* active locality */
166+ int locality;
167+};
168+
78169 #if defined(CONFIG_TCG_TPM) || defined(CONFIG_TCG_TPM_MODULE)
79170
80171 extern int tpm_is_tpm2(struct tpm_chip *chip);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t