Skip to content

Commit db19908

Browse files
committed
use resourcemanger
1 parent 5741fff commit db19908

File tree

7 files changed

+9
-14
lines changed

7 files changed

+9
-14
lines changed

README.md

+1-6
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,9 @@ For TPM Signer, there are two modes of operation:
8585

8686
The TPM device is managed externally outside of the signer. You have to instantiate the TPM device ReadWriteCloser and client.Key outside of the library and pass that in.
8787

88-
The advantage of this is you control it opening and closing. You must close the key and closer before calling another signing operation. THis sounds ok but is problematic when dealing with long-running processes which may need to hang on to the tpm (for example you use the singer for an TLS server)
89-
90-
if you want to manage it externally,
88+
The advantage of this is you control it opening and closing. You must close the key and closer before calling another signing operation.
9189

9290
```golang
93-
// this blocks access to the tpm by other processes
94-
// until rwc.Close() is closed
9591
rwc, err := OpenTPM(*tpmPath)
9692
rwr := transport.FromReadWriter(rwc)
9793

@@ -117,7 +113,6 @@ For TPM Signer, there are two modes of operation:
117113

118114
If the device is busy or the TPM is in use during invocation, the operation will fail.
119115

120-
121116
```golang
122117
r, err := saltpm.NewTPMCrypto(&saltpm.TPM{
123118
TpmPath: *tpmPath,

example/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ export PATH=$PATH:/usr/local/go/bin
6868
```bash
6969
cd example/
7070

71-
rm -rf /tmp/myvtpm && mkdir /tmp/myvtpm
72-
sudo swtpm socket --tpmstate dir=/tmp/myvtpm --tpm2 --server type=tcp,port=2321 --ctrl type=tcp,port=2322 --flags not-need-init,startup-clear
73-
export TPM2TOOLS_TCTI="swtpm:port=2321"
71+
# rm -rf /tmp/myvtpm && mkdir /tmp/myvtpm
72+
# sudo swtpm socket --tpmstate dir=/tmp/myvtpm --tpm2 --server type=tcp,port=2321 --ctrl type=tcp,port=2322 --flags not-need-init,startup-clear
73+
# export TPM2TOOLS_TCTI="swtpm:port=2321"
7474

7575

7676
## RSA - no password

example/sign_verify_tpm/ecc/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const ()
3838
*/
3939

4040
var (
41-
tpmPath = flag.String("tpm-path", "127.0.0.1:2321", "Path to the TPM device (character device or a Unix socket).")
41+
tpmPath = flag.String("tpm-path", "/dev/tpmrm0", "Path to the TPM device (character device or a Unix socket).")
4242
handle = flag.Uint("handle", 0x81008001, "rsa Handle value")
4343
)
4444

example/sign_verify_tpm/policy/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ go run sign_verify_tpm/policy/main.go --handle=0x81008006
5050
*/
5151

5252
var (
53-
tpmPath = flag.String("tpm-path", "127.0.0.1:2321", "Path to the TPM device (character device or a Unix socket).")
53+
tpmPath = flag.String("tpm-path", "/dev/tpmrm0", "Path to the TPM device (character device or a Unix socket).")
5454
handle = flag.Uint("handle", 0x81008006, "rsa Handle value")
5555
pcr = flag.Int("pcr", 23, "PCR value")
5656
)

example/sign_verify_tpm/rsapss/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const ()
3838
*/
3939

4040
var (
41-
tpmPath = flag.String("tpm-path", "127.0.0.1:2321", "Path to the TPM device (character device or a Unix socket).")
41+
tpmPath = flag.String("tpm-path", "/dev/tpmrm0", "Path to the TPM device (character device or a Unix socket).")
4242
handle = flag.Uint("handle", 0x81008001, "rsa Handle value")
4343
)
4444

example/sign_verify_tpm/rsassa/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const ()
3737
*/
3838

3939
var (
40-
tpmPath = flag.String("tpm-path", "127.0.0.1:2321", "Path to the TPM device (character device or a Unix socket).")
40+
tpmPath = flag.String("tpm-path", "/dev/tpmrm0", "Path to the TPM device (character device or a Unix socket).")
4141
handle = flag.Uint("handle", 0x81008001, "rsa Handle value")
4242
)
4343

example/sign_verify_tpm/rsassa_managed/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323
const ()
2424

2525
var (
26-
tpmPath = flag.String("tpm-path", "127.0.0.1:2321", "Path to the TPM device (character device or a Unix socket).")
26+
tpmPath = flag.String("tpm-path", "/dev/tpmrm0", "Path to the TPM device (character device or a Unix socket).")
2727
handle = flag.Uint("handle", 0x81008001, "rsa Handle value")
2828
)
2929

0 commit comments

Comments
 (0)