tpm2_nvsetbits.1 11 KB

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