Skip to content

Go packages built on go-tpm providing a high-level API for using TPMs

License

Notifications You must be signed in to change notification settings

ProsaicSatsuma/go-tpm-tools

 
 

Repository files navigation

Go-TPM tools

This repository contains various libraries and a command line tool designed for use with Go-TPM:

  • simulator: Go bindings to the Microsoft's TPM2 simulator.
  • tpm2tools: a Go library providing useful abstractions and utility functions for using a TPM2. The goal of this library is to handle complex TPM functionality (sessions, authorization, activating credentials, etc...), providing users with a simplified API.
  • gotpm: a command line tool for using the TPM from the command line. Run gotpm --help and gotpm [command] --help for more documentation.

Minimum Required Go Version

This project currently requires Go 1.13 or newer. In general, we try to support building with all currently supported Go versions. Any update to the minimum required Go version will be released as a minor version update.

macOS Dev

macOS fails to go build and go test by default with the error ld: library not found for -lcrypto. Fix it by installing OpenSSL and pointing cgo to the include and lib.

These commands were tested on macOS 10.15.7 (Catalina).

Install OpenSSL

  1. Install Homebrew
  2. brew install openssl
  3. cd /usr/local/include
  4. sudo ln -s $(brew --prefix openssl)/include/openssl .

To point the simulator at openssl as provided by Homebrew, there are a couple of options. Both of these use the output of $(brew --prefix openssl) for $OPENSSL_PATH.

Add OpenSSL to the include and library path at the commandline

This solution does not require modifying go-tpm-tools code and is useful when working on other projects that depend on go-tpm-tools/simulator.

C_INCLUDE_PATH="$OPENSSL_PATH/include" LIBRARY_PATH="$OPENSSL_PATH/lib" go test ...

Add OpenSSL to the include and library path in the code

This solution modifies your local copy of the go-tpm-tools simulator source and removes the need to provide the paths on the commandline.

Remember to remove the lines from simulator/internal/internal.go before committing changes.

// #cgo CFLAGS: -I $OPENSSL_PATH/include
// #cgo LDFLAGS: -L$OPENSSL_PATH/lib

Legal

Copyright 2018 Google Inc. under the Apache 2.0 License. Microsoft's TPM simulator code is licensed under a 3-clause BSD license and the TCG software license. See the LICENSE file for more information.

This is not an official Google product.

About

Go packages built on go-tpm providing a high-level API for using TPMs

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 95.6%
  • Go 4.0%
  • Other 0.4%