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

NAME

6       tpm2_policynvwritten(1)  -  Restrict  TPM  object  authorization to the
7       written state of an NV index.
8

SYNOPSIS

10       tpm2_policynvwritten [OPTIONS] [ARGUMENT]
11

DESCRIPTION

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

OPTIONS

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--cphash=FILE
30
31         File path to record the hash of the command parameters.  This is com‐
32         monly termed as cpHash.  NOTE: When this option is selected, The tool
33         will not actually execute the command, it simply returns a cpHash.
34
35   References

COMMON OPTIONS

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

TCTI Configuration

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

TCTI OPTIONS

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

EXAMPLES

162       Create  a write once NV index.  To do this the NV index is defined with
163       a write policy that is valid  only  if  the  NV  index  attribute  “TP‐
164       MA_NV_WRITTEN” was never set.
165
166   Define the NV index write policy
167              tpm2_startauthsession -S session.dat
168              tpm2_policycommandcode -S session.dat TPM2_CC_NV_Write
169              tpm2_policynvwritten -S session.dat -L nvwrite.policy c
170              tpm2_flushcontext session.dat
171
172   Define the NV index with the policy
173               tpm2_nvdefine -s 1 -a "authread|policywrite" -p nvrdpass -L nvwrite.policy
174
175   Write the NV index by satisfying the policy
176              tpm2_startauthsession -S session.dat --policy-session
177              tpm2_policycommandcode -S session.dat TPM2_CC_NV_Write
178              tpm2_policynvwritten -S session.dat c
179              echo 0xAA | xxd -r -p | tpm2_nvwrite 0x01000000 -i- -P session:session.dat
180              tpm2_flushcontext session.dat
181

Returns

183       Tools can return any of the following codes:
184
185       • 0 - Success.
186
187       • 1 - General non-specific error.
188
189       • 2 - Options handling error.
190
191       • 3 - Authentication error.
192
193       • 4 - TCTI related error.
194
195       • 5 - Non supported scheme.  Applicable to tpm2_testparams.
196

Limitations

198       It  expects  a session to be already established via tpm2_startauthses‐
199       sion(1) and requires one of the following:
200
201       • direct device access
202
203       • extended session support with tpm2-abrmd.
204
205       Without it, most resource managers will not save session state  between
206       command invocations.
207

BUGS

209       Github Issues (https://github.com/tpm2-software/tpm2-tools/issues)
210

HELP

212       See the Mailing List (https://lists.linuxfoundation.org/mailman/listin
213       fo/tpm2)
214
215
216
217tpm2-tools                                             tpm2_policynvwritten(1)
Impressum