1tpm2_policyrestart(1) General Commands Manual tpm2_policyrestart(1)
2
3
4
6 tpm2_policyrestart(1) - Restart an existing session with the TPM.
7
9 tpm2_policyrestart [OPTIONS]
10
12 tpm2_policyrestart(1) - Restarts a session with the TPM back to it’s
13 initial state. This is useful when the TPM gives one a
14 TPM_RC_PCR_CHANGED (0x00000128) error code when using a PCR policy ses‐
15 sion.
16
17 This will be returned if a PCR state affecting policy is altered during
18 the session. One could restart the session and try again, however, the
19 PCR state would still need to satisfy the policy.
20
22 • -S, --session=FILE:
23
24 Optional, A session file from tpm2_startauthsession(1)’s -S option.
25 This session is used in lieu of starting a session and using the PCR
26 policy options.
27
28 • --cphash=FILE
29
30 File path to record the hash of the command parameters. This is com‐
31 monly termed as cpHash. NOTE: When this option is selected, The tool
32 will not actually execute the command, it simply returns a cpHash.
33
34 References
36 This collection of options are common to many programs and provide in‐
37 formation that many users may expect.
38
39 • -h, --help=[man|no-man]: Display the tools manpage. By default, it
40 attempts to invoke the manpager for the tool, however, on failure
41 will output a short tool summary. This is the same behavior if the
42 “man” option argument is specified, however if explicit “man” is re‐
43 quested, the tool will provide errors from man on stderr. If the
44 “no-man” option if specified, or the manpager fails, the short op‐
45 tions will be output to stdout.
46
47 To successfully use the manpages feature requires the manpages to be
48 installed or on MANPATH, See man(1) for more details.
49
50 • -v, --version: Display version information for this tool, supported
51 tctis and exit.
52
53 • -V, --verbose: Increase the information that the tool prints to the
54 console during its execution. When using this option the file and
55 line number are printed.
56
57 • -Q, --quiet: Silence normal tool output to stdout.
58
59 • -Z, --enable-errata: Enable the application of errata fixups. Useful
60 if an errata fixup needs to be applied to commands sent to the TPM.
61 Defining the environment TPM2TOOLS_ENABLE_ERRATA is equivalent. in‐
62 formation many users may expect.
63
65 The TCTI or “Transmission Interface” is the communication mechanism
66 with the TPM. TCTIs can be changed for communication with TPMs across
67 different mediums.
68
69 To control the TCTI, the tools respect:
70
71 1. The command line option -T or --tcti
72
73 2. The environment variable: TPM2TOOLS_TCTI.
74
75 Note: The command line option always overrides the environment vari‐
76 able.
77
78 The current known TCTIs are:
79
80 • tabrmd - The resource manager, called tabrmd
81 (https://github.com/tpm2-software/tpm2-abrmd). Note that tabrmd and
82 abrmd as a tcti name are synonymous.
83
84 • mssim - Typically used for communicating to the TPM software simula‐
85 tor.
86
87 • device - Used when talking directly to a TPM device file.
88
89 • none - Do not initalize a connection with the TPM. Some tools allow
90 for off-tpm options and thus support not using a TCTI. Tools that do
91 not support it will error when attempted to be used without a TCTI
92 connection. Does not support ANY options and MUST BE presented as
93 the exact text of “none”.
94
95 The arguments to either the command line option or the environment
96 variable are in the form:
97
98 <tcti-name>:<tcti-option-config>
99
100 Specifying an empty string for either the <tcti-name> or <tcti-op‐
101 tion-config> results in the default being used for that portion respec‐
102 tively.
103
104 TCTI Defaults
105 When a TCTI is not specified, the default TCTI is searched for using
106 dlopen(3) semantics. The tools will search for tabrmd, device and
107 mssim TCTIs IN THAT ORDER and USE THE FIRST ONE FOUND. You can query
108 what TCTI will be chosen as the default by using the -v option to print
109 the version information. The “default-tcti” key-value pair will indi‐
110 cate which of the aforementioned TCTIs is the default.
111
112 Custom TCTIs
113 Any TCTI that implements the dynamic TCTI interface can be loaded. The
114 tools internally use dlopen(3), and the raw tcti-name value is used for
115 the lookup. Thus, this could be a path to the shared library, or a li‐
116 brary name as understood by dlopen(3) semantics.
117
119 This collection of options are used to configure the various known TCTI
120 modules available:
121
122 • device: For the device TCTI, the TPM character device file for use by
123 the device TCTI can be specified. The default is /dev/tpm0.
124
125 Example: -T device:/dev/tpm0 or export TPM2TOOLS_TCTI=“de‐
126 vice:/dev/tpm0”
127
128 • mssim: For the mssim TCTI, the domain name or IP address and port
129 number used by the simulator can be specified. The default are
130 127.0.0.1 and 2321.
131
132 Example: -T mssim:host=localhost,port=2321 or export TPM2TOOLS_TC‐
133 TI=“mssim:host=localhost,port=2321”
134
135 • abrmd: For the abrmd TCTI, the configuration string format is a se‐
136 ries of simple key value pairs separated by a `,' character. Each
137 key and value string are separated by a `=' character.
138
139 • TCTI abrmd supports two keys:
140
141 1. `bus_name' : The name of the tabrmd service on the bus (a
142 string).
143
144 2. `bus_type' : The type of the dbus instance (a string) limited to
145 `session' and `system'.
146
147 Specify the tabrmd tcti name and a config string of bus_name=com.ex‐
148 ample.FooBar:
149
150 \--tcti=tabrmd:bus_name=com.example.FooBar
151
152 Specify the default (abrmd) tcti and a config string of bus_type=ses‐
153 sion:
154
155 \--tcti:bus_type=session
156
157 NOTE: abrmd and tabrmd are synonymous. the various known TCTI mod‐
158 ules.
159
161 Start a policy session and restart it, unsealing some data.
162 # create a policy and bind it to an object
163 tpm2_startauthsession -S session.dat
164
165 tpm2_policypcr -S session.dat -l "sha1:0,1,2,3" -L policy.dat
166
167 tpm2_createprimary -c primary.ctx
168
169 tpm2_create -Cprimary.ctx -u key.pub -r key.priv -L policy.dat -i- <<< "secret"
170
171 tpm2_load -C primary.ctx -c key.ctx -u key.pub -r key.priv
172
173 tpm2_flushcontext session.dat
174
175 # satisfy the policy and use the object
176 tpm2_startauthsession --policy -S session.dat
177
178 tpm2_policypcr -S session.dat -l "sha1:0,1,2,3"
179
180 # PCR event occurs here causing unseal to fail
181 tpm2_pcrevent 0 <<< "event data"
182
183 tpm2_unseal -psession:session.dat -c key.ct
184 ERROR: Esys_Unseal(0x128) - tpm:error(2.0): PCR have changed since checked
185
186 # Clear the policy digest to initial state, note access to object no longer allowed by
187 # policy so policyor would be useful here.
188 tpm2_policyrestart -S session.dat
189
191 Tools can return any of the following codes:
192
193 • 0 - Success.
194
195 • 1 - General non-specific error.
196
197 • 2 - Options handling error.
198
199 • 3 - Authentication error.
200
201 • 4 - TCTI related error.
202
203 • 5 - Non supported scheme. Applicable to tpm2_testparams.
204
206 It expects a session to be already established via tpm2_startauthses‐
207 sion(1) and requires one of the following:
208
209 • direct device access
210
211 • extended session support with tpm2-abrmd.
212
213 Without it, most resource managers will not save session state between
214 command invocations.
215
217 Github Issues (https://github.com/tpm2-software/tpm2-tools/issues)
218
220 See the Mailing List (https://lists.linuxfoundation.org/mailman/listin‐
221 fo/tpm2)
222
223
224
225tpm2-tools tpm2_policyrestart(1)