1tpm2_nvwritelock(1)         General Commands Manual        tpm2_nvwritelock(1)
2
3
4

NAME

6       tpm2_nvwritelock(1)  -  Lock  the  Non-Volatile  (NV) index for further
7       writes.
8

SYNOPSIS

10       tpm2_nvwritelock [OPTIONS] [ARGUMENT]
11

DESCRIPTION

13       tpm2_nvwritelock(1) - Lock the  Non-Volatile  (NV)  index  for  further
14       writes.  The lock on the NV index is unlocked when the TPM is restarted
15       and the NV index becomes writable again.  The index can be specified as
16       raw  handle  or  an offset value to the nv handle range "TPM2_HR_NV_IN‐
17       DEX".
18

OPTIONS

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       · --global:
38
39         Lock all NV indices with attribute TPMA_NV_GLOBALLOCK.   This  option
40         does not require an NV index or offset as an argument.
41
42       · ARGUMENT  the  command line argument specifies the NV index or offset
43         number.
44
45   References

Context Object Format

47       The type of a context object, whether it is a handle or file  name,  is
48       determined according to the following logic in-order:
49
50       · If the argument is a file path, then the file is loaded as a restored
51         TPM transient object.
52
53       · If the argument is a prefix match on one of:
54
55         · owner: the owner hierarchy
56
57         · platform: the platform hierarchy
58
59         · endorsement: the endorsement hierarchy
60
61         · lockout: the lockout control persistent object
62
63       · If the argument argument can be loaded as a number it will  be  treat
64         as a handle, e.g.  0x81010013 and used directly.OBJECT.
65

Authorization Formatting

67       Authorization  for  use  of an object in TPM2.0 can come in 3 different
68       forms: 1.  Password 2.  HMAC 3.  Sessions
69
70       NOTE: "Authorizations default to the EMPTY  PASSWORD  when  not  speci‐
71       fied".
72
73   Passwords
74       Passwords  are  interpreted  in  the following forms below using prefix
75       identifiers.
76
77       Note: By default passwords are assumed to be in the  string  form  when
78       they do not have a prefix.
79
80   String
81       A  string  password,  specified  by  prefix "str:" or it's absence (raw
82       string without prefix) is not interpreted, and is directly used for au‐
83       thorization.
84
85   Examples
86              foobar
87              str:foobar
88
89   Hex-string
90       A  hex-string  password, specified by prefix "hex:" is converted from a
91       hexidecimal form into a byte array form, thus allowing  passwords  with
92       non-printable and/or terminal un-friendly characters.
93
94   Example
95              hex:0x1122334455667788
96
97   File
98       A  file  based password, specified be prefix "file:" should be the path
99       of a file containing the password to be read by the tool or  a  "-"  to
100       use  stdin.   Storing  passwords in files prevents information leakage,
101       passwords passed as options can be read from the process list or common
102       shell history features.
103
104   Examples
105              # to use stdin and be prompted
106              file:-
107
108              # to use a file from a path
109              file:path/to/password/file
110
111              # to echo a password via stdin:
112              echo foobar | tpm2_tool -p file:-
113
114              # to use a bash here-string via stdin:
115
116              tpm2_tool -p file:- <<< foobar
117
118   Sessions
119       When  using  a policy session to authorize the use of an object, prefix
120       the option argument with the session keyword.  Then indicate a path  to
121       a session file that was created with tpm2_startauthsession(1).  Option‐
122       ally, if the session requires an auth value to be sent with the session
123       handle  (eg policy password), then append a + and a string as described
124       in the Passwords section.
125
126   Examples
127       To use a session context file called session.ctx.
128
129              session:session.ctx
130
131       To use a session context file called session.ctx AND send the authvalue
132       mypassword.
133
134              session:session.ctx+mypassword
135
136       To use a session context file called session.ctx AND send the HEX auth‐
137       value 0x11223344.
138
139              session:session.ctx+hex:11223344
140
141   PCR Authorizations
142       You can satisfy a PCR policy using the "pcr:" prefix and the PCR  mini‐
143       language.       The     PCR     minilanguage     is     as     follows:
144       <pcr-spec>=<raw-pcr-file>
145
146       The PCR spec is documented in in the section "PCR bank specifiers".
147
148       The raw-pcr-file is an optional the output of the raw PCR  contents  as
149       returned by tpm2_pcrread(1).
150
151       PCR bank specifiers (common/pcr.md)
152
153   Examples
154       To satisfy a PCR policy of sha256 on banks 0, 1, 2 and 3 use a specifi‐
155       er of:
156
157              pcr:sha256:0,1,2,3
158
159       specifying AUTH.
160

COMMON OPTIONS

162       This collection of options are common to many programs and provide  in‐
163       formation that many users may expect.
164
165       · -h,  --help=[man|no-man]:  Display the tools manpage.  By default, it
166         attempts to invoke the manpager for the  tool,  however,  on  failure
167         will  output  a short tool summary.  This is the same behavior if the
168         "man" option argument is specified, however if explicit "man" is  re‐
169         quested,  the  tool  will  provide errors from man on stderr.  If the
170         "no-man" option if specified, or the manpager fails,  the  short  op‐
171         tions will be output to stdout.
172
173         To  successfully use the manpages feature requires the manpages to be
174         installed or on MANPATH, See man(1) for more details.
175
176       · -v, --version: Display version information for this  tool,  supported
177         tctis and exit.
178
179       · -V,  --verbose:  Increase the information that the tool prints to the
180         console during its execution.  When using this option  the  file  and
181         line number are printed.
182
183       · -Q, --quiet: Silence normal tool output to stdout.
184
185       · -Z, --enable-errata: Enable the application of errata fixups.  Useful
186         if an errata fixup needs to be applied to commands sent to  the  TPM.
187         Defining  the environment TPM2TOOLS_ENABLE_ERRATA is equivalent.  in‐
188         formation many users may expect.
189

