1tpm2_policylocality(1) General Commands Manual tpm2_policylocality(1)
2
3
4
6 tpm2_policylocality(1) - Restrict TPM object authorization to specific
7 localities.
8
10 tpm2_policylocality [OPTIONS] [ARGUMENT]
11
13 tpm2_policylocality(1) - Restricts TPM object authorization to specific
14 TPM locality. Useful when you want to allow only specific locality
15 with the TPM object. A locality indicates the source of the command,
16 for example it could be from the application layer or the driver layer,
17 each would have it’s own locality integer. Localities are hints to the
18 TPM and are enforced by the software communicating to the TPM. Thus
19 they are not trusted inputs on their own and are implemented in plat‐
20 form specific ways.
21
22 As an argument it takes the LOCALITY as an integer or friendly name.
23
24 Localities are fixed to a byte in size and have two representations,
25 locality and extended locality.
26
27 Localities 0 through 4 are the normal locality representation and are
28 represented as set bit indexes. Thus locality 0 is indicated by 1<<0
29 and locality 4 is indicated by 1<<4. Rather then using raw numbers,
30 these localities can also be specified by the friendly names of: - ze‐
31 ro: locality 0 or 1<<0 - one: locality 1 or 1<<1 - two: locality 2 or
32 1<<2 - three: locality 3 or 1<<3 - four: locality 4 or 1<<4
33
34 Anything from the range 32 - 255 are extended localities.
35
37 • -S, --session=FILE:
38
39 A session file from tpm2_startauthsession(1)’s -S option.
40
41 • -L, --policy=FILE:
42
43 File to save the policy digest.
44
45 • ARGUMENT the command line argument specifies the locality number.
46
47 References
49 This collection of options are common to many programs and provide in‐
50 formation that many users may expect.
51
52 • -h, --help=[man|no-man]: Display the tools manpage. By default, it
53 attempts to invoke the manpager for the tool, however, on failure
54 will output a short tool summary. This is the same behavior if the
55 “man” option argument is specified, however if explicit “man” is re‐
56 quested, the tool will provide errors from man on stderr. If the
57 “no-man” option if specified, or the manpager fails, the short op‐
58 tions will be output to stdout.
59
60 To successfully use the manpages feature requires the manpages to be
61 installed or on MANPATH, See man(1) for more details.
62
63 • -v, --version: Display version information for this tool, supported
64 tctis and exit.
65
66 • -V, --verbose: Increase the information that the tool prints to the
67 console during its execution. When using this option the file and
68 line number are printed.
69
70 • -Q, --quiet: Silence normal tool output to stdout.
71
72 • -Z, --enable-errata: Enable the application of errata fixups. Useful
73 if an errata fixup needs to be applied to commands sent to the TPM.
74 Defining the environment TPM2TOOLS_ENABLE_ERRATA is equivalent. in‐
75 formation many users may expect.
76
78 The TCTI or “Transmission Interface” is the communication mechanism
79 with the TPM. TCTIs can be changed for communication with TPMs across
80 different mediums.
81
82 To control the TCTI, the tools respect:
83
84 1. The command line option -T or --tcti
85
86 2. The environment variable: TPM2TOOLS_TCTI.
87
88 Note: The command line option always overrides the environment vari‐
89 able.
90
91 The current known TCTIs are:
92
93 • tabrmd - The resource manager, called tabrmd
94 (https://github.com/tpm2-software/tpm2-abrmd). Note that tabrmd and
95 abrmd as a tcti name are synonymous.
96
97 • mssim - Typically used for communicating to the TPM software simula‐
98 tor.
99
100 • device - Used when talking directly to a TPM device file.
101
102 • none - Do not initalize a connection with the TPM. Some tools allow
103 for off-tpm options and thus support not using a TCTI. Tools that do
104 not support it will error when attempted to be used without a TCTI
105 connection. Does not support ANY options and MUST BE presented as
106 the exact text of “none”.
107
108 The arguments to either the command line option or the environment
109 variable are in the form:
110
111 <tcti-name>:<tcti-option-config>
112
113 Specifying an empty string for either the <tcti-name> or <tcti-op‐
114 tion-config> results in the default being used for that portion respec‐
115 tively.
116
117 TCTI Defaults
118 When a TCTI is not specified, the default TCTI is searched for using
119 dlopen(3) semantics. The tools will search for tabrmd, device and
120 mssim TCTIs IN THAT ORDER and USE THE FIRST ONE FOUND. You can query
121 what TCTI will be chosen as the default by using the -v option to print
122 the version information. The “default-tcti” key-value pair will indi‐
123 cate which of the aforementioned TCTIs is the default.
124
125 Custom TCTIs
126 Any TCTI that implements the dynamic TCTI interface can be loaded. The
127 tools internally use dlopen(3), and the raw tcti-name value is used for
128 the lookup. Thus, this could be a path to the shared library, or a li‐
129 brary name as understood by dlopen(3) semantics.
130
132 This collection of options are used to configure the various known TCTI
133 modules available:
134
135 • device: For the device TCTI, the TPM character device file for use by
136 the device TCTI can be specified. The default is /dev/tpm0.
137
138 Example: -T device:/dev/tpm0 or export TPM2TOOLS_TCTI=“de‐
139 vice:/dev/tpm0”
140
141 • mssim: For the mssim TCTI, the domain name or IP address and port
142 number used by the simulator can be specified. The default are
143 127.0.0.1 and 2321.
144
145 Example: -T mssim:host=localhost,port=2321 or export TPM2TOOLS_TC‐
146 TI=“mssim:host=localhost,port=2321”
147
148 • abrmd: For the abrmd TCTI, the configuration string format is a se‐
149 ries of simple key value pairs separated by a `,' character. Each
150 key and value string are separated by a `=' character.
151
152 • TCTI abrmd supports two keys:
153
154 1. `bus_name' : The name of the tabrmd service on the bus (a
155 string).
156
157 2. `bus_type' : The type of the dbus instance (a string) limited to
158 `session' and `system'.
159
160 Specify the tabrmd tcti name and a config string of bus_name=com.ex‐
161 ample.FooBar:
162
163 \--tcti=tabrmd:bus_name=com.example.FooBar
164
165 Specify the default (abrmd) tcti and a config string of bus_type=ses‐
166 sion:
167
168 \--tcti:bus_type=session
169
170 NOTE: abrmd and tabrmd are synonymous. the various known TCTI mod‐
171 ules.
172
174 Start a policy session and extend it with a specific locality number
175 (like 3). Attempts to perform other operations would fail.
176
177 Create an policy restricted by locality 3
178 tpm2_startauthsession -S session.dat
179
180 tpm2_policylocality -S session.dat -L policy.dat three
181
182 tpm2_flushcontext session.dat
183
184 Create the object with auth policy
185 tpm2_createprimary -C o -c prim.ctx
186
187 tpm2_create -C prim.ctx -u sealkey.pub -r sealkey.priv -L policy.dat \
188 -i- <<< "SEALED-SECRET"
189
190 Try unseal operation
191 tpm2_load -C prim.ctx -u sealkey.pub -r sealkey.priv -n sealkey.name \
192 -c sealkey.ctx
193
194 tpm2_startauthsession \--policy-session -S session.dat
195
196 tpm2_policylocality -S session.dat -L policy.dat three
197
198 # Change to locality 3, Note: this operation varies on different platforms
199
200 tpm2_unseal -p session:session.dat -c sealkey.ctx
201
202 tpm2_flushcontext session.dat
203
205 Tools can return any of the following codes:
206
207 • 0 - Success.
208
209 • 1 - General non-specific error.
210
211 • 2 - Options handling error.
212
213 • 3 - Authentication error.
214
215 • 4 - TCTI related error.
216
217 • 5 - Non supported scheme. Applicable to tpm2_testparams.
218
220 It expects a session to be already established via tpm2_startauthses‐
221 sion(1) and requires one of the following:
222
223 • direct device access
224
225 • extended session support with tpm2-abrmd.
226
227 Without it, most resource managers will not save session state between
228 command invocations.
229
231 Github Issues (https://github.com/tpm2-software/tpm2-tools/issues)
232
234 See the Mailing List (https://lists.01.org/mailman/listinfo/tpm2)
235
236
237
238tpm2-tools tpm2_policylocality(1)