diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bccf4dc..65f23a0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,6 +2,20 @@ on: [push, pull_request] name: Test jobs: test-linux: + strategy: + matrix: + go-version: [1.16.x, 1.17.x] + runs-on: ubuntu-latest + steps: + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go-version }} + - name: Checkout code + uses: actions/checkout@v2 + - name: Test + run: go test ./... + test-linux-tpm12: strategy: matrix: go-version: [1.16.x, 1.17.x] @@ -16,7 +30,7 @@ jobs: - name: Install libtspi run: sudo apt-get install -y libtspi-dev - name: Test - run: go test ./... + run: go test -tags tspi ./... test-macos: strategy: matrix: diff --git a/README.md b/README.md index e5b76ee..ce4675f 100644 --- a/README.md +++ b/README.md @@ -27,12 +27,12 @@ testing is not covered by CI. The go-attestation package is installable using go get: `go get github.com/google/go-attestation/attest` -Linux users must install `libtspi` and its headers if they need TPM 1.2 support. This can be installed on debian-based systems using: `sudo apt-get install libtspi-dev`. +### TPM1.2 +By default, go-attestation does not build in TPM1.2 support on Linux. +Linux users must install [`libtspi`](http://trousers.sourceforge.net/) and its headers if they need TPM 1.2 support. This can be installed on debian-based systems using: `sudo apt-get install libtspi-dev`. +Then, build go-attestation with the `tspi` [build tag](https://pkg.go.dev/go/build#hdr-Build_Constraints) `go build --tags=tspi`. -In case Linux users need only TPM 2.0 support, they can: -* still install `libtspi` -* or turn off cgo completely, e.g., `CGO_ENABLED=0 go build` -* or use `notspi` build tag if cgo is needed for some reasons, e.g., `go build --tags=notspi` +Windows users can use go-attestation with TPM1.2 by default. ## Example: device identity diff --git a/attest/key_linux.go b/attest/key_linux.go index c18dde6..ec5109f 100644 --- a/attest/key_linux.go +++ b/attest/key_linux.go @@ -12,7 +12,7 @@ // License for the specific language governing permissions and limitations under // the License. -// +build linux,!gofuzz,cgo,!notspi +// +build linux,!gofuzz,cgo,tspi package attest diff --git a/attest/tpm12_linux.go b/attest/tpm12_linux.go index 35ffd47..40560bf 100644 --- a/attest/tpm12_linux.go +++ b/attest/tpm12_linux.go @@ -12,7 +12,7 @@ // License for the specific language governing permissions and limitations under // the License. -// +build linux,!gofuzz,cgo,!notspi +// +build linux,!gofuzz,cgo,tspi package attest