1tpm2_getrandom(1) General Commands Manual tpm2_getrandom(1)
2
3
4
6 tpm2_getrandom(1) - Retrieves random bytes from the TPM.
7
9 tpm2_getrandom [OPTIONS] SIZE
10
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
17 · -o, –output=FILE specifies the filename to output the raw bytes to.
18 Defaults to stdout as a hex string.
19
21 This collection of options are common to many programs and provide in‐
22 formation that many users may expect.
23
24 · -h, –help: Display the tools manpage. This requires the manpages to
25 be installed or on MANPATH, See man(1) for more details.
26
27 · -v, –version: Display version information for this tool, supported
28 tctis and exit.
29
30 · -V, –verbose: Increase the information that the tool prints to the
31 console during its execution. When using this option the file and
32 line number are printed.
33
34 · -Q, –quiet: Silence normal tool output to stdout.
35
36 · -Z, –enable-errata: Enable the application of errata fixups. Useful
37 if an errata fixup needs to be applied to commands sent to the TPM.
38 # TCTI ENVIRONMENT
39
40 This collection of environment variables that may be used to configure
41 the various TCTI modules available.
42
43 The values passed through these variables can be overridden on a
44 per-command basis using the available command line options, see the TC‐
45 TI_OPTIONS section.
46
47 The variables respected depend on how the software was configured.
48
49 · TPM2TOOLS_TCTI_NAME: Select the TCTI used for communication with the
50 next component down the TSS stack. In most configurations this will
51 be the TPM but it could be a simulator or proxy. The current known
52 TCTIs are:
53
54 · tabrmd - The new resource manager, called tabrmd
55 (https://github.com/01org/tpm2-abrmd).
56
57 · socket - Typically used with the old resource manager, or talking
58 directly to a simulator.
59
60 · device - Used when talking directly to a TPM device file.
61
62 · TPM2TOOLS_DEVICE_FILE: When using the device TCTI, specify the TPM
63 device file. The default is “/dev/tpm0”.
64
65 Note: Using the tpm directly requires the users to ensure that con‐
66 current access does not occur and that they manage the tpm resources.
67 These tasks are usually managed by a resource manager. Linux 4.12
68 and greater supports an in kernel resource manager at “/dev/tpmrm”,
69 typically “/dev/tpmrm0”.
70
71 · TPM2TOOLS_SOCKET_ADDRESS: When using the socket TCTI, specify the do‐
72 main name or IP address used. The default is 127.0.0.1.
73
74 · TPM2TOOLS_SOCKET_PORT: When using the socket TCTI, specify the port
75 number used. The default is 2321.
76
78 This collection of options are used to configure the varous TCTI mod‐
79 ules available. They override any environment variables.
80
81 · -T, –tcti=TCTI_NAME[:TCTI_OPTIONS]: Select the TCTI used for communi‐
82 cation with the next component down the TSS stack. In most configu‐
83 rations this will be the resource manager: tabrmd
84 (https://github.com/01org/tpm2-abrmd) Optionally, tcti specific op‐
85 tions can appended to TCTI_NAME by appending a : to TCTI_NAME.
86
87 · For the device TCTI, the TPM device file for use by the device TCTI
88 can be specified. The default is /dev/tpm0. Example: -T de‐
89 vice:/dev/tpm0
90
91 · For the socket TCTI, the domain name or IP address and port number
92 used by the socket can be specified. The default are 127.0.0.1 and
93 2321. Example: -T socket:127.0.0.1:2321
94
95 · For the abrmd TCTI, it takes no options. Example: -T abrmd
96
98 Generate a random 20 bytes and output the binary data to a file:
99
100 tpm2_getrandom -o random.out 20
101
102 Generate a random 8 bytes and output the hex formated data to stdout:
103
104 tpm2_getrandom 8
105
107 0 on success or 1 on failure.
108
110 Github Issues (https://github.com/01org/tpm2-tools/issues)
111
113 See the Mailing List (https://lists.01.org/mailman/listinfo/tpm2)
114
115
116
117tpm2-tools SEPTEMBER 2017 tpm2_getrandom(1)