Tss2_TctiLdr_Initialize.3.in 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. .\" Process this file with
  2. .\" groff -man -Tascii foo.1
  3. .\"
  4. .TH Tss2_TctiLdr_Initialize 3 "MARCH 2019" "TPM2 Software Stack"
  5. .SH NAME
  6. Tss2_TctiLdr_Initialize, Tss2_TctiLdr_Initialize_Ex \- Instantiate and
  7. initialize a TCTI context.
  8. .SH SYNOPSIS
  9. .B #include <tss2/tss2_tctildr.h>
  10. .sp
  11. .sp
  12. .BI "TSS2_RC Tss2_TctiLdr_Initialize (const char " "*nameConf" ", TSS2_TCTI_CONTEXT " "**context" ");"
  13. .sp
  14. .BI "TSS2_RC Tss2_TctiLdr_Initialize_Ex (const char " "*name" ", const char " "*conf" ", TSS2_TCTI_CONTEXT " "**context" ");"
  15. .sp
  16. .SH DESCRIPTION
  17. The
  18. .BR Tss2_TctiLdr_Initialize ()
  19. and
  20. .BR Tss2_TctiLdr_Initialize_Ex ()
  21. functions initialize a TCTI context used to communicate with the TPM2 or
  22. some intermediate component in the TCG TPM2 software stack.
  23. .sp
  24. .BR Tss2_TctiLdr_Initialize ()
  25. takes a single string that encodes both the name of the TCTI library the
  26. caller wishes to instantiate and its desired configuration in the
  27. .I nameConf
  28. parameter.
  29. .I nameConf
  30. is a string comprised of two substrings:
  31. .I name
  32. and
  33. .I conf
  34. parameters respectively.
  35. These substrings are combined with
  36. .I name
  37. first, separated by a single ':' / colon character: 'name:conf'. Consult
  38. the section titled TCTI CONFIG for information about the encoding of these
  39. strings.
  40. The
  41. .I context
  42. parameter is used to return a reference to the TCTI context created by
  43. the function.
  44. .sp
  45. .BR Tss2_TctiLdr_Initialize_Ex ()
  46. behaves identically to the
  47. .BR Tss2_TctiLdr_Initialize ()
  48. function with the exception that the TCTI name and configuration are passed
  49. as separate strings. The encoding of these strings is described in section
  50. TCTI_CONFIG.
  51. .SH TCTI CONFIG
  52. If the
  53. .I name
  54. string is NULL or the emptry string then the initialization functions will
  55. select a default TCTI appropriate for the platform. On Linux this means
  56. first trying to load a library named
  57. .I libtss2-tcti-default.so.
  58. This is a placeholder for distros to provide a distro specific default. It
  59. is recommended that this be a symlink to another installed TCTI library.
  60. If attempts to load this shared object fails the implementation will
  61. attempt known TCTIs in the following order:
  62. .IP \[bu] 2
  63. libtss2-tcti-tabrmd.so.0
  64. .IP \[bu]
  65. libtss2-tcti-device.so.0
  66. .IP \[bu]
  67. libtss2-tcti-mssim.so.0
  68. .LP
  69. When the
  70. .I name
  71. string is neither NULL nor the empty string the implementation will attempt
  72. to
  73. .I dlopen
  74. a library with the given name. If this fails then the implementation assumes
  75. it has been passed a shortened name and will attempt to load libraries by
  76. name with the following permutations:
  77. .IP \[bu] 2
  78. <name>
  79. .IP \[bu]
  80. libtss2-tcti-<name>.so.0
  81. .IP \[bu]
  82. libtss2-tcti-<name>.so
  83. .LP
  84. The
  85. .I config
  86. string is not interpreted by the TctiLdr init functions and is passed
  87. unaltered to the initialization function for the selected TCTI. The
  88. format for this string is TCTI specific.
  89. .sp
  90. The
  91. .BR Tss2_TctiLdr_Initialize
  92. function is passed the
  93. .I name
  94. and
  95. .I conf
  96. strings as a single parameter. In this case the
  97. .I name
  98. and
  99. .I conf
  100. strings are concatinated with a single ':' / colon character separating them.
  101. .sp
  102. For a more thorough discussion of the TCTILDR API see the \*(lqTCG TSS 2.0 TPM Command
  103. Transmission Interface (TCTI) API Specification\*(rq.
  104. .SH RETURN VALUE
  105. A successful call to this function will return
  106. .B TSS2_RC_SUCCESS.
  107. An unsuccessful call will produce a response code described in section
  108. .B ERRORS.
  109. .SH ERRORS
  110. .B TSS2_TCTI_RC_MEMORY
  111. is returned if memory allocation fails
  112. .sp
  113. .B TSS2_TCTI_RC_NOT_SUPPORTED
  114. is returned when the loader is unable to locate a TCTI library with the
  115. provided
  116. .I name
  117. .sp
  118. .B TSS2_TCTI_RC_IO_ERROR
  119. is returned if a failure occurs in the underlying library loading mechanism
  120. .sp
  121. .B TSS2_TCTI_RC_BAD_REFERENCE
  122. is returned if the
  123. .I tctiContext
  124. parameter is NULL
  125. .sp
  126. .SH EXAMPLE
  127. Example code.
  128. .sp
  129. .nf
  130. #include <inttypes.h>
  131. #include <stdlib.h>
  132. #include <stdio.h>
  133. #include <tss2/tss2_tctildr.h>
  134. TSS2_TCTI_CONTEXT *ctx = NULL;
  135. TSS2_RC rc = Tss2_TctiLdr_Initialize (NULL, &ctx);
  136. if (rc != TSS2_RC_SUCCESS) {
  137. fprintf (stderr, "Initialization of default TCTI context failed with "
  138. "response code: 0x%" PRIx32 "\n", rc);
  139. exit (EXIT_FAILURE);
  140. }
  141. exit (EXIT_SUCCESS);
  142. .fi