tpm2_policycountertimer.1 9.6 KB

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