tpm2_setprimarypolicy.1 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. .\" Automatically generated by Pandoc 1.19.2.4
  2. .\"
  3. .TH "tpm2_setprimarypolicy" "1" "" "tpm2\-tools" "General Commands Manual"
  4. .hy
  5. .SH NAME
  6. .PP
  7. \f[B]tpm2_setprimarypolicy\f[](1) \- Sets the authorization policy for
  8. the lockout (lockoutPolicy), the platform hierarchy (platformPolicy),
  9. the storage hierarchy (ownerPolicy), and the endorsement hierarchy
  10. (endorsementPolicy).
  11. .SH SYNOPSIS
  12. .PP
  13. \f[B]tpm2_setprimarypolicy\f[] [\f[I]OPTIONS\f[]]
  14. .SH DESCRIPTION
  15. .PP
  16. \f[B]tpm2_setprimarypolicy\f[](1) \- Sets the authorization policy for
  17. the lockout (lockoutPolicy), the platform hierarchy (platformPolicy),
  18. the storage hierarchy (ownerPolicy), and the endorsement hierarchy
  19. (endorsementPolicy).
  20. .SH OPTIONS
  21. .PP
  22. These options control creating the policy authorization session:
  23. .IP \[bu] 2
  24. \f[B]\-C\f[], \f[B]\-\-hierarchy\f[]=\f[I]OBJECT\f[]:
  25. .RS 2
  26. .PP
  27. Specifies the hierarchy whose authorization policy is to be setup.
  28. It can be specified as o|p|e|l
  29. .RE
  30. .IP \[bu] 2
  31. \f[B]\-P\f[], \f[B]\-\-auth\f[]=\f[I]AUTH\f[]:
  32. .RS 2
  33. .PP
  34. Specifies the authorization value for the hierarchy.
  35. .RE
  36. .IP \[bu] 2
  37. \f[B]\-L\f[], \f[B]\-\-policy\f[]=\f[I]FILE\f[]:
  38. .RS 2
  39. .PP
  40. The file path of the authorization policy data.
  41. .RE
  42. .IP \[bu] 2
  43. \f[B]\-g\f[], \f[B]\-\-hash\-algorithm\f[]=\f[I]ALGORITHM\f[]:
  44. .RS 2
  45. .PP
  46. The hash algorithm used in computation of the policy digest.
  47. .RE
  48. .IP \[bu] 2
  49. \f[B]\-\-cphash\f[]=\f[I]FILE\f[]
  50. .RS 2
  51. .PP
  52. File path to record the hash of the command parameters.
  53. This is commonly termed as cpHash.
  54. NOTE: When this option is selected, The tool will not actually execute
  55. the command, it simply returns a cpHash.
  56. .RE
  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 Algorithm Specifiers
  207. .PP
  208. Options that take algorithms support "nice\-names".
  209. .PP
  210. There are two major algorithm specification string classes, simple and
  211. complex.
  212. Only certain algorithms will be accepted by the TPM, based on usage and
  213. conditions.
  214. .SS Simple specifiers
  215. .PP
  216. These are strings with no additional specification data.
  217. When creating objects, non\-specified portions of an object are assumed
  218. to defaults.
  219. You can find the list of known "Simple Specifiers Below".
  220. .SS Asymmetric
  221. .IP \[bu] 2
  222. rsa
  223. .IP \[bu] 2
  224. ecc
  225. .SS Symmetric
  226. .IP \[bu] 2
  227. aes
  228. .IP \[bu] 2
  229. camellia
  230. .SS Hashing Algorithms
  231. .IP \[bu] 2
  232. sha1
  233. .IP \[bu] 2
  234. sha256
  235. .IP \[bu] 2
  236. sha384
  237. .IP \[bu] 2
  238. sha512
  239. .IP \[bu] 2
  240. sm3_256
  241. .IP \[bu] 2
  242. sha3_256
  243. .IP \[bu] 2
  244. sha3_384
  245. .IP \[bu] 2
  246. sha3_512
  247. .SS Keyed Hash
  248. .IP \[bu] 2
  249. hmac
  250. .IP \[bu] 2
  251. xor
  252. .SS Signing Schemes
  253. .IP \[bu] 2
  254. rsassa
  255. .IP \[bu] 2
  256. rsapss
  257. .IP \[bu] 2
  258. ecdsa
  259. .IP \[bu] 2
  260. ecdaa
  261. .IP \[bu] 2
  262. ecschnorr
  263. .SS Asymmetric Encryption Schemes
  264. .IP \[bu] 2
  265. oaep
  266. .IP \[bu] 2
  267. rsaes
  268. .IP \[bu] 2
  269. ecdh
  270. .SS Modes
  271. .IP \[bu] 2
  272. ctr
  273. .IP \[bu] 2
  274. ofb
  275. .IP \[bu] 2
  276. cbc
  277. .IP \[bu] 2
  278. cfb
  279. .IP \[bu] 2
  280. ecb
  281. .SS Misc
  282. .IP \[bu] 2
  283. null
  284. .SS Complex Specifiers
  285. .PP
  286. Objects, when specified for creation by the TPM, have numerous
  287. algorithms to populate in the public data.
  288. Things like type, scheme and asymmetric details, key size, etc.
  289. Below is the general format for specifying this data:
  290. \f[C]<type>:<scheme>:<symmetric\-details>\f[]
  291. .SS Type Specifiers
  292. .PP
  293. This portion of the complex algorithm specifier is required.
  294. The remaining scheme and symmetric details will default based on the
  295. type specified and the type of the object being created.
  296. .IP \[bu] 2
  297. aes \- Default AES: aes128
  298. .IP \[bu] 2
  299. aes128\f[C]<mode>\f[] \- 128 bit AES with optional mode
  300. (\f[I]ctr\f[]|\f[I]ofb\f[]|\f[I]cbc\f[]|\f[I]cfb\f[]|\f[I]ecb\f[]).
  301. If mode is not specified, defaults to \f[I]null\f[].
  302. .IP \[bu] 2
  303. aes192\f[C]<mode>\f[] \- Same as aes128\f[C]<mode>\f[], except for a 192
  304. bit key size.
  305. .IP \[bu] 2
  306. aes256\f[C]<mode>\f[] \- Same as aes128\f[C]<mode>\f[], except for a 256
  307. bit key size.
  308. .IP \[bu] 2
  309. ecc \- Elliptical Curve, defaults to ecc256.
  310. .IP \[bu] 2
  311. ecc192 \- 192 bit ECC
  312. .IP \[bu] 2
  313. ecc224 \- 224 bit ECC
  314. .IP \[bu] 2
  315. ecc256 \- 256 bit ECC
  316. .IP \[bu] 2
  317. ecc384 \- 384 bit ECC
  318. .IP \[bu] 2
  319. ecc521 \- 521 bit ECC
  320. .IP \[bu] 2
  321. rsa \- Default RSA: rsa2048
  322. .IP \[bu] 2
  323. rsa1024 \- RSA with 1024 bit keysize.
  324. .IP \[bu] 2
  325. rsa2048 \- RSA with 2048 bit keysize.
  326. .IP \[bu] 2
  327. rsa4096 \- RSA with 4096 bit keysize.
  328. .SS Scheme Specifiers
  329. .PP
  330. Next, is an optional field, it can be skipped.
  331. .PP
  332. Schemes are usually \f[B]Signing Schemes\f[] or \f[B]Asymmetric
  333. Encryption Schemes\f[].
  334. Most signing schemes take a hash algorithm directly following the
  335. signing scheme.
  336. If the hash algorithm is missing, it defaults to \f[I]sha256\f[].
  337. Some take no arguments, and some take multiple arguments.
  338. .SS Hash Optional Scheme Specifiers
  339. .PP
  340. These scheme specifiers are followed by a dash and a valid hash
  341. algorithm, For example: \f[C]oaep\-sha256\f[].
  342. .IP \[bu] 2
  343. oaep
  344. .IP \[bu] 2
  345. ecdh
  346. .IP \[bu] 2
  347. rsassa
  348. .IP \[bu] 2
  349. rsapss
  350. .IP \[bu] 2
  351. ecdsa
  352. .IP \[bu] 2
  353. ecschnorr
  354. .SS Multiple Option Scheme Specifiers
  355. .PP
  356. This scheme specifier is followed by a count (max size UINT16) then
  357. followed by a dash(\-) and a valid hash algorithm.
  358. * ecdaa For example, ecdaa4\-sha256.
  359. If no count is specified, it defaults to 4.
  360. .SS No Option Scheme Specifiers
  361. .PP
  362. This scheme specifier takes NO arguments.
  363. * rsaes
  364. .SS Symmetric Details Specifiers
  365. .PP
  366. This field is optional, and defaults based on the \f[I]type\f[] of
  367. object being created and it\[aq]s attributes.
  368. Generally, any valid \f[B]Symmetric\f[] specifier from the \f[B]Type
  369. Specifiers\f[] list should work.
  370. If not specified, an asymmetric objects symmetric details defaults to
  371. \f[I]aes128cfb\f[].
  372. .SS Examples
  373. .SS Create an rsa2048 key with an rsaes asymmetric encryption scheme
  374. .PP
  375. \f[C]tpm2_create\ \-C\ parent.ctx\ \-G\ rsa2048:rsaes\ \-u\ key.pub\ \-r\ key.priv\f[]
  376. .SS Create an ecc256 key with an ecdaa signing scheme with a count of 4
  377. and sha384 hash
  378. .PP
  379. \f[C]/tpm2_create\ \-C\ parent.ctx\ \-G\ ecc256:ecdaa4\-sha384\ \-u\ key.pub\ \-r\ key.priv\f[]
  380. cryptographic algorithms \f[I]ALGORITHM\f[].
  381. .SH COMMON OPTIONS
  382. .PP
  383. This collection of options are common to many programs and provide
  384. information that many users may expect.
  385. .IP \[bu] 2
  386. \f[B]\-h\f[], \f[B]\-\-help=[man|no\-man]\f[]: Display the tools
  387. manpage.
  388. By default, it attempts to invoke the manpager for the tool, however, on
  389. failure will output a short tool summary.
  390. This is the same behavior if the "man" option argument is specified,
  391. however if explicit "man" is requested, the tool will provide errors
  392. from man on stderr.
  393. If the "no\-man" option if specified, or the manpager fails, the short
  394. options will be output to stdout.
  395. .RS 2
  396. .PP
  397. To successfully use the manpages feature requires the manpages to be
  398. installed or on \f[I]MANPATH\f[], See man(1) for more details.
  399. .RE
  400. .IP \[bu] 2
  401. \f[B]\-v\f[], \f[B]\-\-version\f[]: Display version information for this
  402. tool, supported tctis and exit.
  403. .IP \[bu] 2
  404. \f[B]\-V\f[], \f[B]\-\-verbose\f[]: Increase the information that the
  405. tool prints to the console during its execution.
  406. When using this option the file and line number are printed.
  407. .IP \[bu] 2
  408. \f[B]\-Q\f[], \f[B]\-\-quiet\f[]: Silence normal tool output to stdout.
  409. .IP \[bu] 2
  410. \f[B]\-Z\f[], \f[B]\-\-enable\-errata\f[]: Enable the application of
  411. errata fixups.
  412. Useful if an errata fixup needs to be applied to commands sent to the
  413. TPM.
  414. Defining the environment TPM2TOOLS_ENABLE_ERRATA is equivalent.
  415. information many users may expect.
  416. .SH TCTI Configuration
  417. .PP
  418. The TCTI or "Transmission Interface" is the communication mechanism with
  419. the TPM.
  420. TCTIs can be changed for communication with TPMs across different
  421. mediums.
  422. .PP
  423. To control the TCTI, the tools respect:
  424. .IP "1." 3
  425. The command line option \f[B]\-T\f[] or \f[B]\-\-tcti\f[]
  426. .IP "2." 3
  427. The environment variable: \f[I]TPM2TOOLS_TCTI\f[].
  428. .PP
  429. \f[B]Note:\f[] The command line option always overrides the environment
  430. variable.
  431. .PP
  432. The current known TCTIs are:
  433. .IP \[bu] 2
  434. tabrmd \- The resource manager, called
  435. tabrmd (https://github.com/tpm2-software/tpm2-abrmd).
  436. Note that tabrmd and abrmd as a tcti name are synonymous.
  437. .IP \[bu] 2
  438. mssim \- Typically used for communicating to the TPM software simulator.
  439. .IP \[bu] 2
  440. device \- Used when talking directly to a TPM device file.
  441. .IP \[bu] 2
  442. none \- Do not initalize a connection with the TPM.
  443. Some tools allow for off\-tpm options and thus support not using a TCTI.
  444. Tools that do not support it will error when attempted to be used
  445. without a TCTI connection.
  446. Does not support \f[I]ANY\f[] options and \f[I]MUST BE\f[] presented as
  447. the exact text of "none".
  448. .PP
  449. The arguments to either the command line option or the environment
  450. variable are in the form:
  451. .PP
  452. \f[C]<tcti\-name>:<tcti\-option\-config>\f[]
  453. .PP
  454. Specifying an empty string for either the \f[C]<tcti\-name>\f[] or
  455. \f[C]<tcti\-option\-config>\f[] results in the default being used for
  456. that portion respectively.
  457. .SS TCTI Defaults
  458. .PP
  459. When a TCTI is not specified, the default TCTI is searched for using
  460. \f[I]dlopen(3)\f[] semantics.
  461. The tools will search for \f[I]tabrmd\f[], \f[I]device\f[] and
  462. \f[I]mssim\f[] TCTIs \f[B]IN THAT ORDER\f[] and \f[B]USE THE FIRST ONE
  463. FOUND\f[].
  464. You can query what TCTI will be chosen as the default by using the
  465. \f[B]\-v\f[] option to print the version information.
  466. The "default\-tcti" key\-value pair will indicate which of the
  467. aforementioned TCTIs is the default.
  468. .SS Custom TCTIs
  469. .PP
  470. Any TCTI that implements the dynamic TCTI interface can be loaded.
  471. The tools internally use \f[I]dlopen(3)\f[], and the raw
  472. \f[I]tcti\-name\f[] value is used for the lookup.
  473. Thus, this could be a path to the shared library, or a library name as
  474. understood by \f[I]dlopen(3)\f[] semantics.
  475. .SH TCTI OPTIONS
  476. .PP
  477. This collection of options are used to configure the various known TCTI
  478. modules available:
  479. .IP \[bu] 2
  480. \f[B]device\f[]: For the device TCTI, the TPM character device file for
  481. use by the device TCTI can be specified.
  482. The default is \f[I]/dev/tpm0\f[].
  483. .RS 2
  484. .PP
  485. Example: \f[B]\-T device:/dev/tpm0\f[] or \f[B]export
  486. \f[I]TPM2TOOLS_TCTI\f[]="device:/dev/tpm0"\f[]
  487. .RE
  488. .IP \[bu] 2
  489. \f[B]mssim\f[]: For the mssim TCTI, the domain name or IP address and
  490. port number used by the simulator can be specified.
  491. The default are 127.0.0.1 and 2321.
  492. .RS 2
  493. .PP
  494. Example: \f[B]\-T mssim:host=localhost,port=2321\f[] or \f[B]export
  495. \f[I]TPM2TOOLS_TCTI\f[]="mssim:host=localhost,port=2321"\f[]
  496. .RE
  497. .IP \[bu] 2
  498. \f[B]abrmd\f[]: For the abrmd TCTI, the configuration string format is a
  499. series of simple key value pairs separated by a \[aq],\[aq] character.
  500. Each key and value string are separated by a \[aq]=\[aq] character.
  501. .RS 2
  502. .IP \[bu] 2
  503. TCTI abrmd supports two keys:
  504. .RS 2
  505. .IP "1." 3
  506. \[aq]bus_name\[aq] : The name of the tabrmd service on the bus (a
  507. string).
  508. .IP "2." 3
  509. \[aq]bus_type\[aq] : The type of the dbus instance (a string) limited to
  510. \[aq]session\[aq] and \[aq]system\[aq].
  511. .RE
  512. .PP
  513. Specify the tabrmd tcti name and a config string of
  514. \f[C]bus_name=com.example.FooBar\f[]:
  515. .PP
  516. \f[C]\\\-\-tcti=tabrmd:bus_name=com.example.FooBar\f[]
  517. .PP
  518. Specify the default (abrmd) tcti and a config string of
  519. \f[C]bus_type=session\f[]:
  520. .PP
  521. \f[C]\\\-\-tcti:bus_type=session\f[]
  522. .PP
  523. \f[B]NOTE\f[]: abrmd and tabrmd are synonymous.
  524. the various known TCTI modules.
  525. .RE
  526. .SH EXAMPLES
  527. .SS Set a blank authorization policy for endorsement hierarchy
  528. .IP
  529. .nf
  530. \f[C]
  531. tpm2_setprimarypolicy\ \-C\ e
  532. \f[]
  533. .fi
  534. .SH Returns
  535. .PP
  536. Tools can return any of the following codes:
  537. .IP \[bu] 2
  538. 0 \- Success.
  539. .IP \[bu] 2
  540. 1 \- General non\-specific error.
  541. .IP \[bu] 2
  542. 2 \- Options handling error.
  543. .IP \[bu] 2
  544. 3 \- Authentication error.
  545. .IP \[bu] 2
  546. 4 \- TCTI related error.
  547. .IP \[bu] 2
  548. 5 \- Non supported scheme.
  549. Applicable to tpm2_testparams.
  550. .SH BUGS
  551. .PP
  552. Github Issues (https://github.com/tpm2-software/tpm2-tools/issues)
  553. .SH HELP
  554. .PP
  555. See the Mailing List (https://lists.01.org/mailman/listinfo/tpm2)