tpm2_pcrevent.1 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. .\" Automatically generated by Pandoc 1.19.2.4
  2. .\"
  3. .TH "tpm2_pcrevent" "1" "" "tpm2\-tools" "General Commands Manual"
  4. .hy
  5. .SH NAME
  6. .PP
  7. \f[B]tpm2_pcrevent\f[](1) \- Hashes a file and optionally extends a pcr.
  8. .SH SYNOPSIS
  9. .PP
  10. \f[B]tpm2_pcrevent\f[] [\f[I]OPTIONS\f[]] \f[I]FILE\f[]
  11. \f[I]PCR_INDEX\f[]
  12. .SH DESCRIPTION
  13. .PP
  14. \f[B]tpm2_pcrevent\f[](1) \- Hashes \f[I]FILE\f[] if specified or stdin.
  15. It uses all of the hashing algorithms that the TPM supports.
  16. .PP
  17. Optionally, if a PCR index is specified, it extends that PCR for all
  18. supported algorithms with the hash digest.
  19. \f[I]FILE\f[] and _PCR_INDEX_ arguments don\[aq]t need to come in any
  20. particular order.
  21. .PP
  22. In either case, it outputs to stdout the hash algorithm used and the
  23. digest value, one per line:
  24. .PP
  25. \f[I]alg\f[]:\f[I]digest\f[]
  26. .PP
  27. Where \f[I]alg\f[] is the algorithm used (like sha1) and \f[I]digest\f[]
  28. is the digest resulting from the hash computation of \f[I]alg\f[] on the
  29. data.
  30. .PP
  31. See sections 23.1 and sections 17 of the TPM2.0
  32. Specification (https://trustedcomputinggroup.org/wp-content/uploads/TPM-Rev-2.0-Part-3-Commands-01.38.pdf)
  33. .SH OPTIONS
  34. .PP
  35. These options control extending the pcr:
  36. .IP \[bu] 2
  37. \f[B]\-P\f[], \f[B]\-\-auth\f[]=\f[I]AUTH\f[]:
  38. .RS 2
  39. .PP
  40. Specifies the authorization value for PCR.
  41. .RE
  42. .SH COMMON OPTIONS
  43. .PP
  44. This collection of options are common to many programs and provide
  45. information that many users may expect.
  46. .IP \[bu] 2
  47. \f[B]\-h\f[], \f[B]\-\-help=[man|no\-man]\f[]: Display the tools
  48. manpage.
  49. By default, it attempts to invoke the manpager for the tool, however, on
  50. failure will output a short tool summary.
  51. This is the same behavior if the "man" option argument is specified,
  52. however if explicit "man" is requested, the tool will provide errors
  53. from man on stderr.
  54. If the "no\-man" option if specified, or the manpager fails, the short
  55. options will be output to stdout.
  56. .RS 2
  57. .PP
  58. To successfully use the manpages feature requires the manpages to be
  59. installed or on \f[I]MANPATH\f[], See man(1) for more details.
  60. .RE
  61. .IP \[bu] 2
  62. \f[B]\-v\f[], \f[B]\-\-version\f[]: Display version information for this
  63. tool, supported tctis and exit.
  64. .IP \[bu] 2
  65. \f[B]\-V\f[], \f[B]\-\-verbose\f[]: Increase the information that the
  66. tool prints to the console during its execution.
  67. When using this option the file and line number are printed.
  68. .IP \[bu] 2
  69. \f[B]\-Q\f[], \f[B]\-\-quiet\f[]: Silence normal tool output to stdout.
  70. .IP \[bu] 2
  71. \f[B]\-Z\f[], \f[B]\-\-enable\-errata\f[]: Enable the application of
  72. errata fixups.
  73. Useful if an errata fixup needs to be applied to commands sent to the
  74. TPM.
  75. Defining the environment TPM2TOOLS_ENABLE_ERRATA is equivalent.
  76. .SH TCTI Configuration
  77. .PP
  78. The TCTI or "Transmission Interface" is the communication mechanism with
  79. the TPM.
  80. TCTIs can be changed for communication with TPMs across different
  81. mediums.
  82. .PP
  83. To control the TCTI, the tools respect:
  84. .IP "1." 3
  85. The command line option \f[B]\-T\f[] or \f[B]\-\-tcti\f[]
  86. .IP "2." 3
  87. The environment variable: \f[I]TPM2TOOLS_TCTI\f[].
  88. .PP
  89. \f[B]Note:\f[] The command line option always overrides the environment
  90. variable.
  91. .PP
  92. The current known TCTIs are:
  93. .IP \[bu] 2
  94. tabrmd \- The resource manager, called
  95. tabrmd (https://github.com/tpm2-software/tpm2-abrmd).
  96. Note that tabrmd and abrmd as a tcti name are synonymous.
  97. .IP \[bu] 2
  98. mssim \- Typically used for communicating to the TPM software simulator.
  99. .IP \[bu] 2
  100. device \- Used when talking directly to a TPM device file.
  101. .IP \[bu] 2
  102. none \- Do not initalize a connection with the TPM.
  103. Some tools allow for off\-tpm options and thus support not using a TCTI.
  104. Tools that do not support it will error when attempted to be used
  105. without a TCTI connection.
  106. Does not support \f[I]ANY\f[] options and \f[I]MUST BE\f[] presented as
  107. the exact text of "none".
  108. .PP
  109. The arguments to either the command line option or the environment
  110. variable are in the form:
  111. .PP
  112. \f[C]<tcti\-name>:<tcti\-option\-config>\f[]
  113. .PP
  114. Specifying an empty string for either the \f[C]<tcti\-name>\f[] or
  115. \f[C]<tcti\-option\-config>\f[] results in the default being used for
  116. that portion respectively.
  117. .SS TCTI Defaults
  118. .PP
  119. When a TCTI is not specified, the default TCTI is searched for using
  120. \f[I]dlopen(3)\f[] semantics.
  121. The tools will search for \f[I]tabrmd\f[], \f[I]device\f[] and
  122. \f[I]mssim\f[] TCTIs \f[B]IN THAT ORDER\f[] and \f[B]USE THE FIRST ONE
  123. FOUND\f[].
  124. You can query what TCTI will be chosen as the default by using the
  125. \f[B]\-v\f[] option to print the version information.
  126. The "default\-tcti" key\-value pair will indicate which of the
  127. aforementioned TCTIs is the default.
  128. .SS Custom TCTIs
  129. .PP
  130. Any TCTI that implements the dynamic TCTI interface can be loaded.
  131. The tools internally use \f[I]dlopen(3)\f[], and the raw
  132. \f[I]tcti\-name\f[] value is used for the lookup.
  133. Thus, this could be a path to the shared library, or a library name as
  134. understood by \f[I]dlopen(3)\f[] semantics.
  135. .SH TCTI OPTIONS
  136. .PP
  137. This collection of options are used to configure the various known TCTI
  138. modules available:
  139. .IP \[bu] 2
  140. \f[B]device\f[]: For the device TCTI, the TPM character device file for
  141. use by the device TCTI can be specified.
  142. The default is \f[I]/dev/tpm0\f[].
  143. .RS 2
  144. .PP
  145. Example: \f[B]\-T device:/dev/tpm0\f[] or \f[B]export
  146. \f[I]TPM2TOOLS_TCTI\f[]="device:/dev/tpm0"\f[]
  147. .RE
  148. .IP \[bu] 2
  149. \f[B]mssim\f[]: For the mssim TCTI, the domain name or IP address and
  150. port number used by the simulator can be specified.
  151. The default are 127.0.0.1 and 2321.
  152. .RS 2
  153. .PP
  154. Example: \f[B]\-T mssim:host=localhost,port=2321\f[] or \f[B]export
  155. \f[I]TPM2TOOLS_TCTI\f[]="mssim:host=localhost,port=2321"\f[]
  156. .RE
  157. .IP \[bu] 2
  158. \f[B]abrmd\f[]: For the abrmd TCTI, the configuration string format is a
  159. series of simple key value pairs separated by a \[aq],\[aq] character.
  160. Each key and value string are separated by a \[aq]=\[aq] character.
  161. .RS 2
  162. .IP \[bu] 2
  163. TCTI abrmd supports two keys:
  164. .RS 2
  165. .IP "1." 3
  166. \[aq]bus_name\[aq] : The name of the tabrmd service on the bus (a
  167. string).
  168. .IP "2." 3
  169. \[aq]bus_type\[aq] : The type of the dbus instance (a string) limited to
  170. \[aq]session\[aq] and \[aq]system\[aq].
  171. .RE
  172. .PP
  173. Specify the tabrmd tcti name and a config string of
  174. \f[C]bus_name=com.example.FooBar\f[]:
  175. .PP
  176. \f[C]\\\-\-tcti=tabrmd:bus_name=com.example.FooBar\f[]
  177. .PP
  178. Specify the default (abrmd) tcti and a config string of
  179. \f[C]bus_type=session\f[]:
  180. .PP
  181. \f[C]\\\-\-tcti:bus_type=session\f[]
  182. .PP
  183. \f[B]NOTE\f[]: abrmd and tabrmd are synonymous.
  184. .RE
  185. .SH Authorization Formatting
  186. .PP
  187. Authorization for use of an object in TPM2.0 can come in 3 different
  188. forms: 1.
  189. Password 2.
  190. HMAC 3.
  191. Sessions
  192. .PP
  193. \f[B]NOTE:\f[] "Authorizations default to the \f[B]EMPTY PASSWORD\f[]
  194. when not specified".
  195. .SS Passwords
  196. .PP
  197. Passwords are interpreted in the following forms below using prefix
  198. identifiers.
  199. .PP
  200. \f[B]Note\f[]: By default passwords are assumed to be in the string form
  201. when they do not have a prefix.
  202. .SS String
  203. .PP
  204. A string password, specified by prefix "str:" or it\[aq]s absence (raw
  205. string without prefix) is not interpreted, and is directly used for
  206. authorization.
  207. .SS Examples
  208. .IP
  209. .nf
  210. \f[C]
  211. foobar
  212. str:foobar
  213. \f[]
  214. .fi
  215. .SS Hex\-string
  216. .PP
  217. A hex\-string password, specified by prefix "hex:" is converted from a
  218. hexidecimal form into a byte array form, thus allowing passwords with
  219. non\-printable and/or terminal un\-friendly characters.
  220. .SS Example
  221. .IP
  222. .nf
  223. \f[C]
  224. hex:0x1122334455667788
  225. \f[]
  226. .fi
  227. .SS File
  228. .PP
  229. A file based password, specified be prefix "file:" should be the path of
  230. a file containing the password to be read by the tool or a "\-" to use
  231. stdin.
  232. Storing passwords in files prevents information leakage, passwords
  233. passed as options can be read from the process list or common shell
  234. history features.
  235. .SS Examples
  236. .IP
  237. .nf
  238. \f[C]
  239. #\ to\ use\ stdin\ and\ be\ prompted
  240. file:\-
  241. #\ to\ use\ a\ file\ from\ a\ path
  242. file:path/to/password/file
  243. #\ to\ echo\ a\ password\ via\ stdin:
  244. echo\ foobar\ |\ tpm2_tool\ \-p\ file:\-
  245. #\ to\ use\ a\ bash\ here\-string\ via\ stdin:
  246. tpm2_tool\ \-p\ file:\-\ <<<\ foobar
  247. \f[]
  248. .fi
  249. .SS Sessions
  250. .PP
  251. When using a policy session to authorize the use of an object, prefix
  252. the option argument with the \f[I]session\f[] keyword.
  253. Then indicate a path to a session file that was created with
  254. tpm2_startauthsession(1).
  255. Optionally, if the session requires an auth value to be sent with the
  256. session handle (eg policy password), then append a + and a string as
  257. described in the \f[B]Passwords\f[] section.
  258. .SS Examples
  259. .PP
  260. To use a session context file called \f[I]session.ctx\f[].
  261. .IP
  262. .nf
  263. \f[C]
  264. session:session.ctx
  265. \f[]
  266. .fi
  267. .PP
  268. To use a session context file called \f[I]session.ctx\f[] \f[B]AND\f[]
  269. send the authvalue mypassword.
  270. .IP
  271. .nf
  272. \f[C]
  273. session:session.ctx+mypassword
  274. \f[]
  275. .fi
  276. .PP
  277. To use a session context file called \f[I]session.ctx\f[] \f[B]AND\f[]
  278. send the \f[I]HEX\f[] authvalue 0x11223344.
  279. .IP
  280. .nf
  281. \f[C]
  282. session:session.ctx+hex:11223344
  283. \f[]
  284. .fi
  285. .SS PCR Authorizations
  286. .PP
  287. You can satisfy a PCR policy using the "pcr:" prefix and the PCR
  288. minilanguage.
  289. The PCR minilanguage is as follows:
  290. \f[C]<pcr\-spec>=<raw\-pcr\-file>\f[]
  291. .PP
  292. The PCR spec is documented in in the section "PCR bank specifiers".
  293. .PP
  294. The \f[C]raw\-pcr\-file\f[] is an \f[B]optional\f[] the output of the
  295. raw PCR contents as returned by \f[I]tpm2_pcrread(1)\f[].
  296. .PP
  297. PCR bank specifiers (common/pcr.md)
  298. .SS Examples
  299. .PP
  300. To satisfy a PCR policy of sha256 on banks 0, 1, 2 and 3 use a specifier
  301. of:
  302. .IP
  303. .nf
  304. \f[C]
  305. pcr:sha256:0,1,2,3
  306. \f[]
  307. .fi
  308. .SH EXAMPLES
  309. .SS Hash a file
  310. .IP
  311. .nf
  312. \f[C]
  313. echo\ "foo"\ >\ data
  314. tpm2_pcrevent\ data
  315. \f[]
  316. .fi
  317. .SS Hash a file and extend PCR 8
  318. .IP
  319. .nf
  320. \f[C]
  321. echo\ "foo"\ >\ data
  322. tpm2_pcrevent\ 8\ data
  323. \f[]
  324. .fi
  325. .SH Returns
  326. .PP
  327. Tools can return any of the following codes:
  328. .IP \[bu] 2
  329. 0 \- Success.
  330. .IP \[bu] 2
  331. 1 \- General non\-specific error.
  332. .IP \[bu] 2
  333. 2 \- Options handling error.
  334. .IP \[bu] 2
  335. 3 \- Authentication error.
  336. .IP \[bu] 2
  337. 4 \- TCTI related error.
  338. .IP \[bu] 2
  339. 5 \- Non supported scheme.
  340. Applicable to tpm2_testparams.
  341. .SH BUGS
  342. .PP
  343. Github Issues (https://github.com/tpm2-software/tpm2-tools/issues)
  344. .SH HELP
  345. .PP
  346. See the Mailing List (https://lists.01.org/mailman/listinfo/tpm2)