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

NAME

6       tpm2_policycphash(1)  - Couples a policy with command parameters of the
7       command.
8

SYNOPSIS

10       tpm2_policycphash [OPTIONS]
11

DESCRIPTION

13       tpm2_policycphash(1) - Couples a policy with command parameters of  the
14       command.   This  is  a deferred assertion where the hash of the command
15       parameters in a TPM command is checked against the one specified in the
16       policy.
17

OPTIONS

19-L, --policy=FILE:
20
21         File to save the compounded policy digest.
22
23-S, --session=FILE:
24
25         The  policy  session  file  generated via the -S option to tpm2_star‐
26         tauthsession(1).
27
28--cphash-input=FILE:
29
30         The file containing the command parameter hash of the command.
31
32--cphash=FILE:
33
34         DEPRECATED, use –cphash-input instead.
35
36   References

COMMON OPTIONS

38       This collection of options are common to many programs and provide  in‐
39       formation that many users may expect.
40
41-h,  --help=[man|no-man]:  Display the tools manpage.  By default, it
42         attempts to invoke the manpager for the  tool,  however,  on  failure
43         will  output  a short tool summary.  This is the same behavior if the
44         “man” option argument is specified, however if explicit “man” is  re‐
45         quested,  the  tool  will  provide errors from man on stderr.  If the
46         “no-man” option if specified, or the manpager fails,  the  short  op‐
47         tions will be output to stdout.
48
49         To  successfully use the manpages feature requires the manpages to be
50         installed or on MANPATH, See man(1) for more details.
51
52-v, --version: Display version information for this  tool,  supported
53         tctis and exit.
54
55-V,  --verbose:  Increase the information that the tool prints to the
56         console during its execution.  When using this option  the  file  and
57         line number are printed.
58
59-Q, --quiet: Silence normal tool output to stdout.
60
61-Z, --enable-errata: Enable the application of errata fixups.  Useful
62         if an errata fixup needs to be applied to commands sent to  the  TPM.
63         Defining  the environment TPM2TOOLS_ENABLE_ERRATA is equivalent.  in‐
64         formation many users may expect.
65

TCTI Configuration

