tpm.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608
  1. /*
  2. * Copyright (C) 2004 IBM Corporation
  3. * Copyright (C) 2015 Intel Corporation
  4. *
  5. * Authors:
  6. * Leendert van Doorn <leendert@watson.ibm.com>
  7. * Dave Safford <safford@watson.ibm.com>
  8. * Reiner Sailer <sailer@watson.ibm.com>
  9. * Kylene Hall <kjhall@us.ibm.com>
  10. *
  11. * Maintained by: <tpmdd-devel@lists.sourceforge.net>
  12. *
  13. * Device driver for TCG/TCPA TPM (trusted platform module).
  14. * Specifications at www.trustedcomputinggroup.org
  15. *
  16. * This program is free software; you can redistribute it and/or
  17. * modify it under the terms of the GNU General Public License as
  18. * published by the Free Software Foundation, version 2 of the
  19. * License.
  20. *
  21. */
  22. #ifndef __TPM_H__
  23. #define __TPM_H__
  24. #include <linux/module.h>
  25. #include <linux/delay.h>
  26. #include <linux/fs.h>
  27. #include <linux/hw_random.h>
  28. #include <linux/mutex.h>
  29. #include <linux/sched.h>
  30. #include <linux/platform_device.h>
  31. #include <linux/io.h>
  32. #include <linux/tpm.h>
  33. #include <linux/acpi.h>
  34. #include <linux/cdev.h>
  35. #include <linux/highmem.h>
  36. #include <linux/tpm_eventlog.h>
  37. #include <crypto/hash_info.h>
  38. #ifdef CONFIG_X86
  39. #include <asm/intel-family.h>
  40. #endif
  41. enum tpm_const {
  42. TPM_MINOR = 224, /* officially assigned */
  43. TPM_BUFSIZE = 4096,
  44. TPM_NUM_DEVICES = 65536,
  45. TPM_RETRY = 50, /* 5 seconds */
  46. TPM_NUM_EVENT_LOG_FILES = 3,
  47. };
  48. enum tpm_timeout {
  49. TPM_TIMEOUT = 5, /* msecs */
  50. TPM_TIMEOUT_RETRY = 100, /* msecs */
  51. TPM_TIMEOUT_RANGE_US = 300, /* usecs */
  52. TPM_TIMEOUT_POLL = 1, /* msecs */
  53. TPM_TIMEOUT_USECS_MIN = 100, /* usecs */
  54. TPM_TIMEOUT_USECS_MAX = 500 /* usecs */
  55. };
  56. /* TPM addresses */
  57. enum tpm_addr {
  58. TPM_SUPERIO_ADDR = 0x2E,
  59. TPM_ADDR = 0x4E,
  60. };
  61. /* Indexes the duration array */
  62. enum tpm_duration {
  63. TPM_SHORT = 0,
  64. TPM_MEDIUM = 1,
  65. TPM_LONG = 2,
  66. TPM_LONG_LONG = 3,
  67. TPM_UNDEFINED,
  68. TPM_NUM_DURATIONS = TPM_UNDEFINED,
  69. };
  70. #define TPM_WARN_RETRY 0x800
  71. #define TPM_WARN_DOING_SELFTEST 0x802
  72. #define TPM_ERR_DEACTIVATED 0x6
  73. #define TPM_ERR_DISABLED 0x7
  74. #define TPM_ERR_INVALID_POSTINIT 38
  75. #define TPM_HEADER_SIZE 10
  76. enum tpm2_const {
  77. TPM2_PLATFORM_PCR = 24,
  78. TPM2_PCR_SELECT_MIN = ((TPM2_PLATFORM_PCR + 7) / 8),
  79. };
  80. enum tpm2_timeouts {
  81. TPM2_TIMEOUT_A = 750,
  82. TPM2_TIMEOUT_B = 2000,
  83. TPM2_TIMEOUT_C = 200,
  84. TPM2_TIMEOUT_D = 30,
  85. TPM2_DURATION_SHORT = 20,
  86. TPM2_DURATION_MEDIUM = 750,
  87. TPM2_DURATION_LONG = 2000,
  88. TPM2_DURATION_LONG_LONG = 300000,
  89. TPM2_DURATION_DEFAULT = 120000,
  90. };
  91. enum tpm2_structures {
  92. TPM2_ST_NO_SESSIONS = 0x8001,
  93. TPM2_ST_SESSIONS = 0x8002,
  94. };
  95. /* Indicates from what layer of the software stack the error comes from */
  96. #define TSS2_RC_LAYER_SHIFT 16
  97. #define TSS2_RESMGR_TPM_RC_LAYER (11 << TSS2_RC_LAYER_SHIFT)
  98. enum tpm2_return_codes {
  99. TPM2_RC_SUCCESS = 0x0000,
  100. TPM2_RC_HASH = 0x0083, /* RC_FMT1 */
  101. TPM2_RC_HANDLE = 0x008B,
  102. TPM2_RC_INITIALIZE = 0x0100, /* RC_VER1 */
  103. TPM2_RC_FAILURE = 0x0101,
  104. TPM2_RC_DISABLED = 0x0120,
  105. TPM2_RC_COMMAND_CODE = 0x0143,
  106. TPM2_RC_TESTING = 0x090A, /* RC_WARN */
  107. TPM2_RC_REFERENCE_H0 = 0x0910,
  108. TPM2_RC_RETRY = 0x0922,
  109. };
  110. enum tpm2_algorithms {
  111. TPM2_ALG_ERROR = 0x0000,
  112. TPM2_ALG_SHA1 = 0x0004,
  113. TPM2_ALG_KEYEDHASH = 0x0008,
  114. TPM2_ALG_SHA256 = 0x000B,
  115. TPM2_ALG_SHA384 = 0x000C,
  116. TPM2_ALG_SHA512 = 0x000D,
  117. TPM2_ALG_NULL = 0x0010,
  118. TPM2_ALG_SM3_256 = 0x0012,
  119. };
  120. enum tpm2_command_codes {
  121. TPM2_CC_FIRST = 0x011F,
  122. TPM2_CC_CREATE_PRIMARY = 0x0131,
  123. TPM2_CC_SELF_TEST = 0x0143,
  124. TPM2_CC_STARTUP = 0x0144,
  125. TPM2_CC_SHUTDOWN = 0x0145,
  126. TPM2_CC_CREATE = 0x0153,
  127. TPM2_CC_LOAD = 0x0157,
  128. TPM2_CC_UNSEAL = 0x015E,
  129. TPM2_CC_CONTEXT_LOAD = 0x0161,
  130. TPM2_CC_CONTEXT_SAVE = 0x0162,
  131. TPM2_CC_FLUSH_CONTEXT = 0x0165,
  132. TPM2_CC_GET_CAPABILITY = 0x017A,
  133. TPM2_CC_GET_RANDOM = 0x017B,
  134. TPM2_CC_PCR_READ = 0x017E,
  135. TPM2_CC_PCR_EXTEND = 0x0182,
  136. TPM2_CC_LAST = 0x018F,
  137. };
  138. enum tpm2_permanent_handles {
  139. TPM2_RS_PW = 0x40000009,
  140. };
  141. enum tpm2_capabilities {
  142. TPM2_CAP_HANDLES = 1,
  143. TPM2_CAP_COMMANDS = 2,
  144. TPM2_CAP_PCRS = 5,
  145. TPM2_CAP_TPM_PROPERTIES = 6,
  146. };
  147. enum tpm2_properties {
  148. TPM_PT_TOTAL_COMMANDS = 0x0129,
  149. };
  150. enum tpm2_startup_types {
  151. TPM2_SU_CLEAR = 0x0000,
  152. TPM2_SU_STATE = 0x0001,
  153. };
  154. enum tpm2_cc_attrs {
  155. TPM2_CC_ATTR_CHANDLES = 25,
  156. TPM2_CC_ATTR_RHANDLE = 28,
  157. };
  158. #define TPM_VID_INTEL 0x8086
  159. #define TPM_VID_WINBOND 0x1050
  160. #define TPM_VID_STM 0x104A
  161. #define TPM_PPI_VERSION_LEN 3
  162. struct tpm_space {
  163. u32 context_tbl[3];
  164. u8 *context_buf;
  165. u32 session_tbl[3];
  166. u8 *session_buf;
  167. };
  168. enum tpm_chip_flags {
  169. TPM_CHIP_FLAG_TPM2 = BIT(1),
  170. TPM_CHIP_FLAG_IRQ = BIT(2),
  171. TPM_CHIP_FLAG_VIRTUAL = BIT(3),
  172. TPM_CHIP_FLAG_HAVE_TIMEOUTS = BIT(4),
  173. TPM_CHIP_FLAG_ALWAYS_POWERED = BIT(5),
  174. };
  175. struct tpm_bios_log {
  176. void *bios_event_log;
  177. void *bios_event_log_end;
  178. };
  179. struct tpm_chip_seqops {
  180. struct tpm_chip *chip;
  181. const struct seq_operations *seqops;
  182. };
  183. struct tpm_chip {
  184. struct device dev;
  185. struct device devs;
  186. struct cdev cdev;
  187. struct cdev cdevs;
  188. /* A driver callback under ops cannot be run unless ops_sem is held
  189. * (sometimes implicitly, eg for the sysfs code). ops becomes null
  190. * when the driver is unregistered, see tpm_try_get_ops.
  191. */
  192. struct rw_semaphore ops_sem;
  193. const struct tpm_class_ops *ops;
  194. struct tpm_bios_log log;
  195. struct tpm_chip_seqops bin_log_seqops;
  196. struct tpm_chip_seqops ascii_log_seqops;
  197. unsigned int flags;
  198. int dev_num; /* /dev/tpm# */
  199. unsigned long is_open; /* only one allowed */
  200. char hwrng_name[64];
  201. struct hwrng hwrng;
  202. struct mutex tpm_mutex; /* tpm is processing */
  203. unsigned long timeout_a; /* jiffies */
  204. unsigned long timeout_b; /* jiffies */
  205. unsigned long timeout_c; /* jiffies */
  206. unsigned long timeout_d; /* jiffies */
  207. bool timeout_adjusted;
  208. unsigned long duration[TPM_NUM_DURATIONS]; /* jiffies */
  209. bool duration_adjusted;
  210. struct dentry *bios_dir[TPM_NUM_EVENT_LOG_FILES];
  211. const struct attribute_group *groups[3];
  212. unsigned int groups_cnt;
  213. u16 active_banks[7];
  214. #ifdef CONFIG_ACPI
  215. acpi_handle acpi_dev_handle;
  216. char ppi_version[TPM_PPI_VERSION_LEN + 1];
  217. #endif /* CONFIG_ACPI */
  218. struct tpm_space work_space;
  219. u32 nr_commands;
  220. u32 *cc_attrs_tbl;
  221. /* active locality */
  222. int locality;
  223. };
  224. #define to_tpm_chip(d) container_of(d, struct tpm_chip, dev)
  225. struct tpm_input_header {
  226. __be16 tag;
  227. __be32 length;
  228. __be32 ordinal;
  229. } __packed;
  230. struct tpm_output_header {
  231. __be16 tag;
  232. __be32 length;
  233. __be32 return_code;
  234. } __packed;
  235. #define TPM_TAG_RQU_COMMAND 193
  236. struct stclear_flags_t {
  237. __be16 tag;
  238. u8 deactivated;
  239. u8 disableForceClear;
  240. u8 physicalPresence;
  241. u8 physicalPresenceLock;
  242. u8 bGlobalLock;
  243. } __packed;
  244. struct tpm_version_t {
  245. u8 Major;
  246. u8 Minor;
  247. u8 revMajor;
  248. u8 revMinor;
  249. } __packed;
  250. struct tpm_version_1_2_t {
  251. __be16 tag;
  252. u8 Major;
  253. u8 Minor;
  254. u8 revMajor;
  255. u8 revMinor;
  256. } __packed;
  257. struct timeout_t {
  258. __be32 a;
  259. __be32 b;
  260. __be32 c;
  261. __be32 d;
  262. } __packed;
  263. struct duration_t {
  264. __be32 tpm_short;
  265. __be32 tpm_medium;
  266. __be32 tpm_long;
  267. } __packed;
  268. struct permanent_flags_t {
  269. __be16 tag;
  270. u8 disable;
  271. u8 ownership;
  272. u8 deactivated;
  273. u8 readPubek;
  274. u8 disableOwnerClear;
  275. u8 allowMaintenance;
  276. u8 physicalPresenceLifetimeLock;
  277. u8 physicalPresenceHWEnable;
  278. u8 physicalPresenceCMDEnable;
  279. u8 CEKPUsed;
  280. u8 TPMpost;
  281. u8 TPMpostLock;
  282. u8 FIPS;
  283. u8 operator;
  284. u8 enableRevokeEK;
  285. u8 nvLocked;
  286. u8 readSRKPub;
  287. u8 tpmEstablished;
  288. u8 maintenanceDone;
  289. u8 disableFullDALogicInfo;
  290. } __packed;
  291. typedef union {
  292. struct permanent_flags_t perm_flags;
  293. struct stclear_flags_t stclear_flags;
  294. __u8 owned;
  295. __be32 num_pcrs;
  296. struct tpm_version_t tpm_version;
  297. struct tpm_version_1_2_t tpm_version_1_2;
  298. __be32 manufacturer_id;
  299. struct timeout_t timeout;
  300. struct duration_t duration;
  301. } cap_t;
  302. enum tpm_capabilities {
  303. TPM_CAP_FLAG = 4,
  304. TPM_CAP_PROP = 5,
  305. TPM_CAP_VERSION_1_1 = 0x06,
  306. TPM_CAP_VERSION_1_2 = 0x1A,
  307. };
  308. enum tpm_sub_capabilities {
  309. TPM_CAP_PROP_PCR = 0x101,
  310. TPM_CAP_PROP_MANUFACTURER = 0x103,
  311. TPM_CAP_FLAG_PERM = 0x108,
  312. TPM_CAP_FLAG_VOL = 0x109,
  313. TPM_CAP_PROP_OWNER = 0x111,
  314. TPM_CAP_PROP_TIS_TIMEOUT = 0x115,
  315. TPM_CAP_PROP_TIS_DURATION = 0x120,
  316. };
  317. typedef union {
  318. struct tpm_input_header in;
  319. struct tpm_output_header out;
  320. } tpm_cmd_header;
  321. struct tpm_pcrread_out {
  322. u8 pcr_result[TPM_DIGEST_SIZE];
  323. } __packed;
  324. struct tpm_pcrread_in {
  325. __be32 pcr_idx;
  326. } __packed;
  327. /* 128 bytes is an arbitrary cap. This could be as large as TPM_BUFSIZE - 18
  328. * bytes, but 128 is still a relatively large number of random bytes and
  329. * anything much bigger causes users of struct tpm_cmd_t to start getting
  330. * compiler warnings about stack frame size. */
  331. #define TPM_MAX_RNG_DATA 128
  332. struct tpm_getrandom_out {
  333. __be32 rng_data_len;
  334. u8 rng_data[TPM_MAX_RNG_DATA];
  335. } __packed;
  336. struct tpm_getrandom_in {
  337. __be32 num_bytes;
  338. } __packed;
  339. typedef union {
  340. struct tpm_pcrread_in pcrread_in;
  341. struct tpm_pcrread_out pcrread_out;
  342. struct tpm_getrandom_in getrandom_in;
  343. struct tpm_getrandom_out getrandom_out;
  344. } tpm_cmd_params;
  345. struct tpm_cmd_t {
  346. tpm_cmd_header header;
  347. tpm_cmd_params params;
  348. } __packed;
  349. /* A string buffer type for constructing TPM commands. This is based on the
  350. * ideas of string buffer code in security/keys/trusted.h but is heap based
  351. * in order to keep the stack usage minimal.
  352. */
  353. enum tpm_buf_flags {
  354. TPM_BUF_OVERFLOW = BIT(0),
  355. };
  356. struct tpm_buf {
  357. struct page *data_page;
  358. unsigned int flags;
  359. u8 *data;
  360. };
  361. static inline void tpm_buf_reset(struct tpm_buf *buf, u16 tag, u32 ordinal)
  362. {
  363. struct tpm_input_header *head;
  364. head = (struct tpm_input_header *)buf->data;
  365. head->tag = cpu_to_be16(tag);
  366. head->length = cpu_to_be32(sizeof(*head));
  367. head->ordinal = cpu_to_be32(ordinal);
  368. }
  369. static inline int tpm_buf_init(struct tpm_buf *buf, u16 tag, u32 ordinal)
  370. {
  371. buf->data_page = alloc_page(GFP_HIGHUSER);
  372. if (!buf->data_page)
  373. return -ENOMEM;
  374. buf->flags = 0;
  375. buf->data = kmap(buf->data_page);
  376. tpm_buf_reset(buf, tag, ordinal);
  377. return 0;
  378. }
  379. static inline void tpm_buf_destroy(struct tpm_buf *buf)
  380. {
  381. kunmap(buf->data_page);
  382. __free_page(buf->data_page);
  383. }
  384. static inline u32 tpm_buf_length(struct tpm_buf *buf)
  385. {
  386. struct tpm_input_header *head = (struct tpm_input_header *) buf->data;
  387. return be32_to_cpu(head->length);
  388. }
  389. static inline u16 tpm_buf_tag(struct tpm_buf *buf)
  390. {
  391. struct tpm_input_header *head = (struct tpm_input_header *) buf->data;
  392. return be16_to_cpu(head->tag);
  393. }
  394. static inline void tpm_buf_append(struct tpm_buf *buf,
  395. const unsigned char *new_data,
  396. unsigned int new_len)
  397. {
  398. struct tpm_input_header *head = (struct tpm_input_header *) buf->data;
  399. u32 len = tpm_buf_length(buf);
  400. /* Return silently if overflow has already happened. */
  401. if (buf->flags & TPM_BUF_OVERFLOW)
  402. return;
  403. if ((len + new_len) > PAGE_SIZE) {
  404. WARN(1, "tpm_buf: overflow\n");
  405. buf->flags |= TPM_BUF_OVERFLOW;
  406. return;
  407. }
  408. memcpy(&buf->data[len], new_data, new_len);
  409. head->length = cpu_to_be32(len + new_len);
  410. }
  411. static inline void tpm_buf_append_u8(struct tpm_buf *buf, const u8 value)
  412. {
  413. tpm_buf_append(buf, &value, 1);
  414. }
  415. static inline void tpm_buf_append_u16(struct tpm_buf *buf, const u16 value)
  416. {
  417. __be16 value2 = cpu_to_be16(value);
  418. tpm_buf_append(buf, (u8 *) &value2, 2);
  419. }
  420. static inline void tpm_buf_append_u32(struct tpm_buf *buf, const u32 value)
  421. {
  422. __be32 value2 = cpu_to_be32(value);
  423. tpm_buf_append(buf, (u8 *) &value2, 4);
  424. }
  425. extern struct class *tpm_class;
  426. extern struct class *tpmrm_class;
  427. extern dev_t tpm_devt;
  428. extern const struct file_operations tpm_fops;
  429. extern const struct file_operations tpmrm_fops;
  430. extern struct idr dev_nums_idr;
  431. /**
  432. * enum tpm_transmit_flags - flags for tpm_transmit()
  433. *
  434. * @TPM_TRANSMIT_UNLOCKED: do not lock the chip
  435. * @TPM_TRANSMIT_NESTED: discard setup steps (power management,
  436. * locality) including locking (i.e. implicit
  437. * UNLOCKED)
  438. */
  439. enum tpm_transmit_flags {
  440. TPM_TRANSMIT_UNLOCKED = BIT(0),
  441. TPM_TRANSMIT_NESTED = BIT(1),
  442. };
  443. ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,
  444. u8 *buf, size_t bufsiz, unsigned int flags);
  445. ssize_t tpm_transmit_cmd(struct tpm_chip *chip, struct tpm_space *space,
  446. void *buf, size_t bufsiz,
  447. size_t min_rsp_body_length, unsigned int flags,
  448. const char *desc);
  449. int tpm_startup(struct tpm_chip *chip);
  450. ssize_t tpm_getcap(struct tpm_chip *chip, u32 subcap_id, cap_t *cap,
  451. const char *desc, size_t min_cap_length);
  452. int tpm_get_timeouts(struct tpm_chip *);
  453. int tpm1_auto_startup(struct tpm_chip *chip);
  454. int tpm_do_selftest(struct tpm_chip *chip);
  455. unsigned long tpm_calc_ordinal_duration(struct tpm_chip *chip, u32 ordinal);
  456. int tpm_pm_suspend(struct device *dev);
  457. int tpm_pm_resume(struct device *dev);
  458. static inline void tpm_msleep(unsigned int delay_msec)
  459. {
  460. usleep_range((delay_msec * 1000) - TPM_TIMEOUT_RANGE_US,
  461. delay_msec * 1000);
  462. };
  463. struct tpm_chip *tpm_find_get_ops(struct tpm_chip *chip);
  464. __must_check int tpm_try_get_ops(struct tpm_chip *chip);
  465. void tpm_put_ops(struct tpm_chip *chip);
  466. struct tpm_chip *tpm_chip_alloc(struct device *dev,
  467. const struct tpm_class_ops *ops);
  468. struct tpm_chip *tpmm_chip_alloc(struct device *pdev,
  469. const struct tpm_class_ops *ops);
  470. int tpm_chip_register(struct tpm_chip *chip);
  471. void tpm_chip_unregister(struct tpm_chip *chip);
  472. void tpm_sysfs_add_device(struct tpm_chip *chip);
  473. int tpm_pcr_read_dev(struct tpm_chip *chip, int pcr_idx, u8 *res_buf);
  474. #ifdef CONFIG_ACPI
  475. extern void tpm_add_ppi(struct tpm_chip *chip);
  476. #else
  477. static inline void tpm_add_ppi(struct tpm_chip *chip)
  478. {
  479. }
  480. #endif
  481. static inline u32 tpm2_rc_value(u32 rc)
  482. {
  483. return (rc & BIT(7)) ? rc & 0xff : rc;
  484. }
  485. int tpm2_pcr_read(struct tpm_chip *chip, int pcr_idx, u8 *res_buf);
  486. int tpm2_pcr_extend(struct tpm_chip *chip, int pcr_idx, u32 count,
  487. struct tpm2_digest *digests);
  488. int tpm2_get_random(struct tpm_chip *chip, u8 *dest, size_t max);
  489. void tpm2_flush_context_cmd(struct tpm_chip *chip, u32 handle,
  490. unsigned int flags);
  491. int tpm2_seal_trusted(struct tpm_chip *chip,
  492. struct trusted_key_payload *payload,
  493. struct trusted_key_options *options);
  494. int tpm2_unseal_trusted(struct tpm_chip *chip,
  495. struct trusted_key_payload *payload,
  496. struct trusted_key_options *options);
  497. ssize_t tpm2_get_tpm_pt(struct tpm_chip *chip, u32 property_id,
  498. u32 *value, const char *desc);
  499. int tpm2_auto_startup(struct tpm_chip *chip);
  500. void tpm2_shutdown(struct tpm_chip *chip, u16 shutdown_type);
  501. unsigned long tpm2_calc_ordinal_duration(struct tpm_chip *chip, u32 ordinal);
  502. int tpm2_probe(struct tpm_chip *chip);
  503. int tpm2_find_cc(struct tpm_chip *chip, u32 cc);
  504. int tpm2_init_space(struct tpm_space *space);
  505. void tpm2_del_space(struct tpm_chip *chip, struct tpm_space *space);
  506. int tpm2_prepare_space(struct tpm_chip *chip, struct tpm_space *space, u32 cc,
  507. u8 *cmd);
  508. int tpm2_commit_space(struct tpm_chip *chip, struct tpm_space *space,
  509. u32 cc, u8 *buf, size_t *bufsiz);
  510. int tpm_bios_log_setup(struct tpm_chip *chip);
  511. void tpm_bios_log_teardown(struct tpm_chip *chip);
  512. #endif