Coder Social home page Coder Social logo

tpm2_server's Introduction

tpm2_server

This repository implements a server which provides access to a real or simulated TPM2 device over a socket interface.

A real TPM device could be connected over a USB-to-FTDI-to-SPI cable (for instance http://goo.gl/VDlr8H). Software TPM2 implementation published at https://goo.gl/r4qGVZ is used when running in simulation mode.

The Makefile by default assumes the following directory layout:

.
|-- build/
|   `-- tpm2_server   <= build directory
|-- tpm2              <= TPM2 library (downloaded separately)
`-- tpm2_server       <= this server implementation

Building the code on a recent Ubuntu host requires gcc toolchain and crypto and ftdi libraries, other than that it is as simple as running make -j in the ./tpm2_server root directory.

The executable including the software TPM2 implementation is produced as ../build/tpm2_server/ntpm

Note that you don't need to build the TPM2 library separately, but if required a standalone TPM2 library can be produced by running make -j in the ../tpm2 directory, it is generated as ../tpm2/build/libtpm2.a

==== Running the server =====

The server accepts the following command line options:

  -d        - enable debug tracing
  -f NUM    - ftdi clock frequency  ## when using a TPM2 chip over USB
  -p NUM    - port number  ## port the server listens on, default value is 9833
  -s        - use simulator instead of the USB interface

When you run ../build/tpm2_server/ntpm with no command line arguments, it will find and connect to a USB-to-FTDI-to-SPI adapter which expected to have a TPM2 device attached (see below).

If you run it with -s command line argument, it starts the built-in TPM2 simulator instead.

Once initialized, the server listens on localhost:9833 for incoming connections. To talk to the TPM, you can send and receive binary data over the socket. For example, the TPM2_Startup command is sent as

80 01 00 00 00 0c 00 00 01 44 00 00

and the expected response is

80 01 00 00 00 0a 00 00 00 00

==== Connecting an actual TPM2 device =========

If using the C232HM cable, the leads are connected to TPM pins as follows:

Cable lead TPM pin
black GROUND
red VPP
green MISO
yellow MOSI
brown CS
orange CLK
gray RESET

tpm2_server's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.