1tpm2_nvundefine(1) General Commands Manual tpm2_nvundefine(1)
2
3
4
6 tpm2_nvundefine(1) - Delete a Non-Volatile (NV) index.
7
9 tpm2_nvundefine [OPTIONS] [ARGUMENT]
10
12 tpm2_nvundefine(1) - Deletes a Non-Volatile (NV) index that was previ‐
13 ously defined with tpm2_nvdefine(1). The index is specified as an ar‐
14 gument. It can be specified as raw handle or an offset value to the nv
15 handle range “TPM2_HR_NV_INDEX”.
16
17 The tool is also capable of deleting NV indices with attribute TP‐
18 MA_NV_POLICY_DELETE, and the tool uses this attribute for the default
19 hierarchy to select when -C is missing. The default value for -C is
20 the “owner” hierarchy when TPMA_NV_POLICY_DELETE is clear and “plat‐
21 form” when TPMA_NV_POLICY_DELETE is set.
22
24 • -C, --hierarchy=OBJECT:
25 Specifies the hierarchy used to authorize. Supported options are:
26
27 • o for TPM_RH_OWNER
28
29 • p for TPM_RH_PLATFORM
30
31 • <num> where a hierarchy handle may be specified.
32
33 • -P, --auth=AUTH:
34
35 Specifies the authorization value for the hierarchy.
36
37 • -S, --session=POLICY_SESSION:
38 Specify a policy session to use when the NV index has attribute TP‐
39 MA_NV_POLICY_DELETE set. This can also be used to specify an auxil‐
40 iary session for auditing and or encryption/decryption of the parame‐
41 ters. Note:
42
43 1. If TPM2_CC_NV_UndefineSpaceSpecial is invoked then only one addi‐
44 tional aux session can be specified. The order of how sessions
45 are specified also matters. First specification of -S is inter‐
46 preted as the session for satisfying the ADMIN role required for
47 TPM2_CC_NV_UndefineSpaceSpecial.
48
49 2. If TPM2_CC_NV_Undefine is invoked then only two additional aux
50 sessions can be specified.
51
52 • --cphash=FILE
53
54 File path to record the hash of the command parameters. This is com‐
55 monly termed as cpHash. NOTE: When this option is selected, The tool
56 will not actually execute the command, it simply returns a cpHash, it
57 simply returns a cpHash unless rphash is also required.
58
59 • --rphash=FILE
60
61 File path to record the hash of the response parameters. This is
62 commonly termed as rpHash.
63
64 • --with-policydelete=NONE
65
66 This must be specified when calculating cpHash with --tcti=none.
67 This is a requirement because there is no way to know if the attri‐
68 bute TPMA_NV_POLICYDELETE has been set from the NV index name alone.
69
70 • -n, --name=FILE:
71
72 The name of the NV index that must be provided when only calculating
73 the cpHash without actually dispatching the command to the TPM.
74
75 • ARGUMENT the command line argument specifies the NV index or offset
76 number.
77
78 References
80 The type of a context object, whether it is a handle or file name, is
81 determined according to the following logic in-order:
82
83 • If the argument is a file path, then the file is loaded as a restored
84 TPM transient object.
85
86 • If the argument is a prefix match on one of:
87
88 • owner: the owner hierarchy
89
90 • platform: the platform hierarchy
91
92 • endorsement: the endorsement hierarchy
93
94 • lockout: the lockout control persistent object
95
96 • If the argument argument can be loaded as a number it will be treat
97 as a handle, e.g. 0x81010013 and used directly._OBJECT_.
98
100 Authorization for use of an object in TPM2.0 can come in 3 different
101 forms: 1. Password 2. HMAC 3. Sessions
102
103 NOTE: “Authorizations default to the EMPTY PASSWORD when not speci‐
104 fied”.
105
106 Passwords
107 Passwords are interpreted in the following forms below using prefix
108 identifiers.
109
110 Note: By default passwords are assumed to be in the string form when
111 they do not have a prefix.
112
113 String
114 A string password, specified by prefix “str:” or it’s absence (raw
115 string without prefix) is not interpreted, and is directly used for au‐
116 thorization.
117
118 Examples
119 foobar
120 str:foobar
121
122 Hex-string
123 A hex-string password, specified by prefix “hex:” is converted from a
124 hexidecimal form into a byte array form, thus allowing passwords with
125 non-printable and/or terminal un-friendly characters.
126
127 Example
128 hex:1122334455667788
129
130 File
131 A file based password, specified be prefix “file:” should be the path
132 of a file containing the password to be read by the tool or a “-” to
133 use stdin. Storing passwords in files prevents information leakage,
134 passwords passed as options can be read from the process list or common
135 shell history features.
136
137 Examples
138 # to use stdin and be prompted
139 file:-
140
141 # to use a file from a path
142 file:path/to/password/file
143
144 # to echo a password via stdin:
145 echo foobar | tpm2_tool -p file:-
146
147 # to use a bash here-string via stdin:
148
149 tpm2_tool -p file:- <<< foobar
150
151 Sessions
152 When using a policy session to authorize the use of an object, prefix
153 the option argument with the session keyword. Then indicate a path to
154 a session file that was created with tpm2_startauthsession(1). Option‐
155 ally, if the session requires an auth value to be sent with the session
156 handle (eg policy password), then append a + and a string as described
157 in the Passwords section.
158
159 Examples
160 To use a session context file called session.ctx.
161
162 session:session.ctx
163
164 To use a session context file called session.ctx AND send the authvalue
165 mypassword.
166
167 session:session.ctx+mypassword
168
169 To use a session context file called session.ctx AND send the HEX auth‐
170 value 0x11223344.
171
172 session:session.ctx+hex:11223344
173
174 PCR Authorizations
175 You can satisfy a PCR policy using the “pcr:” prefix and the PCR mini‐
176 language. The PCR minilanguage is as follows:
177 <pcr-spec>=<raw-pcr-file>
178
179 The PCR spec is documented in in the section “PCR bank specifiers”.
180
181 The raw-pcr-file is an optional argument that contains the output of
182 the raw PCR contents as returned by tpm2_pcrread(1).
183
184 PCR bank specifiers (pcr.md)
185
186 Examples
187 To satisfy a PCR policy of sha256 on banks 0, 1, 2 and 3 use a specifi‐
188 er of:
189
190 pcr:sha256:0,1,2,3
191
192 specifying AUTH.
193
195 This collection of options are common to many programs and provide in‐
196 formation that many users may expect.
197
198 • -h, --help=[man|no-man]: Display the tools manpage. By default, it
199 attempts to invoke the manpager for the tool, however, on failure
200 will output a short tool summary. This is the same behavior if the
201 “man” option argument is specified, however if explicit “man” is re‐
202 quested, the tool will provide errors from man on stderr. If the
203 “no-man” option if specified, or the manpager fails, the short op‐
204 tions will be output to stdout.
205
206 To successfully use the manpages feature requires the manpages to be
207 installed or on MANPATH, See man(1) for more details.
208
209 • -v, --version: Display version information for this tool, supported
210 tctis and exit.
211
212 • -V, --verbose: Increase the information that the tool prints to the
213 console during its execution. When using this option the file and
214 line number are printed.
215
216 • -Q, --quiet: Silence normal tool output to stdout.
217
218 • -Z, --enable-errata: Enable the application of errata fixups. Useful
219 if an errata fixup needs to be applied to commands sent to the TPM.
220 Defining the environment TPM2TOOLS_ENABLE_ERRATA is equivalent. in‐
221 formation many users may expect.
222
224 The TCTI or “Transmission Interface” is the communication mechanism
225 with the TPM. TCTIs can be changed for communication with TPMs across
226 different mediums.
227
228 To control the TCTI, the tools respect:
229
230 1. The command line option -T or --tcti
231
232 2. The environment variable: TPM2TOOLS_TCTI.
233
234 Note: The command line option always overrides the environment vari‐
235 able.
236
237 The current known TCTIs are:
238
239 • tabrmd - The resource manager, called tabrmd
240 (https://github.com/tpm2-software/tpm2-abrmd). Note that tabrmd and
241 abrmd as a tcti name are synonymous.
242
243 • mssim - Typically used for communicating to the TPM software simula‐
244 tor.
245
246 • device - Used when talking directly to a TPM device file.
247
248 • none - Do not initalize a connection with the TPM. Some tools allow
249 for off-tpm options and thus support not using a TCTI. Tools that do
250 not support it will error when attempted to be used without a TCTI
251 connection. Does not support ANY options and MUST BE presented as
252 the exact text of “none”.
253
254 The arguments to either the command line option or the environment
255 variable are in the form:
256
257 <tcti-name>:<tcti-option-config>
258
259 Specifying an empty string for either the <tcti-name> or <tcti-op‐
260 tion-config> results in the default being used for that portion respec‐
261 tively.
262
263 TCTI Defaults
264 When a TCTI is not specified, the default TCTI is searched for using
265 dlopen(3) semantics. The tools will search for tabrmd, device and
266 mssim TCTIs IN THAT ORDER and USE THE FIRST ONE FOUND. You can query
267 what TCTI will be chosen as the default by using the -v option to print
268 the version information. The “default-tcti” key-value pair will indi‐
269 cate which of the aforementioned TCTIs is the default.
270
271 Custom TCTIs
272 Any TCTI that implements the dynamic TCTI interface can be loaded. The
273 tools internally use dlopen(3), and the raw tcti-name value is used for
274 the lookup. Thus, this could be a path to the shared library, or a li‐
275 brary name as understood by dlopen(3) semantics.
276
278 This collection of options are used to configure the various known TCTI
279 modules available:
280
281 • device: For the device TCTI, the TPM character device file for use by
282 the device TCTI can be specified. The default is /dev/tpm0.
283
284 Example: -T device:/dev/tpm0 or export TPM2TOOLS_TCTI=“de‐
285 vice:/dev/tpm0”
286
287 • mssim: For the mssim TCTI, the domain name or IP address and port
288 number used by the simulator can be specified. The default are
289 127.0.0.1 and 2321.
290
291 Example: -T mssim:host=localhost,port=2321 or export TPM2TOOLS_TC‐
292 TI=“mssim:host=localhost,port=2321”
293
294 • abrmd: For the abrmd TCTI, the configuration string format is a se‐
295 ries of simple key value pairs separated by a `,' character. Each
296 key and value string are separated by a `=' character.
297
298 • TCTI abrmd supports two keys:
299
300 1. `bus_name' : The name of the tabrmd service on the bus (a
301 string).
302
303 2. `bus_type' : The type of the dbus instance (a string) limited to
304 `session' and `system'.
305
306 Specify the tabrmd tcti name and a config string of bus_name=com.ex‐
307 ample.FooBar:
308
309 \--tcti=tabrmd:bus_name=com.example.FooBar
310
311 Specify the default (abrmd) tcti and a config string of bus_type=ses‐
312 sion:
313
314 \--tcti:bus_type=session
315
316 NOTE: abrmd and tabrmd are synonymous. the various known TCTI mod‐
317 ules.
318
320 Define an ordinary NV index and delete it
321 tpm2_nvdefine 1
322
323 tpm2_nvundefine 1
324
325 Define an ordinary NV index with attribute TPMA_NV_POLICY_DELETE and delete
326 it
327 tpm2_startauthsession -S s.ctx
328
329 tpm2_policyauthvalue -S s.ctx
330
331 tpm2_policycommandcode -S s.ctx -L policy.dat TPM2_CC_NV_UndefineSpaceSpecial
332
333 tpm2_nvdefine -C p -s 32 \
334 -a "ppread|ppwrite|authread|authwrite|platformcreate|policydelete|write_stclear|read_stclear" \
335 -L policy.dat 1
336
337 tpm2_flushcontext s.ctx
338
339 tpm2_startauthsession --policy-session -S s.ctx
340
341 tpm2_policyauthvalue -S s.ctx
342
343 tpm2_policycommandcode -S s.ctx TPM2_CC_NV_UndefineSpaceSpecial
344
345 tpm2_nvundefine -S s.ctx 1
346
348 Tools can return any of the following codes:
349
350 • 0 - Success.
351
352 • 1 - General non-specific error.
353
354 • 2 - Options handling error.
355
356 • 3 - Authentication error.
357
358 • 4 - TCTI related error.
359
360 • 5 - Non supported scheme. Applicable to tpm2_testparams.
361
363 Github Issues (https://github.com/tpm2-software/tpm2-tools/issues)
364
366 See the Mailing List (https://lists.linuxfoundation.org/mailman/listin‐
367 fo/tpm2)
368
369
370
371tpm2-tools tpm2_nvundefine(1)