You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/SWTPM.md
+59-50Lines changed: 59 additions & 50 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,56 +1,64 @@
1
1
# wolfTPM with Software Simulator (SWTPM) support
2
2
3
-
wolfTPM is to be able to interface with software TPM (SW TPM) interfaces defined by section D.3 of [TPM-Rev-2.0-Part-4-Supporting-Routines-01.38-code](https://trustedcomputinggroup.org/wp-content/uploads/TPM-Rev-2.0-Part-4-Supporting-Routines-01.38-code.pdf)
4
-
5
-
The SWTPM interface is not compatible with TIS or devtpm (/dev/tpm0). Transport is a socket connection by default, but can also be a UART.
6
-
7
-
This implementation only uses the TPM command interface typically on port 2321. It does not support the Platform interface typically on port 2322.
3
+
wolfTPM is to be able to use Software TPM (SW TPM) defined by section D.3 of [TPM-Rev-2.0-Part-4-Supporting-Routines-01.38-code](https://trustedcomputinggroup.org/wp-content/uploads/TPM-Rev-2.0-Part-4-Supporting-Routines-01.38-code.pdf)
8
4
9
5
Software TPM implementations tested:
10
-
*https://github.com/kgoldman/ibmswtpm2 or https://sourceforge.net/projects/ibmswtpm2/files/
11
-
*https://github.com/microsoft/ms-tpm-20-ref
12
-
*https://github.com/stefanberger/swtpm
6
+
*[Official TCG Reference](https://github.com/TrustedComputingGroup/TPM): Reference code from the specification maintained by TCG [build steps](#tcg-tpm)
7
+
*[IBM / Ken Goldman](https://github.com/kgoldman/ibmswtpm2): Fork of reference code maintained by IBM [build steps](#ibmswtpm2)
8
+
*[Microsoft](https://github.com/microsoft/ms-tpm-20-ref): Fork of reference code maintained by Microsoft (93% identical to official TCG) [build steps](#ms-tpm-20-ref)
9
+
*[Stefan Berger](https://github.com/stefanberger/swtpm): Uses libtpms front end interfaces. [build steps](#swtpm)
13
10
14
-
## Building SW TPM support
11
+
The software TPM transport is a socket connection by default, but we also support a UART.
15
12
16
-
By default a socket transport will be used.
13
+
This implementation only uses the TPM command interface typically on port 2321. It does not support the Platform interface typically on port 2322.
14
+
15
+
Some software TPM implementations require sending power up and startup commands on the platform interface before the command interface is enabled. You can use these commands to issue the required power up and startup:
17
16
18
17
```sh
19
-
./configure --enable-swtpm
20
-
make
18
+
echo -ne "\x00\x00\x00\x01"| nc 127.0.0.1 2322
19
+
echo -ne "\x00\x00\x00\x0B"| nc 127.0.0.1 2322
21
20
```
22
21
23
-
### Build SW TPM with UART transport
22
+
## wolfTPM SWTPM support
23
+
24
+
To enable the socket transport for SWTPM use `--enable-swtpm`. By default all software TPM simulators use TCP port 2321.
24
25
25
26
```sh
26
-
./configure --enable-swtpm=uart
27
+
./configure --enable-swtpm
27
28
make
28
29
```
29
30
30
-
## Build Options
31
+
Note: It is not possible to enable more than one transport interface at a time. If building with SWTPM socket interface the built-in TIS and devtpm (/dev/tpm0) interfaces are not available.
32
+
33
+
Build Options:
31
34
32
35
*`WOLFTPM_SWTPM`: Use socket transport (no TIS layer)
33
-
*`TPM2_SWTPM_HOST`: The serial device to use (default=/dev/ttyS0)
34
-
*`TPM2_SWTPM_PORT`: The baud rate (default=115200)
35
-
*`WOLFTPM_SWTPM_UART`: Use UART transport (no TIS layer)
36
+
*`TPM2_SWTPM_HOST`: The socket host (default is localhost)
37
+
*`TPM2_SWTPM_PORT`: The socket port (default is 2321)
To use the TPM on port 2321 you must first connect to the platform server on port 2322 and send the power on and startup commands. An easy way to do this is using:
56
+
57
+
```sh
58
+
echo -ne "\x00\x00\x00\x01"| nc 127.0.0.1 2322
59
+
echo -ne "\x00\x00\x00\x0B"| nc 127.0.0.1 2322
60
+
```
49
61
50
-
*`WOLFTPM_SWTPM`: Use socket transport (no TIS layer)
51
-
*`TPM2_SWTPM_PORT`: Used as the default baud rate (default=115200)
52
-
*`TPM2_SWTPM_HOST`: The device to connect with (default=XPAR_MB0_AXI_UART16550_2_DEVICE_ID)
53
-
*`WOLFTPM_SWTPM_UARTNS550`: Use Xilinx UART transport (no TIS layer)
54
62
55
63
### ibmswtpm2
56
64
@@ -61,12 +69,10 @@ cd ibmswtpm2/src/
61
69
make
62
70
```
63
71
64
-
Running:
65
-
```sh
66
-
./tpm_server -rm
67
-
```
72
+
Run with: `./tpm_server`
73
+
74
+
Note: You can use the `-rm` switch to remove the cache file NVChip. Alternately you can delete the NVChip file (`rm NVChip`)
68
75
69
-
The rm switch is optional and remove the cache file NVChip. Alternately you can `rm NVChip`
70
76
71
77
### ms-tpm-20-ref
72
78
@@ -76,16 +82,18 @@ cd ms-tpm-20-ref/TPMCmd
76
82
./bootstrap
77
83
./configure
78
84
make
79
-
./Simulator/src/tpm2-simulator
80
85
```
81
86
82
-
In another terminal power on ms-tpm-20-ref and start NV
87
+
Run with: `./Simulator/src/tpm2-simulator`
88
+
89
+
To use the TPM on port 2321 you must first connect to the platform server on port 2322 and send the power on and startup commands. An easy way to do this is using:
0 commit comments