ESYS_TR.3 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  1. .TH "ESYS_TR" 3 "Fri Oct 7 2022" "Version 3.2.0" "tpm2-tss" \" -*- nroff -*-
  2. .ad l
  3. .nh
  4. .SH NAME
  5. ESYS_TR
  6. .SH SYNOPSIS
  7. .br
  8. .PP
  9. .SS "Modules"
  10. .in +1c
  11. .ti -1c
  12. .RI "\fBGlobal ESYS_TR objects\fP"
  13. .br
  14. .in -1c
  15. .SS "Typedefs"
  16. .in +1c
  17. .ti -1c
  18. .RI "typedef uint32_t \fBESYS_TR\fP"
  19. .br
  20. .in -1c
  21. .SS "Functions"
  22. .in +1c
  23. .ti -1c
  24. .RI "TSS2_RC \fBEsys_TR_SetAuth\fP (\fBESYS_CONTEXT\fP *esysContext, \fBESYS_TR\fP handle, TPM2B_AUTH const *authValue)"
  25. .br
  26. .ti -1c
  27. .RI "TSS2_RC \fBEsys_TR_GetName\fP (\fBESYS_CONTEXT\fP *esysContext, \fBESYS_TR\fP handle, TPM2B_NAME **name)"
  28. .br
  29. .ti -1c
  30. .RI "TSS2_RC \fBEsys_TR_FromTPMPublic_Async\fP (\fBESYS_CONTEXT\fP *esysContext, TPM2_HANDLE tpm_handle, \fBESYS_TR\fP optionalSession1, \fBESYS_TR\fP optionalSession2, \fBESYS_TR\fP optionalSession3)"
  31. .br
  32. .ti -1c
  33. .RI "TSS2_RC \fBEsys_TR_FromTPMPublic_Finish\fP (\fBESYS_CONTEXT\fP *esysContext, \fBESYS_TR\fP *object)"
  34. .br
  35. .ti -1c
  36. .RI "TSS2_RC \fBEsys_TR_FromTPMPublic\fP (\fBESYS_CONTEXT\fP *esysContext, TPM2_HANDLE tpm_handle, \fBESYS_TR\fP optionalSession1, \fBESYS_TR\fP optionalSession2, \fBESYS_TR\fP optionalSession3, \fBESYS_TR\fP *object)"
  37. .br
  38. .ti -1c
  39. .RI "TSS2_RC \fBEsys_TR_Serialize\fP (\fBESYS_CONTEXT\fP *esys_context, \fBESYS_TR\fP object, uint8_t **buffer, size_t *buffer_size)"
  40. .br
  41. .ti -1c
  42. .RI "TSS2_RC \fBEsys_TR_Deserialize\fP (\fBESYS_CONTEXT\fP *esys_context, uint8_t const *buffer, size_t buffer_size, \fBESYS_TR\fP *esys_handle)"
  43. .br
  44. .ti -1c
  45. .RI "TSS2_RC \fBEsys_TR_Close\fP (\fBESYS_CONTEXT\fP *esys_context, \fBESYS_TR\fP *rsrc_handle)"
  46. .br
  47. .ti -1c
  48. .RI "TSS2_RC \fBEsys_TRSess_GetAttributes\fP (\fBESYS_CONTEXT\fP *esysContext, \fBESYS_TR\fP session, TPMA_SESSION *flags)"
  49. .br
  50. .ti -1c
  51. .RI "TSS2_RC \fBEsys_TRSess_SetAttributes\fP (\fBESYS_CONTEXT\fP *esysContext, \fBESYS_TR\fP session, TPMA_SESSION flags, TPMA_SESSION mask)"
  52. .br
  53. .in -1c
  54. .SH "Detailed Description"
  55. .PP
  56. Virtual objects with meta data for Tpm Resources\&. The Esys TPM Resources are the virtual objects inside the ESYSCONTEXT that hold the metadata for corresponding TPM Resources\&.
  57. .PP
  58. There are a set of global ESYS_TR objects such as ESYS_TR_NON or for the various PCRs and hierarchies\&. ESYS_TR_MIN_OBJECT denotes the first non-global ESYS_TR object\&.
  59. .SH "Typedef Documentation"
  60. .PP
  61. .SS "\fBESYS_TR\fP"
  62. Reference to the virtual object inside the \fBESYS_CONTEXT\fP that holds the metadata for the corresponding TPM Resource\&. Such can be Transient key, Persistent objects, NV spaces, Sessions or PCRs\&.
  63. .SH "Function Documentation"
  64. .PP
  65. .SS "TSS2_RC Esys_TR_Close (\fBESYS_CONTEXT\fP * esys_context, \fBESYS_TR\fP * object)"
  66. Close an ESYS_TR without removing it from the TPM\&.
  67. .PP
  68. This function deletes an ESYS_TR object from an \fBESYS_CONTEXT\fP without deleting it from the TPM\&. This is useful for NV-Indices or persistent keys, after Esys_TR_Serialize has been called\&. Transient objects should be deleted using Esys_FlushContext\&.
  69. .PP
  70. \fBParameters:\fP
  71. .RS 4
  72. \fIesys_context\fP [in,out] The \fBESYS_CONTEXT\fP
  73. .br
  74. \fIobject\fP [out] ESYS_TR metadata object to be deleted from \fBESYS_CONTEXT\fP\&.
  75. .RE
  76. .PP
  77. \fBReturn values:\fP
  78. .RS 4
  79. \fITSS2_RC_SUCCESS\fP on Success\&.
  80. .br
  81. \fITSS2_ESYS_RC_BAD_REFERENCE\fP if the esysContext is NULL\&.
  82. .br
  83. \fITSS2_ESYS_RC_BAD_TR\fP if the ESYS_TR object is unknown to the \fBESYS_CONTEXT\fP\&.
  84. .RE
  85. .PP
  86. .SS "TSS2_RC Esys_TR_Deserialize (\fBESYS_CONTEXT\fP * esys_context, uint8_t const * buffer, size_t buffer_size, \fBESYS_TR\fP * esys_handle)"
  87. Deserialization of an ESYS_TR from a byte buffer\&.
  88. .PP
  89. Deserialize the metadata of an ESYS_TR object from a byte buffer that was stored on disk for later use by a different program or context\&. An object can be deserialized using Esys_TR_Deserialize\&.
  90. .PP
  91. \fBParameters:\fP
  92. .RS 4
  93. \fIesys_context\fP [in,out] The \fBESYS_CONTEXT\fP\&.
  94. .br
  95. \fIesys_handle\fP [out] The ESYS_TR object to deserialize\&.
  96. .br
  97. \fIbuffer\fP [in] The buffer containing the metadata of the ESYS_TR object\&.
  98. .br
  99. \fIbuffer_size\fP [in] The size of the buffer parameter\&.
  100. .RE
  101. .PP
  102. \fBReturn values:\fP
  103. .RS 4
  104. \fITSS2_RC_SUCCESS\fP on Success\&.
  105. .br
  106. \fITSS2_ESYS_RC_MEMORY\fP if the object can not be allocated\&.
  107. .br
  108. \fITSS2_ESYS_RC_INSUFFICIENT_BUFFER\fP if the buffer for unmarshalling\&.
  109. .br
  110. \fITSS2_ESYS_RC_BAD_REFERENCE\fP if the esysContext is NULL\&.
  111. .br
  112. \fITSS2_RCs\fP produced by lower layers of the software stack\&.
  113. .RE
  114. .PP
  115. .SS "TSS2_RC Esys_TR_FromTPMPublic (\fBESYS_CONTEXT\fP * esys_context, TPM2_HANDLE tpm_handle, \fBESYS_TR\fP shandle1, \fBESYS_TR\fP shandle2, \fBESYS_TR\fP shandle3, \fBESYS_TR\fP * object)"
  116. Creation of an ESYS_TR object from TPM metadata\&.
  117. .PP
  118. This function can be used to create ESYS_TR object for Tpm Resources that are not created or loaded (e\&.g\&. using ESys_CreatePrimary or ESys_Load) but pre-exist inside the TPM\&. Examples are NV-Indices or persistent object\&.
  119. .PP
  120. Note: For PCRs and hierarchies, please use the global ESYS_TR identifiers\&. Note: If a session is provided the TPM is queried for the metadata twice\&. First without a session to retrieve some metadata then with the session where this metadata is used in the session HMAC calculation and thereby verified\&.
  121. .PP
  122. Since man in the middle attacks should be prevented as much as possible it is recommended to pass a session\&.
  123. .PP
  124. \fBParameters:\fP
  125. .RS 4
  126. \fIesys_context\fP [in,out] The \fBESYS_CONTEXT\fP
  127. .br
  128. \fItpm_handle\fP [in] The handle of the TPM object to represent as ESYS_TR\&.
  129. .br
  130. \fIshandle1\fP [in,out] A session for securing the TPM command (optional)\&.
  131. .br
  132. \fIshandle2\fP [in,out] A session for securing the TPM command (optional)\&.
  133. .br
  134. \fIshandle3\fP [in,out] A session for securing the TPM command (optional)\&.
  135. .br
  136. \fIobject\fP [out] The newly created ESYS_TR metadata object\&.
  137. .RE
  138. .PP
  139. \fBReturn values:\fP
  140. .RS 4
  141. \fITSS2_RC_SUCCESS\fP on success
  142. .br
  143. \fIESYS_RC_SUCCESS\fP if the function call was a success\&.
  144. .br
  145. \fITSS2_ESYS_RC_BAD_REFERENCE\fP if the esysContext or required input pointers or required output handle references are NULL\&.
  146. .br
  147. \fITSS2_ESYS_RC_BAD_CONTEXT\fP if esysContext corruption is detected\&.
  148. .br
  149. \fITSS2_ESYS_RC_MEMORY\fP if the ESAPI cannot allocate enough memory for internal operations or return parameters\&.
  150. .br
  151. \fITSS2_ESYS_RC_BAD_SEQUENCE\fP if the context has an asynchronous operation already pending\&.
  152. .br
  153. \fITSS2_ESYS_RC_INSUFFICIENT_RESPONSE\fP if the TPM's response does not at least contain the tag, response length, and response code\&.
  154. .br
  155. \fITSS2_ESYS_RC_MALFORMED_RESPONSE\fP if the TPM's response is corrupted\&.
  156. .br
  157. \fITSS2_ESYS_RC_MULTIPLE_DECRYPT_SESSIONS\fP if more than one session has the 'decrypt' attribute bit set\&.
  158. .br
  159. \fITSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS\fP if more than one session has the 'encrypt' attribute bit set\&.
  160. .br
  161. \fITSS2_ESYS_RC_NO_DECRYPT_PARAM\fP if one of the sessions has the 'decrypt' attribute set and the command does not support encryption of the first command parameter\&.
  162. .br
  163. \fITSS2_RCs\fP produced by lower layers of the software stack may be returned to the caller unaltered unless handled internally\&.
  164. .RE
  165. .PP
  166. .SS "TSS2_RC Esys_TR_FromTPMPublic_Async (\fBESYS_CONTEXT\fP * esys_context, TPM2_HANDLE tpm_handle, \fBESYS_TR\fP shandle1, \fBESYS_TR\fP shandle2, \fBESYS_TR\fP shandle3)"
  167. Start synchronous creation of an ESYS_TR object from TPM metadata\&.
  168. .PP
  169. This function starts the asynchronous retrieval of metadata from the TPM in order to create a new ESYS_TR object\&.
  170. .PP
  171. \fBParameters:\fP
  172. .RS 4
  173. \fIesys_context\fP [in,out] The \fBESYS_CONTEXT\fP
  174. .br
  175. \fItpm_handle\fP [in] The handle of the TPM object to represent as ESYS_TR\&.
  176. .br
  177. \fIshandle1\fP [in,out] A session for securing the TPM command (optional)\&.
  178. .br
  179. \fIshandle2\fP [in,out] A session for securing the TPM command (optional)\&.
  180. .br
  181. \fIshandle3\fP [in,out] A session for securing the TPM command (optional)\&.
  182. .RE
  183. .PP
  184. \fBReturn values:\fP
  185. .RS 4
  186. \fITSS2_RC_SUCCESS\fP on success
  187. .br
  188. \fIESYS_RC_SUCCESS\fP if the function call was a success\&.
  189. .br
  190. \fITSS2_ESYS_RC_BAD_REFERENCE\fP if the esysContext is NULL\&.
  191. .br
  192. \fITSS2_ESYS_RC_BAD_CONTEXT\fP if esysContext corruption is detected\&.
  193. .br
  194. \fITSS2_ESYS_RC_MEMORY\fP if the ESAPI cannot allocate enough memory for internal operations or return parameters\&.
  195. .br
  196. \fITSS2_ESYS_RC_MULTIPLE_DECRYPT_SESSIONS\fP if more than one session has the 'decrypt' attribute bit set\&.
  197. .br
  198. \fITSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS\fP if more than one session has the 'encrypt' attribute bit set\&.
  199. .br
  200. \fITSS2_ESYS_RC_NO_DECRYPT_PARAM\fP if one of the sessions has the 'decrypt' attribute set and the command does not support encryption of the first command parameter\&.
  201. .br
  202. \fITSS2_RCs\fP produced by lower layers of the software stack may be returned to the caller unaltered unless handled internally\&.
  203. .RE
  204. .PP
  205. .SS "TSS2_RC Esys_TR_FromTPMPublic_Finish (\fBESYS_CONTEXT\fP * esys_context, \fBESYS_TR\fP * object)"
  206. Finish asynchronous creation of an ESYS_TR object from TPM metadata\&.
  207. .PP
  208. This function finishes the asynchronous retrieval of metadata from the TPM in order to create a new ESYS_TR object\&.
  209. .PP
  210. \fBParameters:\fP
  211. .RS 4
  212. \fIesys_context\fP [in,out] The \fBESYS_CONTEXT\fP
  213. .br
  214. \fIobject\fP [out] The newly created ESYS_TR metadata object\&.
  215. .RE
  216. .PP
  217. \fBReturn values:\fP
  218. .RS 4
  219. \fITSS2_RC_SUCCESS\fP on success
  220. .br
  221. \fIESYS_RC_SUCCESS\fP if the function call was a success\&.
  222. .br
  223. \fITSS2_ESYS_RC_BAD_REFERENCE\fP if the esysContext or required input pointers or required output handle references are NULL\&.
  224. .br
  225. \fITSS2_ESYS_RC_BAD_CONTEXT\fP if esysContext corruption is detected\&.
  226. .br
  227. \fITSS2_ESYS_RC_MEMORY\fP if the ESAPI cannot allocate enough memory for internal operations or return parameters\&.
  228. .br
  229. \fITSS2_ESYS_RC_BAD_SEQUENCE\fP if the context has an asynchronous operation already pending\&.
  230. .br
  231. \fITSS2_ESYS_RC_TRY_AGAIN\fP if the timeout counter expires before the TPM response is received\&.
  232. .br
  233. \fITSS2_ESYS_RC_INSUFFICIENT_RESPONSE\fP if the TPM's response does not at least contain the tag, response length, and response code\&.
  234. .br
  235. \fITSS2_ESYS_RC_MALFORMED_RESPONSE\fP if the TPM's response is corrupted\&.
  236. .br
  237. \fITSS2_RCs\fP produced by lower layers of the software stack may be returned to the caller unaltered unless handled internally\&.
  238. .RE
  239. .PP
  240. .SS "TSS2_RC Esys_TR_GetName (\fBESYS_CONTEXT\fP * esys_context, \fBESYS_TR\fP esys_handle, TPM2B_NAME ** name)"
  241. Retrieve the TPM public name of an Esys_TR object\&.
  242. .PP
  243. Some operations (i\&.e\&. Esys_PolicyNameHash) require the name of a TPM object to be passed\&. Esys_TR_GetName provides this name to the caller\&.
  244. .PP
  245. \fBParameters:\fP
  246. .RS 4
  247. \fIesys_context\fP [in,out] The \fBESYS_CONTEXT\fP\&.
  248. .br
  249. \fIesys_handle\fP [in,out] The ESYS_TR for which to retrieve the name\&.
  250. .br
  251. \fIname\fP [out] The name of the object (caller-allocated; use free())\&.
  252. .RE
  253. .PP
  254. \fBReturn values:\fP
  255. .RS 4
  256. \fITSS2_RC_SUCCESS\fP on Success\&.
  257. .br
  258. \fITSS2_ESYS_RC_MEMORY\fP if needed memory can't be allocated\&.
  259. .br
  260. \fITSS2_ESYS_RC_GENERAL_FAILURE\fP for errors of the crypto library\&.
  261. .br
  262. \fITSS2_ESYS_RC_BAD_REFERENCE\fP if the esysContext is NULL\&.
  263. .br
  264. \fITSS2_ESYS_RC_BAD_TR\fP if the handle is invalid\&.
  265. .br
  266. \fITSS2_SYS_RC_*\fP for SAPI errors\&.
  267. .RE
  268. .PP
  269. .SS "TSS2_RC Esys_TR_Serialize (\fBESYS_CONTEXT\fP * esys_context, \fBESYS_TR\fP esys_handle, uint8_t ** buffer, size_t * buffer_size)"
  270. Serialization of an ESYS_TR into a byte buffer\&.
  271. .PP
  272. Serialize the metadata of an ESYS_TR object into a byte buffer such that it can be stored on disk for later use by a different program or context\&. The serialized object can be deserialized suing Esys_TR_Deserialize\&.
  273. .PP
  274. \fBParameters:\fP
  275. .RS 4
  276. \fIesys_context\fP [in,out] The \fBESYS_CONTEXT\fP\&.
  277. .br
  278. \fIesys_handle\fP [in] The ESYS_TR object to serialize\&.
  279. .br
  280. \fIbuffer\fP [out] The buffer containing the serialized metadata\&. (caller-callocated) Shall be freed using free()\&.
  281. .br
  282. \fIbuffer_size\fP [out] The size of the buffer parameter\&.
  283. .RE
  284. .PP
  285. \fBReturn values:\fP
  286. .RS 4
  287. \fITSS2_RC_SUCCESS\fP on Success\&.
  288. .br
  289. \fITSS2_ESYS_RC_BAD_TR\fP if the ESYS_TR object is unknown to the \fBESYS_CONTEXT\fP\&.
  290. .br
  291. \fITSS2_ESYS_RC_MEMORY\fP if the buffer for marshaling the object can't be allocated\&.
  292. .br
  293. \fITSS2_ESYS_RC_BAD_VALUE\fP For invalid ESYS data to be marshaled\&.
  294. .br
  295. \fITSS2_RCs\fP produced by lower layers of the software stack\&.
  296. .RE
  297. .PP
  298. .SS "TSS2_RC Esys_TR_SetAuth (\fBESYS_CONTEXT\fP * esys_context, \fBESYS_TR\fP esys_handle, TPM2B_AUTH const * authValue)"
  299. Set the authorization value of an ESYS_TR\&.
  300. .PP
  301. Authorization values are associated with ESYS_TR Tpm Resource object\&. They are then picked up whenever an authorization is needed\&.
  302. .PP
  303. Note: The authorization value is not stored in the metadata during Esys_TR_Serialize\&. Therefor Esys_TR_SetAuth needs to be called again after every Esys_TR_Deserialize\&.
  304. .PP
  305. \fBParameters:\fP
  306. .RS 4
  307. \fIesys_context\fP [in,out] The \fBESYS_CONTEXT\fP\&.
  308. .br
  309. \fIesys_handle\fP [in,out] The ESYS_TR for which to set the auth value\&.
  310. .br
  311. \fIauthValue\fP [in] The auth value to set for the ESYS_TR or NULL to zero the auth\&.
  312. .RE
  313. .PP
  314. \fBReturn values:\fP
  315. .RS 4
  316. \fITSS2_RC_SUCCESS\fP on Success\&.
  317. .br
  318. \fITSS2_ESYS_RC_BAD_REFERENCE\fP if the esysContext is NULL\&.
  319. .br
  320. \fITSS2_ESYS_RC_BAD_TR\fP if the ESYS_TR object is unknown to the \fBESYS_CONTEXT\fP\&.
  321. .RE
  322. .PP
  323. .SS "TSS2_RC Esys_TRSess_GetAttributes (\fBESYS_CONTEXT\fP * esys_context, \fBESYS_TR\fP esys_handle, TPMA_SESSION * flags)"
  324. Retrieve the Session Attributes of the ESYS_TR session\&.
  325. .PP
  326. Sessions possess attributes, such as whether they shall continue of be flushed after the next command, or whether they are used to encrypt parameters\&. Note: this function only applies to ESYS_TR objects that represent sessions\&.
  327. .PP
  328. \fBParameters:\fP
  329. .RS 4
  330. \fIesys_context\fP [in,out] The \fBESYS_CONTEXT\fP\&.
  331. .br
  332. \fIesys_handle\fP [in,out] The ESYS_TR of the session\&.
  333. .br
  334. \fIflags\fP [out] The attributes of the session\&.
  335. .RE
  336. .PP
  337. \fBReturn values:\fP
  338. .RS 4
  339. \fITSS2_ESYS_RC_BAD_REFERENCE\fP if the esysContext is NULL\&.
  340. .br
  341. \fITSS2_ESYS_RC_BAD_TR\fP if the ESYS_TR object is unknown to the \fBESYS_CONTEXT\fP or ESYS_TR object is not a session object\&.
  342. .RE
  343. .PP
  344. .SS "TSS2_RC Esys_TRSess_SetAttributes (\fBESYS_CONTEXT\fP * esys_context, \fBESYS_TR\fP esys_handle, TPMA_SESSION flags, TPMA_SESSION mask)"
  345. Set session attributes
  346. .PP
  347. Set or unset a session's attributes according to the provided flags and mask\&.
  348. .PP
  349. .nf
  350. new_attributes = old_attributes & ~mask | flags & mask
  351. .fi
  352. .PP
  353. Note: this function only applies to ESYS_TR objects that represent sessions\&.
  354. .PP
  355. \fBParameters:\fP
  356. .RS 4
  357. \fIesys_context\fP [in,out] The \fBESYS_CONTEXT\fP\&.
  358. .br
  359. \fIesys_handle\fP [in,out] The ESYS_TR of the session\&.
  360. .br
  361. \fIflags\fP [in] The flags to be set or unset for the session\&.
  362. .br
  363. \fImask\fP [in] The mask for the flags to be set or unset\&.
  364. .RE
  365. .PP
  366. \fBReturn values:\fP
  367. .RS 4
  368. \fITSS2_RC_SUCCESS\fP on Success\&.
  369. .br
  370. \fITSS2_ESYS_RC_BAD_REFERENCE\fP if the esysContext is NULL\&.
  371. .br
  372. \fITSS2_ESYS_RC_BAD_TR\fP if the ESYS_TR object is unknown to the \fBESYS_CONTEXT\fP or ESYS_TR object is not a session object\&.
  373. .RE
  374. .PP
  375. .SH "Author"
  376. .PP
  377. Generated automatically by Doxygen for tpm2-tss from the source code\&.