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

NAME

6       tpm2_hash(1) - Performs a hash operation with the TPM.
7

SYNOPSIS

9       tpm2_hash [OPTIONS] FILE
10

DESCRIPTION

12       tpm2_hash(1)  -  performs  a hash operation on FILE and returns the re‐
13       sults.  If FILE is not specified, then data is read from stdin.  If the
14       results of the hash will be used in a signing operation that uses a re‐
15       stricted signing key, then the ticket returned by this command can  in‐
16       dicate that the hash is safe to sign.
17

OPTIONS

19       · -H, –hierarchy=HIERARCHY: hierarchy to use for the ticket.  Supported
20         options are:
21
22         · o for TPM_RH_OWNER
23
24         · p for TPM_RH_PLATFORM
25
26         · e for TPM_RH_ENDORSEMENT
27
28         · n for TPM_RH_NULL
29
30       · -g, –halg=HASH_ALGORITHM: The  hash  algorithm  to  use.   Algorithms
31         should follow the “formatting standards, see section”Algorithm Speci‐
32         fiers“. Also, see section”Supported Hash Algorithms" for  a  list  of
33         supported hash algorithms.
34
35       · -o,  –outfile=OUT_FILE  Optional file record of the hash result.  De‐
36         faults to stdout in hex form.
37
38       · -t, –ticket=TICKET_FILE Optional file record of  the  ticket  result.
39         Defaults to stdout in hex form.
40

COMMON OPTIONS

42       This  collection of options are common to many programs and provide in‐
43       formation that many users may expect.
44
45       · -h, –help: Display the tools manpage.  This requires the manpages  to
46         be installed or on MANPATH, See man(1) for more details.
47
48       · -v,  –version:  Display  version information for this tool, supported
49         tctis and exit.
50
51       · -V, –verbose: Increase the information that the tool  prints  to  the
52         console  during  its  execution.  When using this option the file and
53         line number are printed.
54
55       · -Q, –quiet: Silence normal tool output to stdout.
56
57       · -Z, –enable-errata: Enable the application of errata fixups.   Useful
58         if  an  errata fixup needs to be applied to commands sent to the TPM.
59         # TCTI ENVIRONMENT
60
61       This collection of environment variables that may be used to  configure
62       the various TCTI modules available.
63
64       The  values  passed  through  these  variables  can  be overridden on a
65       per-command basis using the available command line options, see the TC‐
66       TI_OPTIONS section.
67
68       The variables respected depend on how the software was configured.
69
70       · TPM2TOOLS_TCTI_NAME:  Select the TCTI used for communication with the
71         next component down the TSS stack.  In most configurations this  will
72         be  the  TPM but it could be a simulator or proxy.  The current known
73         TCTIs are:
74
75         · tabrmd   -   The    new    resource    manager,    called    tabrmd
76           (https://github.com/01org/tpm2-abrmd).
77
78         · socket  -  Typically used with the old resource manager, or talking
79           directly to a simulator.
80
81         · device - Used when talking directly to a TPM device file.
82
83       · TPM2TOOLS_DEVICE_FILE: When using the device TCTI,  specify  the  TPM
84         device file.  The default is “/dev/tpm0”.
85
86         Note:  Using  the tpm directly requires the users to ensure that con‐
87         current access does not occur and that they manage the tpm resources.
88         These  tasks  are  usually managed by a resource manager.  Linux 4.12
89         and greater supports an in kernel resource manager  at  “/dev/tpmrm”,
90         typically “/dev/tpmrm0”.
91
92       · TPM2TOOLS_SOCKET_ADDRESS: When using the socket TCTI, specify the do‐
93         main name or IP address used.  The default is 127.0.0.1.
94
95       · TPM2TOOLS_SOCKET_PORT: When using the socket TCTI, specify  the  port
96         number used.  The default is 2321.
97

TCTI OPTIONS

99       This  collection  of options are used to configure the varous TCTI mod‐
100       ules available.  They override any environment variables.
101
102       · -T, –tcti=TCTI_NAME[:TCTI_OPTIONS]: Select the TCTI used for communi‐
103         cation  with the next component down the TSS stack.  In most configu‐
104         rations   this    will    be    the    resource    manager:    tabrmd
105         (https://github.com/01org/tpm2-abrmd)  Optionally,  tcti specific op‐
106         tions can appended to TCTI_NAME by appending a : to TCTI_NAME.
107
108         · For the device TCTI, the TPM device file for use by the device TCTI
109           can  be  specified.   The  default  is  /dev/tpm0.  Example: -T de‐
110           vice:/dev/tpm0
111
112         · For the socket TCTI, the domain name or IP address and port  number
113           used by the socket can be specified.  The default are 127.0.0.1 and
114           2321.  Example: -T socket:127.0.0.1:2321
115
116         · For the abrmd TCTI, it takes no options.  Example: -T abrmd
117

Supported Hash Algorithms

119       Supported hash algorithms are:
120
121       · 0x4 or sha1 for TPM_ALG_SHA1 (default)
122
123       · 0xB or sha256 for TPM_ALG_SHA256
124
125       · 0xC or sha384 for TPM_ALG_SHA384
126
127       · 0xD or sha512 for TPM_ALG_SHA512
128
129       · 0x12 or sm3_256 for TPM_ALG_SM3_256
130
131       NOTE: Your TPM may not support all algorithms.
132

Algorithm Specfiers

134       Options that take algorithms support “nice-names”.   Nice  names,  like
135       sha1 can be used in place of the raw hex for sha1: 0x4.  The nice names
136       are converted by stripping the leading TPM_ALG_ from the Algorithm Name
137       field  and  converting it to lower case.  For instance TPM_ALG_SHA3_256
138       becomes sha3_256.
139
140       The algorithms can be found at:  <https://trustedcomputinggroup.org/wp-
141       content/uploads/TCG_Algorithm_Registry_Rev_1.24.pdf>
142

EXAMPLES

144       Hash  a file with sha1 hash algorithm and save the hash and ticket to a
145       file:
146
147              tpm2_hash -H e -g sha1 -o hash.bin -t ticket.bin data.txt
148

RETURNS

150       0 on success or 1 on failure.
151

BUGS

153       Github Issues (https://github.com/01org/tpm2-tools/issues)
154

HELP

156       See the Mailing List (https://lists.01.org/mailman/listinfo/tpm2)
157
158
159
160tpm2-tools                      SEPTEMBER 2017                    tpm2_hash(1)
Impressum