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

NAME

6       tpm2_getrandom(1) - Retrieves random bytes from the TPM.
7

SYNOPSIS

9       tpm2_getrandom [OPTIONS] [ARGUMENT]
10

DESCRIPTION

12       tpm2_getrandom(1) - Returns the next SIZE octets from the random number
13       generator.  The SIZE parameter is expected as the only argument to  the
14       tool.
15
16       Note that the TPM specification recommends that TPM's fix the number of
17       available entry to the maximum size  of  a  hash  algorithm  output  in
18       bytes.
19
20       Most TPMs do this, and thus the tool verifies that input size is bound‐
21       ed by property TPM2_PT_MAX_DIGEST and issues an  error  if  it  is  too
22       large.
23
24       Output  defaults to stdout and binary format unless otherwise specified
25       with -o and --hex options respectively.
26

OPTIONS

28       · -o, --output=FILE
29
30         Specifies the filename to output the raw bytes to.  Defaults to  std‐
31         out as a hex string.
32
33       · --hex
34
35         Convert the output data to hex format without a leading "0x".
36
37       · -f, --force
38         Override checking that the:
39
40         · Requested size is within the hash size limit of the TPM.
41
42         · Number of retrieved random bytes matches requested amount.
43
44       · ARGUMENT the command line argument specifies the size of the output.
45
46   References

COMMON OPTIONS

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

TCTI Configuration

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

TCTI OPTIONS

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

EXAMPLES

173   Generate a random 20 bytes and output the binary data to a file
174              tpm2_getrandom -o random.out 20
175
176   Generate a random 8 bytes and output the hex formatted data to
177       stdout
178
179              tpm2_getrandom 8
180

Returns

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

BUGS

197       Github Issues (https://github.com/tpm2-software/tpm2-tools/issues)
198

HELP

200       See the Mailing List (https://lists.01.org/mailman/listinfo/tpm2)
201
202
203
204tpm2-tools                                                   tpm2_getrandom(1)
Impressum