aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/tpm.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/tpm.h')
-rw-r--r--include/linux/tpm.h39
1 files changed, 20 insertions, 19 deletions
diff --git a/include/linux/tpm.h b/include/linux/tpm.h
index 5a090f5ab335..bcdd3790e94d 100644
--- a/include/linux/tpm.h
+++ b/include/linux/tpm.h
@@ -24,11 +24,6 @@
24 24
25#define TPM_DIGEST_SIZE 20 /* Max TPM v1.2 PCR size */ 25#define TPM_DIGEST_SIZE 20 /* Max TPM v1.2 PCR size */
26 26
27/*
28 * Chip num is this value or a valid tpm idx
29 */
30#define TPM_ANY_NUM 0xFFFF
31
32struct tpm_chip; 27struct tpm_chip;
33struct trusted_key_payload; 28struct trusted_key_payload;
34struct trusted_key_options; 29struct trusted_key_options;
@@ -50,46 +45,52 @@ struct tpm_class_ops {
50 unsigned long *timeout_cap); 45 unsigned long *timeout_cap);
51 int (*request_locality)(struct tpm_chip *chip, int loc); 46 int (*request_locality)(struct tpm_chip *chip, int loc);
52 void (*relinquish_locality)(struct tpm_chip *chip, int loc); 47 void (*relinquish_locality)(struct tpm_chip *chip, int loc);
48 void (*clk_enable)(struct tpm_chip *chip, bool value);
53}; 49};
54 50
55#if defined(CONFIG_TCG_TPM) || defined(CONFIG_TCG_TPM_MODULE) 51#if defined(CONFIG_TCG_TPM) || defined(CONFIG_TCG_TPM_MODULE)
56 52
57extern int tpm_is_tpm2(u32 chip_num); 53extern int tpm_is_tpm2(struct tpm_chip *chip);
58extern int tpm_pcr_read(u32 chip_num, int pcr_idx, u8 *res_buf); 54extern int tpm_pcr_read(struct tpm_chip *chip, int pcr_idx, u8 *res_buf);
59extern int tpm_pcr_extend(u32 chip_num, int pcr_idx, const u8 *hash); 55extern int tpm_pcr_extend(struct tpm_chip *chip, int pcr_idx, const u8 *hash);
60extern int tpm_send(u32 chip_num, void *cmd, size_t buflen); 56extern int tpm_send(struct tpm_chip *chip, void *cmd, size_t buflen);
61extern int tpm_get_random(u32 chip_num, u8 *data, size_t max); 57extern int tpm_get_random(struct tpm_chip *chip, u8 *data, size_t max);
62extern int tpm_seal_trusted(u32 chip_num, 58extern int tpm_seal_trusted(struct tpm_chip *chip,
63 struct trusted_key_payload *payload, 59 struct trusted_key_payload *payload,
64 struct trusted_key_options *options); 60 struct trusted_key_options *options);
65extern int tpm_unseal_trusted(u32 chip_num, 61extern int tpm_unseal_trusted(struct tpm_chip *chip,
66 struct trusted_key_payload *payload, 62 struct trusted_key_payload *payload,
67 struct trusted_key_options *options); 63 struct trusted_key_options *options);
68#else 64#else
69static inline int tpm_is_tpm2(u32 chip_num) 65static inline int tpm_is_tpm2(struct tpm_chip *chip)
70{ 66{
71 return -ENODEV; 67 return -ENODEV;
72} 68}
73static inline int tpm_pcr_read(u32 chip_num, int pcr_idx, u8 *res_buf) { 69static inline int tpm_pcr_read(struct tpm_chip *chip, int pcr_idx, u8 *res_buf)
70{
74 return -ENODEV; 71 return -ENODEV;
75} 72}
76static inline int tpm_pcr_extend(u32 chip_num, int pcr_idx, const u8 *hash) { 73static inline int tpm_pcr_extend(struct tpm_chip *chip, int pcr_idx,
74 const u8 *hash)
75{
77 return -ENODEV; 76 return -ENODEV;
78} 77}
79static inline int tpm_send(u32 chip_num, void *cmd, size_t buflen) { 78static inline int tpm_send(struct tpm_chip *chip, void *cmd, size_t buflen)
79{
80 return -ENODEV; 80 return -ENODEV;
81} 81}
82static inline int tpm_get_random(u32 chip_num, u8 *data, size_t max) { 82static inline int tpm_get_random(struct tpm_chip *chip, u8 *data, size_t max)
83{
83 return -ENODEV; 84 return -ENODEV;
84} 85}
85 86
86static inline int tpm_seal_trusted(u32 chip_num, 87static inline int tpm_seal_trusted(struct tpm_chip *chip,
87 struct trusted_key_payload *payload, 88 struct trusted_key_payload *payload,
88 struct trusted_key_options *options) 89 struct trusted_key_options *options)
89{ 90{
90 return -ENODEV; 91 return -ENODEV;
91} 92}
92static inline int tpm_unseal_trusted(u32 chip_num, 93static inline int tpm_unseal_trusted(struct tpm_chip *chip,
93 struct trusted_key_payload *payload, 94 struct trusted_key_payload *payload,
94 struct trusted_key_options *options) 95 struct trusted_key_options *options)
95{ 96{