File: INSTALL.md

package info (click to toggle)
tpm2-tools 5.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,988 kB
  • sloc: ansic: 45,737; sh: 14,915; xml: 8,342; makefile: 610; python: 51
file content (217 lines) | stat: -rw-r--r-- 6,946 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
## Building tpm2-tools

Below you will find instructions to build and install the tpm2-tools project.

### Download the Source
To obtain the tpm2-tools sources you must clone them as below:
```
git clone https://github.com/tpm2-software/tpm2-tools
```

### Dependencies

To build and install the tpm2-tools software the following software is required:

  * GNU Autoconf (version >= 2019.01.06)
  * GNU Automake
  * GNU Libtool
  * pkg-config
  * C compiler
  * C Library Development Libraries and Header Files (for pthreads headers)
  * ESAPI - TPM2.0 TSS ESAPI library (tss2-esys) and header files
  * OpenSSL libcrypto library and header files (version >= 1.1.0)
  * Curl library and header files

#### Optional Dependencies:
  * To build the man pages you need [pandoc](https://github.com/jgm/pandoc)
  * FAPI - TPM2.0 TSS FAPI library (tss2-fapi) and header files
  * To enable the new userspace resource manager, one must get tpm2-tabrmd
    (**recommended**).
  * When ./configure is invoked with --enable-unit or --enable-unit=abrmd,
    the tests are run towards a resource manager, tpm2-abrmd, which must be on $PATH.
  * When ./configure is invoked with --enable-unit=mssim, the tests are run directly
    towards tpm_server, without resource manager.
  * For the tests, with or without resource manager, tpm_server must be installed.
  * Some tests pass only if xxd, expect, bash and python with PyYAML are available
  * Some tests optionally use (but do not require) curl

### Typical Distro Dependency Installation

Here we are going to satisfy tpm2-tools dependencies with:
* tpm2-tss: <https://github.com/tpm2-software/tpm2-tss>
* tpm2-abrmd: <https://github.com/tpm2-software/tpm2-abrmd>
* TPM simulator: <https://downloads.sourceforge.net/project/ibmswtpm2/ibmtpm1332.tar.gz>

Which are necessary for the build example section at the bottom of this file, we need to satisfy the dependencies for each item named above except for the simulator.

#### Ubuntu 16.04

Satisfying the dependencies for tpm2-tools falls into two general steps, stuff
you can easily get via the package manager, and stuff you cannot.

**NOTE**: The *tpm2 Userspace Dependencies* may not be the correct version in
your distros package manager.

**Packages**:

The packages in the below command can be ascertained via the package manager.

```
sudo apt-get install autoconf automake libtool pkg-config gcc \
    libssl-dev libcurl4-gnutls-dev python-yaml
```
**Notes**:

  * One can substitute gcc for clang if they desire.
  * On pre-ubuntu 16.04 `libcurl4-gnutls-dev` was provided by `libcurl-dev`
    * The libcurl dependency can be satisfied in many ways, and likely change
      with Ubuntu versions:
      * `libcurl4-openssl-dev 7.47.0-1ubuntu2.2`
      * `libcurl4-nss-dev 7.47.0-1ubuntu2.2`
      * `libcurl4-gnutls-dev 7.47.0-1ubuntu2.2`
  * One needs autoconf archive, which is too old in the packagemanager. You can get
    working version from [here](http://ftpmirror.gnu.org/autoconf-archive/autoconf-archive-2019.01.06.tar.xz)

**tpm2 Userspace Dependencies**:

The following tpm2 userspace dependencies can be satisfied by getting the
source, building and installing them. They can be located here:

  * ESAPI - The enhanced system API: <https://github.com/tpm2-software/tpm2-tss>
  * ABRMD (**recommended but optional**) - Which is the userspace resource
    manager: <https://github.com/tpm2-software/tpm2-abrmd>



#### Fedora


In case you want to build from source the next command block should cover all the dependencies for tpm2-tools, the enhanced system API (tpm2-tss) and the userspace resource manager (tpm2-abrmd).

```
$ sudo dnf -y update && sudo dnf -y install automake libtool \
autoconf autoconf-archive libstdc++-devel gcc pkg-config \
uriparser-devel libgcrypt-devel dbus-devel glib2-devel \
compat-openssl10-devel libcurl-devel PyYAML

```
Some distros have the dependencies already packaged, you can simply install the package that contains the needed build requirements.

```
$ sudo dnf builddep tpm2-tools

```

The package installed above contains all the dependencies for tpm2-tools included the projects mentioned at the beginning of this section (tpm2-tss and tpm2-abrmd)

For more detailed information about the dependencies of tpm2-tss and tmp2-abrmd, please consult the corresponding links for each project. You can find these links in
the [Dependency-Matrix](https://tpm2-software.github.io/versions/)

## Building

To compile tpm2-tools execute the following commands from the root of the
source directory:
```
$ ./bootstrap
$ ./configure
$ make
```

This is sufficient for running as long as you alter `PATH` so that it points to
the *tools* directory, or just execute them via a full path.

For Example:

```
./tools/tpm2_getrandom 4
```

### Building from source example


Now we can start building the projects, there are four major steps for building the projects from source:
#### Bootstrapping the build

With the bootstrap command we run a script which generates the list of source files along with the configure script.

In the project directory:

```
$  ./bootstrap
```

#### Configuring the build

Here we run the configure script, this generates the makefiles needed for the compilation.

```
$ ./configure
```

Depending of the project, you can add additional information to the configure script, please refer to the links provided below for more information about the custom options.

* Default values for GNU installation directories: <https://www.gnu.org/prep/standards/html_node/Directory-Variables.html>
* Custom options for tpm2-tss: <https://github.com/tpm2-software/tpm2-tss/blob/master/INSTALL.md>
* Custom options for tpm2-abrmd: <https://github.com/tpm2-software/tpm2-abrmd/blob/master/INSTALL.md>

#### Compiling the Libraries

We use the make command for compile the code.

```
$ make -j$(nproc)
```


#### Installing the Libraries

Once we have finish building the projects it's time to install them.

```
$ sudo make install
```
Now putting all together:

* ##### Tpm2-tss
```
$ git clone https://github.com/tpm2-software/tpm2-tss.git
$ cd tpm2-tss
$ ./bootstrap
$ ./configure --prefix=/usr
$ make -j5
$ sudo make install
```

* ##### Tpm2-abrmd
```
$ git clone https://github.com/tpm2-software/tpm2-abrmd.git
$ cd tpm2-abrmd
$ ./bootstrap
$ ./configure --with-dbuspolicydir=/etc/dbus-1/system.d
--with-udevrulesdir=/usr/lib/udev/rules.d
--with-systemdsystemunitdir=/usr/lib/systemd/system
--libdir=/usr/lib64 --prefix=/usr
$ make -j5
$ sudo make install
```

* ##### Tpm2-tools
```
$ git clone https://github.com/tpm2-software/tpm2-tools.git
$ cd tpm2-tools
$ ./bootstrap
$ ./configure --prefix=/usr
$ make -j5
$ sudo make install
```
* ##### TPM simulator
```
$ mkdir ibmtpm && cd ibmtpm
$ wget https://sourceforge.net/projects/ibmswtpm2/files/latest/download -O ibmtpm.tar.gz
$ tar -zxvf ibmtpm.tar.gz
$ cd src
$ make -j5
```


And it's done, you are ready to run the projects.