Semester Thesis
A Software-based TPM Emulator
for Linux
Mario Strasser
Department of Computer Science
Swiss Federal Institute of Technology Zurich
Summer Semester 2004
Supervisors:
Paul E. Sevinç
Prof. Dr. David Basin
Abstract
The Trusted Computing Group (TCG) has produced several specifications for trusted computing
such as for a security chip, called Trusted Platform Module (TPM), and for related software inter-
faces (TCG Software Stack Specification (TSS)).
Although a TPM is probably going to be part of more and more state-of-the-art personal comput-
ers, there are and will always be situations where a TPM is unavailable or unaccessible. Further-
more, the TCG and the TPM in particular are controversial and disputed matters. Therefore, the
goal of this semester thesis was not to show that TPMs are either good or bad, but to implement
a software-based TPM emulator for Linux to give people the means to easily explore TPMs for
educational and experimental purposes.
In the course of this semester thesis, about 50 out of 120 (∼42%) TPM commands have been
implemented and for the remaining, appropriate function-stubs have been provided. Additionally,
a complete TCG Device Driver Library (TDDL) to access the TPM has been created to provide
future applications with a suitable and standardized device interface. Despite the limited function-
ality, almost all available TPM applications work well with the current emulator implementation
as the most important and frequent commands are already supported. Currently, the TPM emu-
lator has been successfully tested by the developers as well as by two other people and on three
different Linux platforms.
Contents
1
Introduction
.
1.1 Motivation and Goals .
.
1.2 Tasks
.
1.3 Typographic Conventions .
.
1.4 Outline
.
1.5 Acknowledgments
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . .
.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. .
. .
2 Trusted Computing and Trusted Platform Module Basics
.
2.1 Trusted Computing .
2.2 Trusted Platform Module .
.
.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3
4
Installation and Usage
3.1 TPM Emulator
. .
.
3.2 TCG Device Driver Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. .
. .
. .
. .
. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . .
Implementation of the TPM Emulator
.
4.1 Concept
.
. .
4.2 Structure .
4.3 Naming and Coding Conventions . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.4 License and Copyright
.
4.5 Kernel Module/Interface .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
.
4.6 TPM Data Structures .
4.7
.
.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.8 Marshaling and Unmarshaling . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.9 Authorization .
.
4.10 Cryptographic Functions .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.11 Initialization, Self-Test, and Shutdown . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.12 Command Execution .
4.13 Command Summary .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.14 TCG Device Driver Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Internal Data
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
1
1
1
2
2
2
3
3
4
11
11
13
19
19
19
20
20
21
21
23
25
27
28
29
30
31
38
IV
5 Conclusion
5.1 Summary .
5.2 Outlook .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
A FIPS Tests
. . . . . . . . . . . . . . . . . . . . . . . .
.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. .
. .
A.1 Statistical Random Number Generator Tests [FIPS140] . . . . . . . . . . . . . .
A.2 SHA-1 Test Vectors [FIPS180] . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . .
A.3 HMAC Test Vectors [RFC2202]
B Source and Documentation Files
B.1 CD-ROM Content .
.
B.2 TPM Emulator Package .
B.3 TDDL Package .
.
.
.
.
.
.
.
.
.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CONTENTS
39
39
39
41
41
42
42
45
45
45
46
Chapter 1
Introduction
What I cannot create I do not understand.
– R. Feynman
1.1 Motivation and Goals
The Trusted Computing Group (TCG) [TCGBG] – successor of the Trusted Computing Platform
Alliance (TCPA) – has produced several specifications for trusted computing such as for a security
chip, called Trusted Platform Module (TPM) or Fritz-Chip1, and for related software interfaces
(TCG Software Stack Specification (TSS)) [TPMPart1, TPMArch, TSS11].
Although a TPM is probably going to be part of more and more state-of-the-art personal com-
puters, there are and will always be situations where a TPM is unavailable or unaccessible. Fur-
thermore, the TCG and the TPM in particular are controversial and disputed matters. Therefore,
the goal of this semester thesis was not to show that TPMs are either good or bad (whatever this
means), but to implement a software-based TPM emulator for Linux to give people the means to
easily explore TPMs for educational and experimental purposes.
Linux was chosen as the target platform for two main reasons: First, almost all currently available
TPM-based applications and projects (e.g., IBM’s TPM utilities [IBMSW], tcgLinux [IBMTL] or
the enforcer project [DCEF]) run under Linux. Second, we are more familiar with device-driver
development under Linux than under any other operating system.
1.2 Tasks
• Implementation of a software-based TPM emulator for Linux by means of a Linux kernel
module.
• Implementation of an appropriate TCG Device Driver Library (TDDL) to access the emu-
lator.
• Making the device interface of the emulator compatible to IBM’s device driver [IBMSW].
• At least supporting Linux kernel release 2.4.
1Named after the famous US-senator Fritz Hollings who supports the ideas of the TCG very much.
2
Chapter 1 - Introduction
1.3 Typographic Conventions
• Functions, variables, and constants are set in a mono-spaced typewriter font:
function(), data, CONSTANT.
• Shell commands are marked with a leading #:
# ls *.c
• Code snippets and listings contain colored and highlighted keywords and are printed in a
smaller font:
/* listing example */
for (int i = 0; i < 10; i++) ...
1.4 Outline
This report is structured as follows: Chapter two gives a brief introduction into Trusted Comput-
ing and highlights the capabilities of the Trusted Platform Module (readers already familiar with
these topics might skip this chapter). In chapter three, the installation and usage of the TPM em-
ulator as well as of the dedicated device driver library are explained. Chapter four, describes the
implementation of the TPM emulator. Note that this chapter only points out the most important
implementation and design issues and decisions. For a more detailed description we refer to the
documented source code and [TPMPart1, TPMPart2, TPMPart3]. In chapter five, we conclude by
giving a summary and a short outlook of future work.
1.5 Acknowledgments
I would like to extend my gratitude to all people who made this semester thesis possible. First of
all I would like to thank my supervisors Prof. Dr. David Basin and Paul E. Sevinç.
A special thank you goes to Achim D. Brucker and Michael Näf for supplying me with the neces-
sary hardware and software.
Furthermore, I would like to thank Jeff Kravitz and David Safford from the IBM Watson Research
Center for sharing information about their TPM libraries and examples with me, as well as Omen
Wild from Dartmouth College and Jesus Molina from the University of Maryland for testing the
emulator.