67       The TCTI or “Transmission Interface”  is  the  communication  mechanism
68       with  the TPM.  TCTIs can be changed for communication with TPMs across
69       different mediums.
70
71       To control the TCTI, the tools respect:
72
73       1. The command line option -T or --tcti
74
75       2. The environment variable: TPM2TOOLS_TCTI.
76
77       Note: The command line option always overrides  the  environment  vari‐
78       able.
79
80       The current known TCTIs are:
81
82       • tabrmd      -     The     resource     manager,     called     tabrmd
83         (https://github.com/tpm2-software/tpm2-abrmd).  Note that tabrmd  and
84         abrmd as a tcti name are synonymous.
85
86       • mssim  - Typically used for communicating to the TPM software simula‐
87         tor.
88
89       • device - Used when talking directly to a TPM device file.
90
91       • none - Do not initalize a connection with the TPM.  Some tools  allow
92         for off-tpm options and thus support not using a TCTI.  Tools that do
93         not support it will error when attempted to be used  without  a  TCTI
94         connection.   Does  not  support ANY options and MUST BE presented as
95         the exact text of “none”.
96
97       The arguments to either the command  line  option  or  the  environment
98       variable are in the form:
99
100       <tcti-name>:<tcti-option-config>
101
102       Specifying  an  empty  string  for  either the <tcti-name> or <tcti-op‐
103       tion-config> results in the default being used for that portion respec‐
104       tively.
105
106   TCTI Defaults
107       When  a  TCTI  is not specified, the default TCTI is searched for using
108       dlopen(3) semantics.  The tools will  search  for  tabrmd,  device  and
109       mssim  TCTIs  IN THAT ORDER and USE THE FIRST ONE FOUND.  You can query
110       what TCTI will be chosen as the default by using the -v option to print
111       the  version information.  The “default-tcti” key-value pair will indi‐
112       cate which of the aforementioned TCTIs is the default.
113
114   Custom TCTIs
115       Any TCTI that implements the dynamic TCTI interface can be loaded.  The
116       tools internally use dlopen(3), and the raw tcti-name value is used for
117       the lookup.  Thus, this could be a path to the shared library, or a li‐
118       brary name as understood by dlopen(3) semantics.
119

TCTI OPTIONS

121       This collection of options are used to configure the various known TCTI
122       modules available:
123
124device: For the device TCTI, the TPM character device file for use by
125         the device TCTI can be specified.  The default is /dev/tpm0.
126
127         Example:    -T   device:/dev/tpm0   or   export   TPM2TOOLS_TCTI=“de‐
128         vice:/dev/tpm0”
129
130mssim: For the mssim TCTI, the domain name or  IP  address  and  port
131         number  used  by  the  simulator  can  be specified.  The default are
132         127.0.0.1 and 2321.
133
134         Example: -T mssim:host=localhost,port=2321  or  export  TPM2TOOLS_TC‐
135         TI=“mssim:host=localhost,port=2321”
136
137abrmd:  For  the abrmd TCTI, the configuration string format is a se‐
138         ries of simple key value pairs separated by a  `,'  character.   Each
139         key and value string are separated by a `=' character.
140
141         • TCTI abrmd supports two keys:
142
143           1. `bus_name'  :  The  name  of  the  tabrmd  service on the bus (a
144              string).
145
146           2. `bus_type' : The type of the dbus instance (a string) limited to
147              `session' and `system'.
148
149         Specify  the tabrmd tcti name and a config string of bus_name=com.ex‐
150         ample.FooBar:
151
152                \--tcti=tabrmd:bus_name=com.example.FooBar
153
154         Specify the default (abrmd) tcti and a config string of bus_type=ses‐
155         sion:
156
157                \--tcti:bus_type=session
158
159         NOTE:  abrmd  and tabrmd are synonymous.  the various known TCTI mod‐
160         ules.
161

EXAMPLES

163       Restrict the value that can be set through tpm2_nvsetbits.
164
165   Define NV index object with authorized policy
166              openssl genrsa -out signing_key_private.pem 2048
167              openssl rsa -in signing_key_private.pem -out signing_key_public.pem -pubout
168              tpm2_loadexternal -G rsa -C o -u signing_key_public.pem -c signing_key.ctx \
169              -n signing_key.name
170              tpm2_startauthsession -S session.ctx -g sha256
171              tpm2_policyauthorize -S session.ctx -L authorized.policy -n signing_key.name
172              tpm2_flushcontext session.ctx
173              tpm2_nvdefine 1 -a "policywrite|authwrite|ownerread|nt=bits" -L authorized.policy
174
175   Create policycphash
176              tpm2_nvsetbits 1 -i 1 --cphash cp.hash
177              tpm2_startauthsession -S session.ctx -g sha256
178              tpm2_policycphash -S session.ctx -L policy.cphash --cphash cp.hash
179              tpm2_flushcontext session.ctx
180
181   Sign and verify policycphash
182              openssl dgst -sha256 -sign signing_key_private.pem \
183              -out policycphash.signature policy.cphash
184              tpm2_verifysignature -c signing_key.ctx -g sha256 -m policy.cphash \
185              -s policycphash.signature -t verification.tkt -f rsassa
186
187   Satisfy policycphash and execute nvsetbits
188              tpm2_startauthsession -S session.ctx --policy-session -g sha256
189              tpm2_policycphash -S session.ctx --cphash cp.hash
190              tpm2_policyauthorize -S session.ctx -i policy.cphash -n signing_key.name \
191              -t verification.tkt
192              tpm2_nvsetbits 1 -i 1 -P "session:session.ctx"
193              tpm2_flushcontext session.ctx
194

Returns

196       Tools can return any of the following codes:
197
198       • 0 - Success.
199
200       • 1 - General non-specific error.
201
202       • 2 - Options handling error.
203
204       • 3 - Authentication error.
205
206       • 4 - TCTI related error.
207
208       • 5 - Non supported scheme.  Applicable to tpm2_testparams.
209

Limitations

211       It expects a session to be already established  via  tpm2_startauthses‐
212       sion(1) and requires one of the following:
213
214       • direct device access
215
216       • extended session support with tpm2-abrmd.
217
218       Without  it, most resource managers will not save session state between
219       command invocations.
220

BUGS

222       Github Issues (https://github.com/tpm2-software/tpm2-tools/issues)
223

HELP

225       See the Mailing List (https://lists.01.org/mailman/listinfo/tpm2)
226
227
228
229tpm2-tools                                                tpm2_policycphash(1)
Impressum