tpm2_nvreadlock.1 11 KB

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