tis.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright (c) 2011 The Chromium OS Authors.
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #ifndef __TIS_H
  7. #define __TIS_H
  8. #include <common.h>
  9. /* Low-level interface to access TPM */
  10. /*
  11. * tis_init()
  12. *
  13. * Initialize the TPM device. Returns 0 on success or -1 on
  14. * failure (in case device probing did not succeed).
  15. */
  16. int tis_init(void);
  17. /*
  18. * tis_open()
  19. *
  20. * Requests access to locality 0 for the caller. After all commands have been
  21. * completed the caller is supposed to call tis_close().
  22. *
  23. * Returns 0 on success, -1 on failure.
  24. */
  25. int tis_open(void);
  26. /*
  27. * tis_close()
  28. *
  29. * terminate the currect session with the TPM by releasing the locked
  30. * locality. Returns 0 on success of -1 on failure (in case lock
  31. * removal did not succeed).
  32. */
  33. int tis_close(void);
  34. /*
  35. * tis_sendrecv()
  36. *
  37. * Send the requested data to the TPM and then try to get its response
  38. *
  39. * @sendbuf - buffer of the data to send
  40. * @send_size size of the data to send
  41. * @recvbuf - memory to save the response to
  42. * @recv_len - pointer to the size of the response buffer
  43. *
  44. * Returns 0 on success (and places the number of response bytes at recv_len)
  45. * or -1 on failure.
  46. */
  47. int tis_sendrecv(const uint8_t *sendbuf, size_t send_size, uint8_t *recvbuf,
  48. size_t *recv_len);
  49. #endif /* __TIS_H */