ifapi_policy_callbacks.3 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  1. .TH "ifapi_policy_callbacks" 3 "Fri Oct 7 2022" "Version 3.2.0" "tpm2-tss" \" -*- nroff -*-
  2. .ad l
  3. .nh
  4. .SH NAME
  5. ifapi_policy_callbacks
  6. .SH SYNOPSIS
  7. .br
  8. .PP
  9. .SS "Functions"
  10. .in +1c
  11. .ti -1c
  12. .RI "TSS2_RC \fBifapi_branch_selection\fP (\fBTPML_POLICYBRANCHES\fP *branches, size_t *branch_idx, void *userdata)"
  13. .br
  14. .ti -1c
  15. .RI "TSS2_RC \fBifapi_exec_auth_nv_policy\fP (TPM2B_NV_PUBLIC *nv_public, TPMI_ALG_HASH hash_alg, void *userdata)"
  16. .br
  17. .ti -1c
  18. .RI "TSS2_RC \fBifapi_get_duplicate_name\fP (TPM2B_NAME *name, void *userdata)"
  19. .br
  20. .ti -1c
  21. .RI "TSS2_RC \fBifapi_get_key_public\fP (const char *path, TPMT_PUBLIC *public, void *ctx)"
  22. .br
  23. .ti -1c
  24. .RI "TSS2_RC \fBifapi_get_nv_public\fP (const char *path, TPM2B_NV_PUBLIC *nv_public, void *ctx)"
  25. .br
  26. .ti -1c
  27. .RI "TSS2_RC \fBifapi_get_object_name\fP (const char *path, TPM2B_NAME *name, void *ctx)"
  28. .br
  29. .ti -1c
  30. .RI "TSS2_RC \fBifapi_policy_action\fP (const char *action, void *userdata)"
  31. .br
  32. .ti -1c
  33. .RI "TSS2_RC \fBifapi_policyeval_cbauth\fP (TPM2B_NAME *name, \fBESYS_TR\fP *object_handle, \fBESYS_TR\fP *auth_handle, \fBESYS_TR\fP *authSession, void *userdata)"
  34. .br
  35. .ti -1c
  36. .RI "TSS2_RC \fBifapi_read_pcr\fP (TPMS_PCR_SELECT *pcr_select, TPML_PCR_SELECTION *pcr_selection, \fBTPML_PCRVALUES\fP **pcr_values, void *ctx)"
  37. .br
  38. .in -1c
  39. .SH "Detailed Description"
  40. .PP
  41. Provides internal callbacks functions for policy execution\&.
  42. .SH "Function Documentation"
  43. .PP
  44. .SS "TSS2_RC ifapi_branch_selection (\fBTPML_POLICYBRANCHES\fP * branches, size_t * branch_idx, void * userdata)"
  45. Callback for branch selection of policy or\&.
  46. .PP
  47. \fBParameters:\fP
  48. .RS 4
  49. \fIbranches\fP The list of policy branches\&.
  50. .br
  51. \fIbranch_idx\fP The index of the selcted branch\&.
  52. .br
  53. \fIuserdata\fP The Fapi context which will be used for keystore access, and storing the policy execution state\&. the io state\&.
  54. .RE
  55. .PP
  56. \fBReturn values:\fP
  57. .RS 4
  58. \fITSS2_RC_SUCCESS\fP on success\&.
  59. .br
  60. \fITSS2_FAPI_RC_BAD_REFERENCE\fP if context is NULL\&.
  61. .br
  62. \fITSS2_FAPI_RC_AUTHORIZATION_UNKNOWN\fP if no branch selection callback is defined\&. This callback will be needed of or policies which have to be executed\&.
  63. .br
  64. \fITSS2_FAPI_RC_AUTHORIZATION_FAILED\fP if the computed branch index delivered by the callback does not identify a branch\&.
  65. .RE
  66. .PP
  67. .SS "TSS2_RC ifapi_exec_auth_nv_policy (TPM2B_NV_PUBLIC * nv_public, TPMI_ALG_HASH hash_alg, void * userdata)"
  68. Callback for executing a policy identified by a digest stored in a nv object\&.
  69. .PP
  70. \fBParameters:\fP
  71. .RS 4
  72. \fInv_public\fP the public data of the nv object which stores the digest of the authorized policy\&.
  73. .br
  74. \fIhash_alg\fP The hash algorithm used for policy computation\&.
  75. .br
  76. \fIuserdata\fP The user context to retrieve the policy\&.
  77. .RE
  78. .PP
  79. \fBReturn values:\fP
  80. .RS 4
  81. \fITSS2_RC_SUCCESS\fP on success\&.
  82. .br
  83. \fITSS2_FAPI_RC_MEMORY\fP if it's not possible to allocate enough memory\&.
  84. .br
  85. \fITSS2_FAPI_RC_BAD_REFERENCE\fP If no user data id passed or context stack is not initialized\&.
  86. .br
  87. \fITSS2_FAPI_RC_IO_ERROR\fP If an error occurs during access to the policy store\&.
  88. .br
  89. \fITSS2_FAPI_RC_PATH_NOT_FOUND\fP If a policy for a certain path was not found\&.
  90. .br
  91. \fITSS2_FAPI_RC_POLICY_UNKNOWN\fP If policy search for a certain policy digest was not successful\&.
  92. .br
  93. \fITPM2_RC_BAD_AUTH\fP If the authentication for an object needed for policy execution fails\&.
  94. .br
  95. \fITSS2_FAPI_RC_BAD_VALUE\fP if an invalid value was passed into the function\&.
  96. .br
  97. \fITSS2_FAPI_RC_TRY_AGAIN\fP if an I/O operation is not finished yet and this function needs to be called again\&.
  98. .br
  99. \fITSS2_FAPI_RC_BAD_SEQUENCE\fP if the context has an asynchronous operation already pending\&.
  100. .br
  101. \fITSS2_FAPI_RC_KEY_NOT_FOUND\fP if a key was not found\&.
  102. .br
  103. \fITSS2_FAPI_RC_GENERAL_FAILURE\fP if an internal error occurred\&.
  104. .br
  105. \fITSS2_FAPI_RC_AUTHORIZATION_UNKNOWN\fP if a required authorization callback is not set\&.
  106. .br
  107. \fITSS2_FAPI_RC_AUTHORIZATION_FAILED\fP if the authorization attempt fails\&.
  108. .br
  109. \fITSS2_ESYS_RC_*\fP possible error codes of ESAPI\&.
  110. .br
  111. \fITSS2_FAPI_RC_BAD_PATH\fP if the path is used in inappropriate context or contains illegal characters\&.
  112. .br
  113. \fITSS2_FAPI_RC_NOT_PROVISIONED\fP FAPI was not provisioned\&.
  114. .RE
  115. .PP
  116. .SS "TSS2_RC ifapi_get_duplicate_name (TPM2B_NAME * name, void * userdata)"
  117. Callback for getting the name of a key to be duplicated\&.
  118. .PP
  119. \fBParameters:\fP
  120. .RS 4
  121. \fIname\fP the name of the object to be duplicated\&.
  122. .br
  123. \fIuserdata\fP The user context to retrieve the key\&.
  124. .RE
  125. .PP
  126. \fBReturn values:\fP
  127. .RS 4
  128. \fITSS2_RC_SUCCESS\fP on success\&.
  129. .br
  130. \fITSS2_FAPI_RC_BAD_REFERENCE\fP if the context is not passed or the object to be duplicated is not set\&.
  131. .RE
  132. .PP
  133. .SS "TSS2_RC ifapi_get_key_public (const char * path, TPMT_PUBLIC * public, void * ctx)"
  134. Get public data of a key from keystore\&.
  135. .PP
  136. \fBParameters:\fP
  137. .RS 4
  138. \fIpath\fP The relative path of the key\&.
  139. .br
  140. \fIpublic\fP The caller allocated public structure\&.
  141. .br
  142. \fIctx\fP The context to access io and keystore module and to store the io state\&.
  143. .RE
  144. .PP
  145. \fBReturn values:\fP
  146. .RS 4
  147. \fITSS2_RC_SUCCESS\fP on success\&.
  148. .br
  149. \fITSS2_FAPI_RC_IO_ERROR\fP if the data cannot be loaded\&.
  150. .br
  151. \fITSS2_FAPI_RC_MEMORY\fP if the FAPI cannot allocate enough memory for internal operations or return parameters\&.
  152. .br
  153. \fITSS2_FAPI_RC_BAD_TEMPLATE\fP If the loaded template is not appropriate for this operation\&.
  154. .br
  155. \fITSS2_FAPI_RC_BAD_VALUE\fP if an invalid value was passed into the function\&.
  156. .br
  157. \fITSS2_FAPI_RC_TRY_AGAIN\fP if an I/O operation is not finished yet and this function needs to be called again\&.
  158. .br
  159. \fITSS2_FAPI_RC_BAD_SEQUENCE\fP if the context has an asynchronous operation already pending\&.
  160. .br
  161. \fITSS2_FAPI_RC_PATH_NOT_FOUND\fP if a FAPI object path was not found during authorization\&.
  162. .br
  163. \fITSS2_FAPI_RC_KEY_NOT_FOUND\fP if a key was not found\&.
  164. .br
  165. \fITSS2_FAPI_RC_GENERAL_FAILURE\fP if an internal error occurred\&.
  166. .br
  167. \fITSS2_FAPI_RC_BAD_REFERENCE\fP a invalid null pointer is passed\&.
  168. .br
  169. \fITSS2_FAPI_RC_NOT_PROVISIONED\fP FAPI was not provisioned\&.
  170. .br
  171. \fITSS2_FAPI_RC_BAD_PATH\fP if the path is used in inappropriate context or contains illegal characters\&.
  172. .RE
  173. .PP
  174. .SS "TSS2_RC ifapi_get_nv_public (const char * path, TPM2B_NV_PUBLIC * nv_public, void * ctx)"
  175. Get public data of a NV object from keystore\&.
  176. .PP
  177. \fBParameters:\fP
  178. .RS 4
  179. \fIpath\fP The relative path of the NV object\&.
  180. .br
  181. \fInv_public\fP The caller allocated public structure\&.
  182. .br
  183. \fIctx\fP The context to access io and keystore module and to store the io state\&.
  184. .RE
  185. .PP
  186. \fBReturn values:\fP
  187. .RS 4
  188. \fITSS2_RC_SUCCESS\fP on success\&.
  189. .br
  190. \fITSS2_FAPI_RC_IO_ERROR\fP if the data cannot be loaded\&.
  191. .br
  192. \fITSS2_FAPI_RC_MEMORY\fP if the FAPI cannot allocate enough memory for internal operations or return parameters\&.
  193. .br
  194. \fITSS2_FAPI_RC_BAD_TEMPLATE\fP If the loaded template is not appropriate for this operation\&.
  195. .br
  196. \fITSS2_FAPI_RC_BAD_VALUE\fP if an invalid value was passed into the function\&.
  197. .br
  198. \fITSS2_FAPI_RC_TRY_AGAIN\fP if an I/O operation is not finished yet and this function needs to be called again\&.
  199. .br
  200. \fITSS2_FAPI_RC_BAD_SEQUENCE\fP if the context has an asynchronous operation already pending\&.
  201. .br
  202. \fITSS2_FAPI_RC_PATH_NOT_FOUND\fP if a FAPI object path was not found during authorization\&.
  203. .br
  204. \fITSS2_FAPI_RC_KEY_NOT_FOUND\fP if a key was not found\&.
  205. .br
  206. \fITSS2_FAPI_RC_GENERAL_FAILURE\fP if an internal error occurred\&.
  207. .br
  208. \fITSS2_FAPI_RC_BAD_REFERENCE\fP a invalid null pointer is passed\&.
  209. .br
  210. \fITSS2_FAPI_RC_NOT_PROVISIONED\fP FAPI was not provisioned\&.
  211. .br
  212. \fITSS2_FAPI_RC_BAD_PATH\fP if the path is used in inappropriate context or contains illegal characters\&.
  213. .RE
  214. .PP
  215. .SS "TSS2_RC ifapi_get_object_name (const char * path, TPM2B_NAME * name, void * ctx)"
  216. Get TPM name of an object from key keystore\&.
  217. .PP
  218. \fBParameters:\fP
  219. .RS 4
  220. \fIpath\fP The relative path of the object\&.
  221. .br
  222. \fIname\fP The caller allocate public structure\&.
  223. .br
  224. \fIctx\fP The context to access io and keystore module and to store the io state\&.
  225. .RE
  226. .PP
  227. \fBReturn values:\fP
  228. .RS 4
  229. \fITSS2_RC_SUCCESS\fP on success\&.
  230. .br
  231. \fITSS2_FAPI_RC_IO_ERROR\fP if the data cannot be loaded\&.
  232. .br
  233. \fITSS2_FAPI_RC_MEMORY\fP if the FAPI cannot allocate enough memory for internal operations or return parameters\&.
  234. .br
  235. \fITSS2_FAPI_RC_BAD_TEMPLATE\fP If the loaded template is not appropriate for this operation\&.
  236. .br
  237. \fITSS2_FAPI_RC_BAD_VALUE\fP if an invalid value was passed into the function\&.
  238. .br
  239. \fITSS2_FAPI_RC_TRY_AGAIN\fP if an I/O operation is not finished yet and this function needs to be called again\&.
  240. .br
  241. \fITSS2_FAPI_RC_BAD_SEQUENCE\fP if the context has an asynchronous operation already pending\&.
  242. .br
  243. \fITSS2_FAPI_RC_PATH_NOT_FOUND\fP if a FAPI object path was not found during authorization\&.
  244. .br
  245. \fITSS2_FAPI_RC_KEY_NOT_FOUND\fP if a key was not found\&.
  246. .br
  247. \fITSS2_FAPI_RC_GENERAL_FAILURE\fP if an internal error occurred\&.
  248. .br
  249. \fITSS2_FAPI_RC_BAD_REFERENCE\fP a invalid null pointer is passed\&.
  250. .br
  251. \fITSS2_FAPI_RC_NOT_PROVISIONED\fP FAPI was not provisioned\&.
  252. .br
  253. \fITSS2_FAPI_RC_BAD_PATH\fP if the path is used in inappropriate context or contains illegal characters\&.
  254. .RE
  255. .PP
  256. .SS "TSS2_RC ifapi_policy_action (const char * action, void * userdata)"
  257. Callback for policy action\&.
  258. .PP
  259. \fBParameters:\fP
  260. .RS 4
  261. \fIaction\fP The name of the policy action\&.
  262. .br
  263. \fIuserdata\fP The Fapi context which will be used for keystore access, and storing the policy execution state\&. the io state\&.
  264. .RE
  265. .PP
  266. \fBReturn values:\fP
  267. .RS 4
  268. \fITSS2_RC_SUCCESS\fP on success\&.
  269. .br
  270. \fITSS2_FAPI_RC_AUTHORIZATION_UNKNOWN\fP If the callback for branch selection is not defined\&. This callback will be needed of or policies have to be executed\&.
  271. .br
  272. \fITSS2_FAPI_RC_BAD_REFERENCE\fP If no user data is passed\&.
  273. .RE
  274. .PP
  275. .SS "TSS2_RC ifapi_policyeval_cbauth (TPM2B_NAME * name, \fBESYS_TR\fP * object_handle, \fBESYS_TR\fP * auth_handle, \fBESYS_TR\fP * authSession, void * userdata)"
  276. Callback for authorization of objects used by policy\&.
  277. .PP
  278. \fBParameters:\fP
  279. .RS 4
  280. \fIname\fP The name of the object to be authorized\&.
  281. .br
  282. \fIobject_handle\fP The ESYS handle of the used object\&.
  283. .br
  284. \fIauth_handle\fP will be used for object authorization\&. For keys it will we equal to the object handle\&.
  285. .br
  286. \fIauthSession\fP The session used for object authorization\&.
  287. .br
  288. \fIuserdata\fP The Fapi context which will be used for keystore access, and storing the policy execution state\&. the io state\&.
  289. .RE
  290. .PP
  291. \fBReturn values:\fP
  292. .RS 4
  293. \fITSS2_RC_SUCCESS\fP on success\&.
  294. .br
  295. \fITSS2_FAPI_RC_BAD_REFERENCE\fP if context or policy is NULL\&.
  296. .br
  297. \fITSS2_FAPI_RC_MEMORY\fP if memory allocation failed\&.
  298. .br
  299. \fITSS2_FAPI_RC_TRY_AGAIN\fP if the asynchronous operation is not yet complete\&. Call this function again later\&.
  300. .br
  301. \fITSS2_FAPI_RC_BAD_SEQUENCE\fP if the context has an asynchronous operation already pending\&.
  302. .br
  303. \fITSS2_FAPI_RC_PATH_NOT_FOUND\fP If a policy was not found\&.
  304. .br
  305. \fITSS2_FAPI_RC_KEY_NOT_FOUND\fP If a key was not found\&.
  306. .br
  307. \fITSS2_FAPI_RC_IO_ERROR\fP If an IO error occurred during reading a policy or a key\&.
  308. .br
  309. \fITSS2_FAPI_RC_GENERAL_FAILURE\fP If an error in an used library occurred\&.
  310. .br
  311. \fITSS2_FAPI_RC_BAD_VALUE\fP if an invalid value was passed into the function\&.
  312. .br
  313. \fITSS2_FAPI_RC_AUTHORIZATION_UNKNOWN\fP if a required authorization callback is not set\&.
  314. .br
  315. \fITSS2_FAPI_RC_AUTHORIZATION_FAILED\fP if the authorization attempt fails\&.
  316. .br
  317. \fITSS2_FAPI_RC_POLICY_UNKNOWN\fP if policy search for a certain policy digest was not successful\&.
  318. .br
  319. \fITSS2_ESYS_RC_*\fP possible error codes of ESAPI\&.
  320. .br
  321. \fITSS2_FAPI_RC_BAD_PATH\fP if the path is used in inappropriate context or contains illegal characters\&.
  322. .br
  323. \fITSS2_FAPI_RC_NOT_PROVISIONED\fP FAPI was not provisioned\&.
  324. .RE
  325. .PP
  326. .SS "TSS2_RC ifapi_read_pcr (TPMS_PCR_SELECT * pcr_select, TPML_PCR_SELECTION * pcr_selection, \fBTPML_PCRVALUES\fP ** pcr_values, void * ctx)"
  327. Read values of PCR registers and clear selection\&.
  328. .PP
  329. \fBParameters:\fP
  330. .RS 4
  331. \fIpcr_select\fP The registers to be read (bank selection from profile)\&.
  332. .br
  333. \fIpcr_selection\fP The registers to be read (with bank selection)\&.
  334. .br
  335. \fIpcr_values\fP The callee-allocated public structure\&.
  336. .br
  337. \fIctx\fP The context to access io and keystore module and to store the io state\&.
  338. .RE
  339. .PP
  340. \fBReturn values:\fP
  341. .RS 4
  342. \fITSS2_RC_SUCCESS\fP on success\&.
  343. .br
  344. \fITSS2_FAPI_RC_BAD_VALUE\fP if the input parameters had inappropriate values\&.
  345. .br
  346. \fITSS2_FAPI_RC_TRY_AGAIN\fP if the asynchronous operation is not yet complete\&. Call this function again later\&.
  347. .br
  348. \fITSS2_FAPI_RC_MEMORY\fP if memory allocation failed\&.
  349. .br
  350. \fITSS2_FAPI_RC_BAD_SEQUENCE\fP if the context has an asynchronous operation already pending\&.
  351. .RE
  352. .PP
  353. .SH "Author"
  354. .PP
  355. Generated automatically by Doxygen for tpm2-tss from the source code\&.