| 1 |
//go:build !windows |
| 2 |
// +build !windows |
| 3 |
|
| 4 |
package test |
| 5 |
|
| 6 |
import ( |
| 7 |
"flag" |
| 8 |
"io" |
| 9 |
|
| 10 |
"github.com/google/go-tpm/legacy/tpm2" |
| 11 |
) |
| 12 |
|
| 13 |
// As this package is only included in tests, this flag will not conflict with |
| 14 |
// the --tpm-path flag in gotpm/cmd |
| 15 |
var tpmPath = flag.String("tpm-path", "", "Path to Linux TPM character device (i.e. /dev/tpm0 or /dev/tpmrm0). Empty value (default) will run tests against the simulator.") |
| 16 |
|
| 17 |
func useRealTPM() bool { |
| 18 |
return *tpmPath != "" |
| 19 |
} |
| 20 |
|
| 21 |
func getRealTPM() (io.ReadWriteCloser, error) { |
| 22 |
return tpm2.OpenTPM(*tpmPath) |
| 23 |
} |