1tpm2_policynvwritten(1) General Commands Manual tpm2_policynvwritten(1)
2
3
4
6 tpm2_policynvwritten(1) - Restrict TPM object authorization to the
7 written state of an NV index.
8
10 tpm2_policynvwritten [OPTIONS] [ARGUMENT]
11
13 tpm2_policynvwritten(1) - Restricts TPM object authorization to the
14 written state of an NV index. Useful when creating write once NV in‐
15 dexes.
16
17 As an [ARGUMENT] it takes the expected written state of the NV index.
18 It can be specified as s|c|0|1.
19
21 • -S, --session=FILE:
22
23 A session file from tpm2_startauthsession(1)’s -S option.
24
25 • -L, --policy=FILE:
26
27 File to save the policy digest.
28
29 References
31 This collection of options are common to many programs and provide in‐
32 formation that many users may expect.
33
34 • -h, --help=[man|no-man]: Display the tools manpage. By default, it
35 attempts to invoke the manpager for the tool, however, on failure
36 will output a short tool summary. This is the same behavior if the
37 “man” option argument is specified, however if explicit “man” is re‐
38 quested, the tool will provide errors from man on stderr. If the
39 “no-man” option if specified, or the manpager fails, the short op‐
40 tions will be output to stdout.
41
42 To successfully use the manpages feature requires the manpages to be
43 installed or on MANPATH, See man(1) for more details.
44
45 • -v, --version: Display version information for this tool, supported
46 tctis and exit.
47
48 • -V, --verbose: Increase the information that the tool prints to the
49 console during its execution. When using this option the file and
50 line number are printed.
51
52 • -Q, --quiet: Silence normal tool output to stdout.
53
54 • -Z, --enable-errata: Enable the application of errata fixups. Useful
55 if an errata fixup needs to be applied to commands sent to the TPM.
56 Defining the environment TPM2TOOLS_ENABLE_ERRATA is equivalent. in‐
57 formation many users may expect.
58
60 The TCTI or “Transmission Interface” is the communication mechanism
61 with the TPM. TCTIs can be changed for communication with TPMs across
62 different mediums.
63
64 To control the TCTI, the tools respect:
65
66 1. The command line option -T or --tcti
67
68 2. The environment variable: TPM2TOOLS_TCTI.
69
70 Note: The command line option always overrides the environment vari‐
71 able.
72
73 The current known TCTIs are:
74
75 • tabrmd - The resource manager, called tabrmd
76 (https://github.com/tpm2-software/tpm2-abrmd). Note that tabrmd and
77 abrmd as a tcti name are synonymous.
78
79 • mssim - Typically used for communicating to the TPM software simula‐
80 tor.
81
82 • device - Used when talking directly to a TPM device file.
83
84 • none - Do not initalize a connection with the TPM. Some tools allow
85 for off-tpm options and thus support not using a TCTI. Tools that do
86 not support it will error when attempted to be used without a TCTI
87 connection. Does not support ANY options and MUST BE presented as
88 the exact text of “none”.
89
90 The arguments to either the command line option or the environment
91 variable are in the form:
92
93 <tcti-name>:<tcti-option-config>
94
95 Specifying an empty string for either the <tcti-name> or <tcti-op‐
96 tion-config> results in the default being used for that portion respec‐
97 tively.
98
99 TCTI Defaults
100 When a TCTI is not specified, the default TCTI is searched for using
101 dlopen(3) semantics. The tools will search for tabrmd, device and
102 mssim TCTIs IN THAT ORDER and USE THE FIRST ONE FOUND. You can query
103 what TCTI will be chosen as the default by using the -v option to print
104 the version information. The “default-tcti” key-value pair will indi‐
105 cate which of the aforementioned TCTIs is the default.
106
107 Custom TCTIs
108 Any TCTI that implements the dynamic TCTI interface can be loaded. The
109 tools internally use dlopen(3), and the raw tcti-name value is used for
110 the lookup. Thus, this could be a path to the shared library, or a li‐
111 brary name as understood by dlopen(3) semantics.
112
114 This collection of options are used to configure the various known TCTI
115 modules available:
116
117 • device: For the device TCTI, the TPM character device file for use by
118 the device TCTI can be specified. The default is /dev/tpm0.
119
120 Example: -T device:/dev/tpm0 or export TPM2TOOLS_TCTI=“de‐
121 vice:/dev/tpm0”
122
123 • mssim: For the mssim TCTI, the domain name or IP address and port
124 number used by the simulator can be specified. The default are
125 127.0.0.1 and 2321.
126
127 Example: -T mssim:host=localhost,port=2321 or export TPM2TOOLS_TC‐
128 TI=“mssim:host=localhost,port=2321”
129
130 • abrmd: For the abrmd TCTI, the configuration string format is a se‐
131 ries of simple key value pairs separated by a `,' character. Each
132 key and value string are separated by a `=' character.
133
134 • TCTI abrmd supports two keys:
135
136 1. `bus_name' : The name of the tabrmd service on the bus (a
137 string).
138
139 2. `bus_type' : The type of the dbus instance (a string) limited to
140 `session' and `system'.
141
142 Specify the tabrmd tcti name and a config string of bus_name=com.ex‐
143 ample.FooBar:
144
145 \--tcti=tabrmd:bus_name=com.example.FooBar
146
147 Specify the default (abrmd) tcti and a config string of bus_type=ses‐
148 sion:
149
150 \--tcti:bus_type=session
151
152 NOTE: abrmd and tabrmd are synonymous. the various known TCTI mod‐
153 ules.
154
156 Create a write once NV index. To do this the NV index is defined with
157 a write policy that is valid only if the NV index attribute “TP‐
158 MA_NV_WRITTEN” was never set.
159
160 Define the NV index write policy
161 tpm2_startauthsession -S session.dat
162 tpm2_policycommandcode -S session.dat TPM2_CC_NV_Write
163 tpm2_policynvwritten -S session.dat -L nvwrite.policy c
164 tpm2_flushcontext session.dat
165
166 Define the NV index with the policy
167 tpm2_nvdefine -s 1 -a "authread|policywrite" -p nvrdpass -L nvwrite.policy
168
169 Write the NV index by satisfying the policy
170 tpm2_startauthsession -S session.dat --policy-session
171 tpm2_policycommandcode -S session.dat TPM2_CC_NV_Write
172 tpm2_policynvwritten -S session.dat c
173 echo 0xAA | xxd -r -p | tpm2_nvwrite 0x01000000 -i- -P session:session.dat
174 tpm2_flushcontext session.dat
175
177 Tools can return any of the following codes:
178
179 • 0 - Success.
180
181 • 1 - General non-specific error.
182
183 • 2 - Options handling error.
184
185 • 3 - Authentication error.
186
187 • 4 - TCTI related error.
188
189 • 5 - Non supported scheme. Applicable to tpm2_testparams.
190
192 It expects a session to be already established via tpm2_startauthses‐
193 sion(1) and requires one of the following:
194
195 • direct device access
196
197 • extended session support with tpm2-abrmd.
198
199 Without it, most resource managers will not save session state between
200 command invocations.
201
203 Github Issues (https://github.com/tpm2-software/tpm2-tools/issues)
204
206 See the Mailing List (https://lists.01.org/mailman/listinfo/tpm2)
207
208
209
210tpm2-tools tpm2_policynvwritten(1)