1tpm2_policyauthorizenv(1) General Commands Manual tpm2_policyauthorizenv(1)
2
3
4
6 tpm2_policyauthorizenv(1) - Allows for mutable policies by referencing
7 to a policy from an NV index.
8
10 tpm2_policyauthorizenv [OPTIONS] [ARGUMENT]
11
13 tpm2_policyauthorizenv(1) - This command allows for policies to change
14 by referencing the authorization policy written to an NV index. The NV
15 index containing the authorization policy should remain readable even
16 for trial session. The index can be specified as raw handle or an off‐
17 set value to the nv handle range “TPM2_HR_NV_INDEX”.
18
20 • -C, --hierarchy=OBJECT:
21 Specifies the hierarchy used to authorize. Supported options are:
22
23 • o for TPM_RH_OWNER
24
25 • p for TPM_RH_PLATFORM
26
27 • <num> where a hierarchy handle or nv-index may be used.
28
29 When -C isn’t explicitly passed the index handle will be used to au‐
30 thorize against the index. The index auth value is set via the -p
31 option to tpm2_nvdefine(1).
32
33 • -P, --auth=AUTH:
34
35 Specifies the authorization value for the hierarchy.
36
37 • -L, --policy=FILE:
38
39 File to save the policy digest.
40
41 • -S, --session=FILE:
42
43 The policy session file generated via the -S option to tpm2_star‐
44 tauthsession(1).
45
46 • --cphash=FILE
47
48 File path to record the hash of the command parameters. This is com‐
49 monly termed as cpHash. NOTE: When this option is selected, The tool
50 will not actually execute the command, it simply returns a cpHash.
51
52 References
54 This collection of options are common to many programs and provide in‐
55 formation that many users may expect.
56
57 • -h, --help=[man|no-man]: Display the tools manpage. By default, it
58 attempts to invoke the manpager for the tool, however, on failure
59 will output a short tool summary. This is the same behavior if the
60 “man” option argument is specified, however if explicit “man” is re‐
61 quested, the tool will provide errors from man on stderr. If the
62 “no-man” option if specified, or the manpager fails, the short op‐
63 tions will be output to stdout.
64
65 To successfully use the manpages feature requires the manpages to be
66 installed or on MANPATH, See man(1) for more details.
67
68 • -v, --version: Display version information for this tool, supported
69 tctis and exit.
70
71 • -V, --verbose: Increase the information that the tool prints to the
72 console during its execution. When using this option the file and
73 line number are printed.
74
75 • -Q, --quiet: Silence normal tool output to stdout.
76
77 • -Z, --enable-errata: Enable the application of errata fixups. Useful
78 if an errata fixup needs to be applied to commands sent to the TPM.
79 Defining the environment TPM2TOOLS_ENABLE_ERRATA is equivalent. in‐
80 formation many users may expect.
81
83 The TCTI or “Transmission Interface” is the communication mechanism
84 with the TPM. TCTIs can be changed for communication with TPMs across
85 different mediums.
86
87 To control the TCTI, the tools respect:
88
89 1. The command line option -T or --tcti
90
91 2. The environment variable: TPM2TOOLS_TCTI.
92
93 Note: The command line option always overrides the environment vari‐
94 able.
95
96 The current known TCTIs are:
97
98 • tabrmd - The resource manager, called tabrmd
99 (https://github.com/tpm2-software/tpm2-abrmd). Note that tabrmd and
100 abrmd as a tcti name are synonymous.
101
102 • mssim - Typically used for communicating to the TPM software simula‐
103 tor.
104
105 • device - Used when talking directly to a TPM device file.
106
107 • none - Do not initalize a connection with the TPM. Some tools allow
108 for off-tpm options and thus support not using a TCTI. Tools that do
109 not support it will error when attempted to be used without a TCTI
110 connection. Does not support ANY options and MUST BE presented as
111 the exact text of “none”.
112
113 The arguments to either the command line option or the environment
114 variable are in the form:
115
116 <tcti-name>:<tcti-option-config>
117
118 Specifying an empty string for either the <tcti-name> or <tcti-op‐
119 tion-config> results in the default being used for that portion respec‐
120 tively.
121
122 TCTI Defaults
123 When a TCTI is not specified, the default TCTI is searched for using
124 dlopen(3) semantics. The tools will search for tabrmd, device and
125 mssim TCTIs IN THAT ORDER and USE THE FIRST ONE FOUND. You can query
126 what TCTI will be chosen as the default by using the -v option to print
127 the version information. The “default-tcti” key-value pair will indi‐
128 cate which of the aforementioned TCTIs is the default.
129
130 Custom TCTIs
131 Any TCTI that implements the dynamic TCTI interface can be loaded. The
132 tools internally use dlopen(3), and the raw tcti-name value is used for
133 the lookup. Thus, this could be a path to the shared library, or a li‐
134 brary name as understood by dlopen(3) semantics.
135
137 This collection of options are used to configure the various known TCTI
138 modules available:
139
140 • device: For the device TCTI, the TPM character device file for use by
141 the device TCTI can be specified. The default is /dev/tpm0.
142
143 Example: -T device:/dev/tpm0 or export TPM2TOOLS_TCTI=“de‐
144 vice:/dev/tpm0”
145
146 • mssim: For the mssim TCTI, the domain name or IP address and port
147 number used by the simulator can be specified. The default are
148 127.0.0.1 and 2321.
149
150 Example: -T mssim:host=localhost,port=2321 or export TPM2TOOLS_TC‐
151 TI=“mssim:host=localhost,port=2321”
152
153 • abrmd: For the abrmd TCTI, the configuration string format is a se‐
154 ries of simple key value pairs separated by a `,' character. Each
155 key and value string are separated by a `=' character.
156
157 • TCTI abrmd supports two keys:
158
159 1. `bus_name' : The name of the tabrmd service on the bus (a
160 string).
161
162 2. `bus_type' : The type of the dbus instance (a string) limited to
163 `session' and `system'.
164
165 Specify the tabrmd tcti name and a config string of bus_name=com.ex‐
166 ample.FooBar:
167
168 \--tcti=tabrmd:bus_name=com.example.FooBar
169
170 Specify the default (abrmd) tcti and a config string of bus_type=ses‐
171 sion:
172
173 \--tcti:bus_type=session
174
175 NOTE: abrmd and tabrmd are synonymous. the various known TCTI mod‐
176 ules.
177
179 Create a policypassword and write the policy digest to an NV Index.
180 Build a policyauthorizenv policy referencing the NV index in a trial
181 session. The resultant policy digest is then used in creation of ob‐
182 jects.
183
184 In a policy authorization session, first satisfy the policy written to
185 the NV index. Then run the policyauthorizenv which satisfies the au‐
186 thorization for the object.
187
188 Define the test NV Index to store the auth policy
189 nv_test_index=0x01500001
190 tpm2_nvdefine -C o -p nvpass $nv_test_index -a "authread|authwrite" -s 34
191
192 Define the auth policy
193 tpm2_startauthsession -S session.ctx
194 tpm2_policypassword -S session.ctx -L policy.pass
195 tpm2_flushcontext session.ctx
196
197 Write the auth policy to the NV Index
198 echo "000b" | xxd -p -r | cat - policy.pass | \
199 tpm2_nvwrite -C $nv_test_index -P nvpass $nv_test_index -i-
200
201 Define the policyauthorizenv
202 tpm2_startauthsession -S session.ctx
203 tpm2_policyauthorizenv -S session.ctx -C $nv_test_index -P nvpass \
204 -L policyauthorizenv.1500001 $nv_test_index
205 tpm2_flushcontext session.ctx
206
207 Create and load a sealing object with auth policy = policyauthorizenv
208 tpm2_createprimary -C o -c prim.ctx
209
210 echo "secretdata" | \
211 tpm2_create -C prim.ctx -u key.pub -r key.priv \
212 -a "fixedtpm|fixedparent|adminwithpolicy" -L policyauthorizenv.1500001 -i-
213
214 tpm2_load -C prim.ctx -u key.pub -r key.priv -c key.ctx
215
216 Satisfy the auth policy stored in the NV Index and thus policyauthorizenv
217 tpm2_startauthsession -S session.ctx --policy-session
218 tpm2_policypassword -S session.ctx
219 tpm2_policyauthorizenv -S session.ctx -C $nv_test_index -P nvpass $nv_test_index
220 tpm2_unseal -c key.ctx -p session:session.ctx
221 tpm2_flushcontext session.ctx
222
224 Tools can return any of the following codes:
225
226 • 0 - Success.
227
228 • 1 - General non-specific error.
229
230 • 2 - Options handling error.
231
232 • 3 - Authentication error.
233
234 • 4 - TCTI related error.
235
236 • 5 - Non supported scheme. Applicable to tpm2_testparams.
237
239 It expects a session to be already established via tpm2_startauthses‐
240 sion(1) and requires one of the following:
241
242 • direct device access
243
244 • extended session support with tpm2-abrmd.
245
246 Without it, most resource managers will not save session state between
247 command invocations.
248
250 Github Issues (https://github.com/tpm2-software/tpm2-tools/issues)
251
253 See the Mailing List (https://lists.01.org/mailman/listinfo/tpm2)
254
255
256
257tpm2-tools tpm2_policyauthorizenv(1)