TCTI Configuration

191       The TCTI or "Transmission Interface"  is  the  communication  mechanism
192       with  the TPM.  TCTIs can be changed for communication with TPMs across
193       different mediums.
194
195       To control the TCTI, the tools respect:
196
197       1. The command line option -T or --tcti
198
199       2. The environment variable: TPM2TOOLS_TCTI.
200
201       Note: The command line option always overrides  the  environment  vari‐
202       able.
203
204       The current known TCTIs are:
205
206       · tabrmd      -     The     resource     manager,     called     tabrmd
207         (https://github.com/tpm2-software/tpm2-abrmd).  Note that tabrmd  and
208         abrmd as a tcti name are synonymous.
209
210       · mssim  - Typically used for communicating to the TPM software simula‐
211         tor.
212
213       · device - Used when talking directly to a TPM device file.
214
215       · none - Do not initalize a connection with the TPM.  Some tools  allow
216         for off-tpm options and thus support not using a TCTI.  Tools that do
217         not support it will error when attempted to be used  without  a  TCTI
218         connection.   Does  not  support ANY options and MUST BE presented as
219         the exact text of "none".
220
221       The arguments to either the command  line  option  or  the  environment
222       variable are in the form:
223
224       <tcti-name>:<tcti-option-config>
225
226       Specifying  an  empty  string  for  either the <tcti-name> or <tcti-op‐
227       tion-config> results in the default being used for that portion respec‐
228       tively.
229
230   TCTI Defaults
231       When  a  TCTI  is not specified, the default TCTI is searched for using
232       dlopen(3) semantics.  The tools will  search  for  tabrmd,  device  and
233       mssim  TCTIs  IN THAT ORDER and USE THE FIRST ONE FOUND.  You can query
234       what TCTI will be chosen as the default by using the -v option to print
235       the  version information.  The "default-tcti" key-value pair will indi‐
236       cate which of the aforementioned TCTIs is the default.
237
238   Custom TCTIs
239       Any TCTI that implements the dynamic TCTI interface can be loaded.  The
240       tools internally use dlopen(3), and the raw tcti-name value is used for
241       the lookup.  Thus, this could be a path to the shared library, or a li‐
242       brary name as understood by dlopen(3) semantics.
243

TCTI OPTIONS

245       This collection of options are used to configure the various known TCTI
246       modules available:
247
248       · device: For the device TCTI, the TPM character device file for use by
249         the device TCTI can be specified.  The default is /dev/tpm0.
250
251         Example:    -T   device:/dev/tpm0   or   export   TPM2TOOLS_TCTI="de‐
252         vice:/dev/tpm0"
253
254       · mssim: For the mssim TCTI, the domain name or  IP  address  and  port
255         number  used  by  the  simulator  can  be specified.  The default are
256         127.0.0.1 and 2321.
257
258         Example: -T mssim:host=localhost,port=2321  or  export  TPM2TOOLS_TC‐
259         TI="mssim:host=localhost,port=2321"
260
261       · abrmd:  For  the abrmd TCTI, the configuration string format is a se‐
262         ries of simple key value pairs separated by a  ','  character.   Each
263         key and value string are separated by a '=' character.
264
265         · TCTI abrmd supports two keys:
266
267           1. 'bus_name'  :  The  name  of  the  tabrmd  service on the bus (a
268              string).
269
270           2. 'bus_type' : The type of the dbus instance (a string) limited to
271              'session' and 'system'.
272
273         Specify  the tabrmd tcti name and a config string of bus_name=com.ex‐
274         ample.FooBar:
275
276         \--tcti=tabrmd:bus_name=com.example.FooBar
277
278         Specify the default (abrmd) tcti and a config string of bus_type=ses‐
279         sion:
280
281         \--tcti:bus_type=session
282
283         NOTE:  abrmd  and tabrmd are synonymous.  the various known TCTI mod‐
284         ules.
285

EXAMPLES

287   Lock an index
288              tpm2_nvdefine -C o -s 32 \
289                -a "ownerread|policywrite|ownerwrite|writedefine" 1
290
291              echo "foobar" > nv.writelock
292
293              tpm2_nvwrite -C o -i nv.writelock 1
294
295              tpm2_nvwritelock -C o 1
296
297              # fails with "NV access locked"
298              tpm2_nvwrite -C o -i nv.writelock 1
299
300   Global Lock
301              tpm2_nvdefine -C o -s 32 \
302                -a "ownerread|policywrite|ownerwrite|globallock" 1
303
304              tpm2_nvwritelock -C o --global
305
306              # this command fails with "NV access locked".
307              echo foo | tpm2_nvwrite -C o -i- 1
308

Returns

310       Tools can return any of the following codes:
311
312       · 0 - Success.
313
314       · 1 - General non-specific error.
315
316       · 2 - Options handling error.
317
318       · 3 - Authentication error.
319
320       · 4 - TCTI related error.
321
322       · 5 - Non supported scheme.  Applicable to tpm2_testparams.
323

BUGS

325       Github Issues (https://github.com/tpm2-software/tpm2-tools/issues)
326

HELP

328       See the Mailing List (https://lists.01.org/mailman/listinfo/tpm2)
329
330
331
332tpm2-tools                                                 tpm2_nvwritelock(1)
Impressum