tpm2_policyauthorizenv.1 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. .\" Automatically generated by Pandoc 1.19.2.4
  2. .\"
  3. .TH "tpm2_policyauthorizenv" "1" "" "tpm2\-tools" "General Commands Manual"
  4. .hy
  5. .SH NAME
  6. .PP
  7. \f[B]tpm2_policyauthorizenv\f[](1) \- Allows for mutable policies by
  8. referencing to a policy from an NV index.
  9. .SH SYNOPSIS
  10. .PP
  11. \f[B]tpm2_policyauthorizenv\f[] [\f[I]OPTIONS\f[]] [\f[I]ARGUMENT\f[]]
  12. .SH DESCRIPTION
  13. .PP
  14. \f[B]tpm2_policyauthorizenv\f[](1) \- This command allows for policies
  15. to change by referencing the authorization policy written to an NV
  16. index.
  17. The NV index containing the authorization policy should remain readable
  18. even for trial session.
  19. The index can be specified as raw handle or an offset value to the nv
  20. handle range "TPM2_HR_NV_INDEX".
  21. .SH OPTIONS
  22. .IP \[bu] 2
  23. \f[B]\-C\f[], \f[B]\-\-hierarchy\f[]=\f[I]OBJECT\f[]:
  24. .RS 2
  25. Specifies the hierarchy used to authorize.
  26. Supported options are:
  27. .IP \[bu] 2
  28. \f[B]o\f[] for \f[B]TPM_RH_OWNER\f[]
  29. .IP \[bu] 2
  30. \f[B]p\f[] for \f[B]TPM_RH_PLATFORM\f[]
  31. .IP \[bu] 2
  32. \f[B]\f[C]<num>\f[]\f[] where a hierarchy handle or nv\-index may be
  33. used.
  34. .PP
  35. When \f[B]\-C\f[] isn\[aq]t explicitly passed the index handle will be
  36. used to authorize against the index.
  37. The index auth value is set via the \f[B]\-p\f[] option to
  38. \f[B]tpm2_nvdefine\f[](1).
  39. .RE
  40. .IP \[bu] 2
  41. \f[B]\-P\f[], \f[B]\-\-auth\f[]=\f[I]AUTH\f[]:
  42. .RS 2
  43. .PP
  44. Specifies the authorization value for the hierarchy.
  45. .RE
  46. .IP \[bu] 2
  47. \f[B]\-L\f[], \f[B]\-\-policy\f[]=\f[I]FILE\f[]:
  48. .RS 2
  49. .PP
  50. File to save the policy digest.
  51. .RE
  52. .IP \[bu] 2
  53. \f[B]\-S\f[], \f[B]\-\-session\f[]=\f[I]FILE\f[]:
  54. .RS 2
  55. .PP
  56. The policy session file generated via the \f[B]\-S\f[] option to
  57. \f[B]tpm2_startauthsession\f[](1).
  58. .RE
  59. .IP \[bu] 2
  60. \f[B]\-\-cphash\f[]=\f[I]FILE\f[]
  61. .RS 2
  62. .PP
  63. File path to record the hash of the command parameters.
  64. This is commonly termed as cpHash.
  65. NOTE: When this option is selected, The tool will not actually execute
  66. the command, it simply returns a cpHash.
  67. .RE
  68. .SS References
  69. .SH COMMON OPTIONS
  70. .PP
  71. This collection of options are common to many programs and provide
  72. information that many users may expect.
  73. .IP \[bu] 2
  74. \f[B]\-h\f[], \f[B]\-\-help=[man|no\-man]\f[]: Display the tools
  75. manpage.
  76. By default, it attempts to invoke the manpager for the tool, however, on
  77. failure will output a short tool summary.
  78. This is the same behavior if the "man" option argument is specified,
  79. however if explicit "man" is requested, the tool will provide errors
  80. from man on stderr.
  81. If the "no\-man" option if specified, or the manpager fails, the short
  82. options will be output to stdout.
  83. .RS 2
  84. .PP
  85. To successfully use the manpages feature requires the manpages to be
  86. installed or on \f[I]MANPATH\f[], See man(1) for more details.
  87. .RE
  88. .IP \[bu] 2
  89. \f[B]\-v\f[], \f[B]\-\-version\f[]: Display version information for this
  90. tool, supported tctis and exit.
  91. .IP \[bu] 2
  92. \f[B]\-V\f[], \f[B]\-\-verbose\f[]: Increase the information that the
  93. tool prints to the console during its execution.
  94. When using this option the file and line number are printed.
  95. .IP \[bu] 2
  96. \f[B]\-Q\f[], \f[B]\-\-quiet\f[]: Silence normal tool output to stdout.
  97. .IP \[bu] 2
  98. \f[B]\-Z\f[], \f[B]\-\-enable\-errata\f[]: Enable the application of
  99. errata fixups.
  100. Useful if an errata fixup needs to be applied to commands sent to the
  101. TPM.
  102. Defining the environment TPM2TOOLS_ENABLE_ERRATA is equivalent.
  103. information many users may expect.
  104. .SH TCTI Configuration
  105. .PP
  106. The TCTI or "Transmission Interface" is the communication mechanism with
  107. the TPM.
  108. TCTIs can be changed for communication with TPMs across different
  109. mediums.
  110. .PP
  111. To control the TCTI, the tools respect:
  112. .IP "1." 3
  113. The command line option \f[B]\-T\f[] or \f[B]\-\-tcti\f[]
  114. .IP "2." 3
  115. The environment variable: \f[I]TPM2TOOLS_TCTI\f[].
  116. .PP
  117. \f[B]Note:\f[] The command line option always overrides the environment
  118. variable.
  119. .PP
  120. The current known TCTIs are:
  121. .IP \[bu] 2
  122. tabrmd \- The resource manager, called
  123. tabrmd (https://github.com/tpm2-software/tpm2-abrmd).
  124. Note that tabrmd and abrmd as a tcti name are synonymous.
  125. .IP \[bu] 2
  126. mssim \- Typically used for communicating to the TPM software simulator.
  127. .IP \[bu] 2
  128. device \- Used when talking directly to a TPM device file.
  129. .IP \[bu] 2
  130. none \- Do not initalize a connection with the TPM.
  131. Some tools allow for off\-tpm options and thus support not using a TCTI.
  132. Tools that do not support it will error when attempted to be used
  133. without a TCTI connection.
  134. Does not support \f[I]ANY\f[] options and \f[I]MUST BE\f[] presented as
  135. the exact text of "none".
  136. .PP
  137. The arguments to either the command line option or the environment
  138. variable are in the form:
  139. .PP
  140. \f[C]<tcti\-name>:<tcti\-option\-config>\f[]
  141. .PP
  142. Specifying an empty string for either the \f[C]<tcti\-name>\f[] or
  143. \f[C]<tcti\-option\-config>\f[] results in the default being used for
  144. that portion respectively.
  145. .SS TCTI Defaults
  146. .PP
  147. When a TCTI is not specified, the default TCTI is searched for using
  148. \f[I]dlopen(3)\f[] semantics.
  149. The tools will search for \f[I]tabrmd\f[], \f[I]device\f[] and
  150. \f[I]mssim\f[] TCTIs \f[B]IN THAT ORDER\f[] and \f[B]USE THE FIRST ONE
  151. FOUND\f[].
  152. You can query what TCTI will be chosen as the default by using the
  153. \f[B]\-v\f[] option to print the version information.
  154. The "default\-tcti" key\-value pair will indicate which of the
  155. aforementioned TCTIs is the default.
  156. .SS Custom TCTIs
  157. .PP
  158. Any TCTI that implements the dynamic TCTI interface can be loaded.
  159. The tools internally use \f[I]dlopen(3)\f[], and the raw
  160. \f[I]tcti\-name\f[] value is used for the lookup.
  161. Thus, this could be a path to the shared library, or a library name as
  162. understood by \f[I]dlopen(3)\f[] semantics.
  163. .SH TCTI OPTIONS
  164. .PP
  165. This collection of options are used to configure the various known TCTI
  166. modules available:
  167. .IP \[bu] 2
  168. \f[B]device\f[]: For the device TCTI, the TPM character device file for
  169. use by the device TCTI can be specified.
  170. The default is \f[I]/dev/tpm0\f[].
  171. .RS 2
  172. .PP
  173. Example: \f[B]\-T device:/dev/tpm0\f[] or \f[B]export
  174. \f[I]TPM2TOOLS_TCTI\f[]="device:/dev/tpm0"\f[]
  175. .RE
  176. .IP \[bu] 2
  177. \f[B]mssim\f[]: For the mssim TCTI, the domain name or IP address and
  178. port number used by the simulator can be specified.
  179. The default are 127.0.0.1 and 2321.
  180. .RS 2
  181. .PP
  182. Example: \f[B]\-T mssim:host=localhost,port=2321\f[] or \f[B]export
  183. \f[I]TPM2TOOLS_TCTI\f[]="mssim:host=localhost,port=2321"\f[]
  184. .RE
  185. .IP \[bu] 2
  186. \f[B]abrmd\f[]: For the abrmd TCTI, the configuration string format is a
  187. series of simple key value pairs separated by a \[aq],\[aq] character.
  188. Each key and value string are separated by a \[aq]=\[aq] character.
  189. .RS 2
  190. .IP \[bu] 2
  191. TCTI abrmd supports two keys:
  192. .RS 2
  193. .IP "1." 3
  194. \[aq]bus_name\[aq] : The name of the tabrmd service on the bus (a
  195. string).
  196. .IP "2." 3
  197. \[aq]bus_type\[aq] : The type of the dbus instance (a string) limited to
  198. \[aq]session\[aq] and \[aq]system\[aq].
  199. .RE
  200. .PP
  201. Specify the tabrmd tcti name and a config string of
  202. \f[C]bus_name=com.example.FooBar\f[]:
  203. .PP
  204. \f[C]\\\-\-tcti=tabrmd:bus_name=com.example.FooBar\f[]
  205. .PP
  206. Specify the default (abrmd) tcti and a config string of
  207. \f[C]bus_type=session\f[]:
  208. .PP
  209. \f[C]\\\-\-tcti:bus_type=session\f[]
  210. .PP
  211. \f[B]NOTE\f[]: abrmd and tabrmd are synonymous.
  212. the various known TCTI modules.
  213. .RE
  214. .SH EXAMPLES
  215. .PP
  216. Create a policypassword and write the policy digest to an NV Index.
  217. Build a policyauthorizenv policy referencing the NV index in a
  218. \f[I]trial\f[] session.
  219. The resultant policy digest is then used in creation of objects.
  220. .PP
  221. In a policy authorization session, first satisfy the policy written to
  222. the NV index.
  223. Then run the policyauthorizenv which satisfies the authorization for the
  224. object.
  225. .SS Define the test NV Index to store the auth policy
  226. .IP
  227. .nf
  228. \f[C]
  229. nv_test_index=0x01500001
  230. tpm2_nvdefine\ \-C\ o\ \-p\ nvpass\ $nv_test_index\ \-a\ "authread|authwrite"\ \-s\ 34
  231. \f[]
  232. .fi
  233. .SS Define the auth policy
  234. .IP
  235. .nf
  236. \f[C]
  237. tpm2_startauthsession\ \-S\ session.ctx
  238. tpm2_policypassword\ \-S\ session.ctx\ \-L\ policy.pass
  239. tpm2_flushcontext\ session.ctx
  240. \f[]
  241. .fi
  242. .SS Write the auth policy to the NV Index
  243. .IP
  244. .nf
  245. \f[C]
  246. echo\ "000b"\ |\ xxd\ \-p\ \-r\ |\ cat\ \-\ policy.pass\ |\ \\
  247. tpm2_nvwrite\ \-C\ $nv_test_index\ \-P\ nvpass\ $nv_test_index\ \-i\-
  248. \f[]
  249. .fi
  250. .SS Define the policyauthorizenv
  251. .IP
  252. .nf
  253. \f[C]
  254. tpm2_startauthsession\ \-S\ session.ctx
  255. tpm2_policyauthorizenv\ \-S\ session.ctx\ \-C\ $nv_test_index\ \-P\ nvpass\ \\
  256. \-L\ policyauthorizenv.1500001\ $nv_test_index
  257. tpm2_flushcontext\ session.ctx
  258. \f[]
  259. .fi
  260. .SS Create and load a sealing object with auth policy =
  261. policyauthorizenv
  262. .IP
  263. .nf
  264. \f[C]
  265. tpm2_createprimary\ \-C\ o\ \-c\ prim.ctx
  266. echo\ "secretdata"\ |\ \\
  267. tpm2_create\ \-C\ prim.ctx\ \-u\ key.pub\ \-r\ key.priv\ \\
  268. \-a\ "fixedtpm|fixedparent|adminwithpolicy"\ \-L\ policyauthorizenv.1500001\ \-i\-
  269. tpm2_load\ \-C\ prim.ctx\ \-u\ key.pub\ \-r\ key.priv\ \-c\ key.ctx
  270. \f[]
  271. .fi
  272. .SS Satisfy the auth policy stored in the NV Index and thus
  273. policyauthorizenv
  274. .IP
  275. .nf
  276. \f[C]
  277. tpm2_startauthsession\ \-S\ session.ctx\ \-\-policy\-session
  278. tpm2_policypassword\ \-S\ session.ctx
  279. tpm2_policyauthorizenv\ \-S\ session.ctx\ \-C\ $nv_test_index\ \-P\ nvpass\ $nv_test_index
  280. tpm2_unseal\ \-c\ key.ctx\ \-p\ session:session.ctx
  281. tpm2_flushcontext\ session.ctx
  282. \f[]
  283. .fi
  284. .SH Returns
  285. .PP
  286. Tools can return any of the following codes:
  287. .IP \[bu] 2
  288. 0 \- Success.
  289. .IP \[bu] 2
  290. 1 \- General non\-specific error.
  291. .IP \[bu] 2
  292. 2 \- Options handling error.
  293. .IP \[bu] 2
  294. 3 \- Authentication error.
  295. .IP \[bu] 2
  296. 4 \- TCTI related error.
  297. .IP \[bu] 2
  298. 5 \- Non supported scheme.
  299. Applicable to tpm2_testparams.
  300. .SH Limitations
  301. .PP
  302. It expects a session to be already established via
  303. \f[B]tpm2_startauthsession\f[](1) and requires one of the following:
  304. .IP \[bu] 2
  305. direct device access
  306. .IP \[bu] 2
  307. extended session support with \f[B]tpm2\-abrmd\f[].
  308. .PP
  309. Without it, most resource managers \f[B]will not\f[] save session state
  310. between command invocations.
  311. .SH BUGS
  312. .PP
  313. Github Issues (https://github.com/tpm2-software/tpm2-tools/issues)
  314. .SH HELP
  315. .PP
  316. See the Mailing List (https://lists.01.org/mailman/listinfo/tpm2)