tpm2_policynvwritten.1 7.7 KB

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