go-tpm-tools

module
v0.2.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 2, 2021 License: Apache-2.0, BSD-3-Clause

README

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

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.

Directories

Path Synopsis
Package client contains some high-level TPM 2.0 functions.
Package client contains some high-level TPM 2.0 functions.
cmd
Package cmd contains a CLI to interact with TPM.
Package cmd contains a CLI to interact with TPM.
Package internal provides helper methods for testing.
Package internal provides helper methods for testing.
Package server contains functions to be ran on a server (no TPM needed), as oppose to a client (with TPM).
Package server contains functions to be ran on a server (no TPM needed), as oppose to a client (with TPM).
Package simulator provides a go interface to the Microsoft TPM2 simulator.
Package simulator provides a go interface to the Microsoft TPM2 simulator.
internal
Package internal provides low-level bindings to the Microsoft TPM2 simulator.
Package internal provides low-level bindings to the Microsoft TPM2 simulator.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL