tpm2_policycphash.1 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. .\" Automatically generated by Pandoc 1.19.2.4
  2. .\"
  3. .TH "tpm2_policycphash" "1" "" "tpm2\-tools" "General Commands Manual"
  4. .hy
  5. .SH NAME
  6. .PP
  7. \f[B]tpm2_policycphash\f[](1) \- Couples a policy with command
  8. parameters of the command.
  9. .SH SYNOPSIS
  10. .PP
  11. \f[B]tpm2_policycphash\f[] [\f[I]OPTIONS\f[]]
  12. .SH DESCRIPTION
  13. .PP
  14. \f[B]tpm2_policycphash\f[](1) \- Couples a policy with command
  15. parameters of the command.
  16. This is a deferred assertion where the hash of the command parameters in
  17. a TPM command is checked against the one specified in the policy.
  18. .SH OPTIONS
  19. .IP \[bu] 2
  20. \f[B]\-L\f[], \f[B]\-\-policy\f[]=\f[I]FILE\f[]:
  21. .RS 2
  22. .PP
  23. File to save the compounded policy digest.
  24. .RE
  25. .IP \[bu] 2
  26. \f[B]\-S\f[], \f[B]\-\-session\f[]=\f[I]FILE\f[]:
  27. .RS 2
  28. .PP
  29. The policy session file generated via the \f[B]\-S\f[] option to
  30. \f[B]tpm2_startauthsession\f[](1).
  31. .RE
  32. .IP \[bu] 2
  33. \f[B]\-\-cphash\-input\f[]=\f[I]FILE\f[]:
  34. .RS 2
  35. .PP
  36. The file containing the command parameter hash of the command.
  37. .RE
  38. .IP \[bu] 2
  39. \f[B]\-\-cphash\f[]=\f[I]FILE\f[]:
  40. .RS 2
  41. .PP
  42. \f[B]DEPRECATED\f[], use \f[B]\-\-cphash\-input\f[] instead.
  43. .RE
  44. .SS References
  45. .SH COMMON OPTIONS
  46. .PP
  47. This collection of options are common to many programs and provide
  48. information that many users may expect.
  49. .IP \[bu] 2
  50. \f[B]\-h\f[], \f[B]\-\-help=[man|no\-man]\f[]: Display the tools
  51. manpage.
  52. By default, it attempts to invoke the manpager for the tool, however, on
  53. failure will output a short tool summary.
  54. This is the same behavior if the "man" option argument is specified,
  55. however if explicit "man" is requested, the tool will provide errors
  56. from man on stderr.
  57. If the "no\-man" option if specified, or the manpager fails, the short
  58. options will be output to stdout.
  59. .RS 2
  60. .PP
  61. To successfully use the manpages feature requires the manpages to be
  62. installed or on \f[I]MANPATH\f[], See man(1) for more details.
  63. .RE
  64. .IP \[bu] 2
  65. \f[B]\-v\f[], \f[B]\-\-version\f[]: Display version information for this
  66. tool, supported tctis and exit.
  67. .IP \[bu] 2
  68. \f[B]\-V\f[], \f[B]\-\-verbose\f[]: Increase the information that the
  69. tool prints to the console during its execution.
  70. When using this option the file and line number are printed.
  71. .IP \[bu] 2
  72. \f[B]\-Q\f[], \f[B]\-\-quiet\f[]: Silence normal tool output to stdout.
  73. .IP \[bu] 2
  74. \f[B]\-Z\f[], \f[B]\-\-enable\-errata\f[]: Enable the application of
  75. errata fixups.
  76. Useful if an errata fixup needs to be applied to commands sent to the
  77. TPM.
  78. Defining the environment TPM2TOOLS_ENABLE_ERRATA is equivalent.
  79. information many users may expect.
  80. .SH TCTI Configuration
  81. .PP
  82. The TCTI or "Transmission Interface" is the communication mechanism with
  83. the TPM.
  84. TCTIs can be changed for communication with TPMs across different
  85. mediums.
  86. .PP
  87. To control the TCTI, the tools respect:
  88. .IP "1." 3
  89. The command line option \f[B]\-T\f[] or \f[B]\-\-tcti\f[]
  90. .IP "2." 3
  91. The environment variable: \f[I]TPM2TOOLS_TCTI\f[].
  92. .PP
  93. \f[B]Note:\f[] The command line option always overrides the environment
  94. variable.
  95. .PP
  96. The current known TCTIs are:
  97. .IP \[bu] 2
  98. tabrmd \- The resource manager, called
  99. tabrmd (https://github.com/tpm2-software/tpm2-abrmd).
  100. Note that tabrmd and abrmd as a tcti name are synonymous.
  101. .IP \[bu] 2
  102. mssim \- Typically used for communicating to the TPM software simulator.
  103. .IP \[bu] 2
  104. device \- Used when talking directly to a TPM device file.
  105. .IP \[bu] 2
  106. none \- Do not initalize a connection with the TPM.
  107. Some tools allow for off\-tpm options and thus support not using a TCTI.
  108. Tools that do not support it will error when attempted to be used
  109. without a TCTI connection.
  110. Does not support \f[I]ANY\f[] options and \f[I]MUST BE\f[] presented as
  111. the exact text of "none".
  112. .PP
  113. The arguments to either the command line option or the environment
  114. variable are in the form:
  115. .PP
  116. \f[C]<tcti\-name>:<tcti\-option\-config>\f[]
  117. .PP
  118. Specifying an empty string for either the \f[C]<tcti\-name>\f[] or
  119. \f[C]<tcti\-option\-config>\f[] results in the default being used for
  120. that portion respectively.
  121. .SS TCTI Defaults
  122. .PP
  123. When a TCTI is not specified, the default TCTI is searched for using
  124. \f[I]dlopen(3)\f[] semantics.
  125. The tools will search for \f[I]tabrmd\f[], \f[I]device\f[] and
  126. \f[I]mssim\f[] TCTIs \f[B]IN THAT ORDER\f[] and \f[B]USE THE FIRST ONE
  127. FOUND\f[].
  128. You can query what TCTI will be chosen as the default by using the
  129. \f[B]\-v\f[] option to print the version information.
  130. The "default\-tcti" key\-value pair will indicate which of the
  131. aforementioned TCTIs is the default.
  132. .SS Custom TCTIs
  133. .PP
  134. Any TCTI that implements the dynamic TCTI interface can be loaded.
  135. The tools internally use \f[I]dlopen(3)\f[], and the raw
  136. \f[I]tcti\-name\f[] value is used for the lookup.
  137. Thus, this could be a path to the shared library, or a library name as
  138. understood by \f[I]dlopen(3)\f[] semantics.
  139. .SH TCTI OPTIONS
  140. .PP
  141. This collection of options are used to configure the various known TCTI
  142. modules available:
  143. .IP \[bu] 2
  144. \f[B]device\f[]: For the device TCTI, the TPM character device file for
  145. use by the device TCTI can be specified.
  146. The default is \f[I]/dev/tpm0\f[].
  147. .RS 2
  148. .PP
  149. Example: \f[B]\-T device:/dev/tpm0\f[] or \f[B]export
  150. \f[I]TPM2TOOLS_TCTI\f[]="device:/dev/tpm0"\f[]
  151. .RE
  152. .IP \[bu] 2
  153. \f[B]mssim\f[]: For the mssim TCTI, the domain name or IP address and
  154. port number used by the simulator can be specified.
  155. The default are 127.0.0.1 and 2321.
  156. .RS 2
  157. .PP
  158. Example: \f[B]\-T mssim:host=localhost,port=2321\f[] or \f[B]export
  159. \f[I]TPM2TOOLS_TCTI\f[]="mssim:host=localhost,port=2321"\f[]
  160. .RE
  161. .IP \[bu] 2
  162. \f[B]abrmd\f[]: For the abrmd TCTI, the configuration string format is a
  163. series of simple key value pairs separated by a \[aq],\[aq] character.
  164. Each key and value string are separated by a \[aq]=\[aq] character.
  165. .RS 2
  166. .IP \[bu] 2
  167. TCTI abrmd supports two keys:
  168. .RS 2
  169. .IP "1." 3
  170. \[aq]bus_name\[aq] : The name of the tabrmd service on the bus (a
  171. string).
  172. .IP "2." 3
  173. \[aq]bus_type\[aq] : The type of the dbus instance (a string) limited to
  174. \[aq]session\[aq] and \[aq]system\[aq].
  175. .RE
  176. .PP
  177. Specify the tabrmd tcti name and a config string of
  178. \f[C]bus_name=com.example.FooBar\f[]:
  179. .PP
  180. \f[C]\\\-\-tcti=tabrmd:bus_name=com.example.FooBar\f[]
  181. .PP
  182. Specify the default (abrmd) tcti and a config string of
  183. \f[C]bus_type=session\f[]:
  184. .PP
  185. \f[C]\\\-\-tcti:bus_type=session\f[]
  186. .PP
  187. \f[B]NOTE\f[]: abrmd and tabrmd are synonymous.
  188. the various known TCTI modules.
  189. .RE
  190. .SH EXAMPLES
  191. .PP
  192. Restrict the value that can be set through tpm2_nvsetbits.
  193. .SS Define NV index object with authorized policy
  194. .IP
  195. .nf
  196. \f[C]
  197. openssl\ genrsa\ \-out\ signing_key_private.pem\ 2048
  198. openssl\ rsa\ \-in\ signing_key_private.pem\ \-out\ signing_key_public.pem\ \-pubout
  199. tpm2_loadexternal\ \-G\ rsa\ \-C\ o\ \-u\ signing_key_public.pem\ \-c\ signing_key.ctx\ \\
  200. \-n\ signing_key.name
  201. tpm2_startauthsession\ \-S\ session.ctx\ \-g\ sha256
  202. tpm2_policyauthorize\ \-S\ session.ctx\ \-L\ authorized.policy\ \-n\ signing_key.name
  203. tpm2_flushcontext\ session.ctx
  204. tpm2_nvdefine\ 1\ \-a\ "policywrite|authwrite|ownerread|nt=bits"\ \-L\ authorized.policy
  205. \f[]
  206. .fi
  207. .SS Create policycphash
  208. .IP
  209. .nf
  210. \f[C]
  211. tpm2_nvsetbits\ 1\ \-i\ 1\ \-\-cphash\ cp.hash
  212. tpm2_startauthsession\ \-S\ session.ctx\ \-g\ sha256
  213. tpm2_policycphash\ \-S\ session.ctx\ \-L\ policy.cphash\ \-\-cphash\ cp.hash
  214. tpm2_flushcontext\ session.ctx
  215. \f[]
  216. .fi
  217. .SS Sign and verify policycphash
  218. .IP
  219. .nf
  220. \f[C]
  221. openssl\ dgst\ \-sha256\ \-sign\ signing_key_private.pem\ \\
  222. \-out\ policycphash.signature\ policy.cphash
  223. tpm2_verifysignature\ \-c\ signing_key.ctx\ \-g\ sha256\ \-m\ policy.cphash\ \\
  224. \-s\ policycphash.signature\ \-t\ verification.tkt\ \-f\ rsassa
  225. \f[]
  226. .fi
  227. .SS Satisfy policycphash and execute nvsetbits
  228. .IP
  229. .nf
  230. \f[C]
  231. tpm2_startauthsession\ \-S\ session.ctx\ \-\-policy\-session\ \-g\ sha256
  232. tpm2_policycphash\ \-S\ session.ctx\ \-\-cphash\ cp.hash
  233. tpm2_policyauthorize\ \-S\ session.ctx\ \-i\ policy.cphash\ \-n\ signing_key.name\ \\
  234. \-t\ verification.tkt
  235. tpm2_nvsetbits\ 1\ \-i\ 1\ \-P\ "session:session.ctx"
  236. tpm2_flushcontext\ session.ctx
  237. \f[]
  238. .fi
  239. .SH Returns
  240. .PP
  241. Tools can return any of the following codes:
  242. .IP \[bu] 2
  243. 0 \- Success.
  244. .IP \[bu] 2
  245. 1 \- General non\-specific error.
  246. .IP \[bu] 2
  247. 2 \- Options handling error.
  248. .IP \[bu] 2
  249. 3 \- Authentication error.
  250. .IP \[bu] 2
  251. 4 \- TCTI related error.
  252. .IP \[bu] 2
  253. 5 \- Non supported scheme.
  254. Applicable to tpm2_testparams.
  255. .SH Limitations
  256. .PP
  257. It expects a session to be already established via
  258. \f[B]tpm2_startauthsession\f[](1) and requires one of the following:
  259. .IP \[bu] 2
  260. direct device access
  261. .IP \[bu] 2
  262. extended session support with \f[B]tpm2\-abrmd\f[].
  263. .PP
  264. Without it, most resource managers \f[B]will not\f[] save session state
  265. between command invocations.
  266. .SH BUGS
  267. .PP
  268. Github Issues (https://github.com/tpm2-software/tpm2-tools/issues)
  269. .SH HELP
  270. .PP
  271. See the Mailing List (https://lists.01.org/mailman/listinfo/tpm2)