aboutsummaryrefslogtreecommitdiffstats
path: root/tools/vtpm/tpm_emulator.patch
blob: a6a421a914879201c698adbfc4ed8b9a14f3fca8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
diff -uprN orig/tpm_emulator-0.2-x86_64/AUTHORS tpm_emulator/AUTHORS
--- orig/tpm_emulator-0.2-x86_64/AUTHORS	2005-08-15 00:58:57.000000000 -0700
+++ tpm_emulator/AUTHORS	2005-09-14 20:27:22.000000000 -0700
@@ -1 +1,2 @@
 Mario Strasser <mast@gmx.net>
+INTEL Corp <>
diff -uprN orig/tpm_emulator-0.2-x86_64/ChangeLog tpm_emulator/ChangeLog
--- orig/tpm_emulator-0.2-x86_64/ChangeLog	2005-08-15 00:58:57.000000000 -0700
+++ tpm_emulator/ChangeLog	2005-09-14 20:27:22.000000000 -0700
@@ -1,3 +1,7 @@
+2005-08-16: INTEL Corp
+	* Set default permissions to PCRs
+	* Changed device to /dev/tpm0
+
 2005-08-15  Mario Strasser <mast@gmx.net>
 	* all: some typos corrected
 	* tpm_integrity.c: bug in TPM_Extend fixed
diff -uprN orig/tpm_emulator-0.2-x86_64/linux_module.h tpm_emulator/linux_module.h
--- orig/tpm_emulator-0.2-x86_64/linux_module.h	2005-09-15 19:21:14.844078720 -0700
+++ tpm_emulator/linux_module.h	2005-09-14 20:27:22.000000000 -0700
@@ -1,5 +1,6 @@
 /* Software-Based Trusted Platform Module (TPM) Emulator for Linux
  * Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
+ * Copyright (C) 2005 INTEL Corp.
  *
  * This module is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published
@@ -35,7 +36,7 @@
 #include "tpm_version.h"
 
 #define TPM_DEVICE_MINOR	224
-#define TPM_DEVICE_NAME         "tpm"
+#define TPM_DEVICE_NAME         "tpm0"
 #define TPM_MODULE_NAME 	"tpm_emulator"
 
 /* debug and log output functions */
diff -uprN orig/tpm_emulator-0.2-x86_64/Makefile tpm_emulator/Makefile
--- orig/tpm_emulator-0.2-x86_64/Makefile	2005-09-15 19:21:14.845078568 -0700
+++ tpm_emulator/Makefile	2005-09-14 20:27:22.000000000 -0700
@@ -1,16 +1,22 @@
 # Software-Based Trusted Platform Module (TPM) Emulator for Linux
 # Copyright (C) 2004 Mario Strasser <mast@gmx.net>
+# Copyright (C) 2005 INTEL Corp.
 #
 # $Id: Makefile 10 2005-04-26 20:59:50Z mast $
 
+XEN_ROOT       := ../../..
+EUID           := $(shell id -u)
+
 # kernel settings
 KERNEL_RELEASE := $(shell uname -r)
-KERNEL_BUILD   := /lib/modules/$(KERNEL_RELEASE)/build
+CUR_DIR        := $(shell pwd)
+LINUX_VERSION  := $(shell cat $(CUR_DIR)/$(XEN_ROOT)/buildconfigs/mk.linux-2.6-xen | grep "LINUX_VER" | grep "2.6" | gawk '{ print $$3 }' )
+KERNEL_BUILD   := $(XEN_ROOT)/linux-$(LINUX_VERSION)-xen
 MOD_SUBDIR     := misc
 COMPILE_ARCH    ?= $(shell uname -m | sed -e s/i.86/x86_32/)
 
 # module settings
-MODULE_NAME    := tpm_emulator
+BIN            := tpm_emulator
 VERSION_MAJOR  := 0
 VERSION_MINOR  := 2
 VERSION_BUILD  := $(shell date +"%s")
@@ -34,11 +38,9 @@ DIRS           := . crypto tpm 
 SRCS           := $(foreach dir, $(DIRS), $(wildcard $(src)/$(dir)/*.c))
 OBJS           := $(patsubst %.c, %.o, $(SRCS))
 SRCS           += $(foreach dir, $(DIRS), $(wildcard $(src)/$(dir)/*.h))
-DISTSRC        := ./README ./AUTHORS ./ChangeLog ./Makefile $(SRCS)
-DISTDIR        := tpm_emulator-$(VERSION_MAJOR).$(VERSION_MINOR)
 
-obj-m               := $(MODULE_NAME).o
-$(MODULE_NAME)-objs := $(patsubst $(src)/%.o, %.o, $(OBJS)) crypto/libgmp.a
+obj-m               := $(BIN).o
+$(BIN)-objs := $(patsubst $(src)/%.o, %.o, $(OBJS)) crypto/libgmp.a
 
 EXTRA_CFLAGS   += -I$(src) -I$(src)/crypto -I$(src)/tpm 
 
@@ -49,23 +51,17 @@ all:	$(src)/crypto/gmp.h $(src)/crypto/l
 	@$(MAKE) -C $(KERNEL_BUILD) M=$(CURDIR) modules
 
 install:
-	@$(MAKE) -C $(KERNEL_BUILD) M=$(CURDIR) modules_install
-	test -d /var/tpm || mkdir /var/tpm
-	test -c /dev/tpm || mknod /dev/tpm c 10 224
-	chmod 666 /dev/tpm
-	depmod -a
+	@$(MAKE) -C $(KERNEL_BUILD) M=$(CURDIR) INSTALL_MOD_PATH=$(DESTDIR) modules_install
+	test -d $(DESTDIR)/var/tpm || mkdir $(DESTDIR)/var/tpm
+	test -d $(DESTDIR)/dev || mkdir $(DESTDIR)/dev
+	test -c $(DESTDIR)/dev/tpm0 || [ $(EUID) -ne 0 ] || mknod $(DESTDIR)/dev/tpm0 c 10 224
+	[ $(EUID) -ne 0 ] || chmod 666 $(DESTDIR)/dev/tpm0
 
 clean:
 	@$(MAKE) -C $(KERNEL_BUILD) M=$(CURDIR) clean
 	rm -f $(src)/crypto/gmp.h $(src)/crypto/libgmp.a
 
-dist:	$(DISTSRC)
-	rm -rf $(DISTDIR)
-	mkdir $(DISTDIR)
-	cp --parents $(DISTSRC) $(DISTDIR)/
-	rm -f $(DISTDIR)/crypto/gmp.h 
-	tar -chzf $(DISTDIR).tar.gz $(DISTDIR)
-	rm -rf $(DISTDIR)
+mrproper: clean
 
 $(src)/crypto/libgmp.a:
 	test -f $(src)/crypto/libgmp.a || ln -s $(GMP_LIB) $(src)/crypto/libgmp.a
diff -uprN orig/tpm_emulator-0.2-x86_64/README tpm_emulator/README
--- orig/tpm_emulator-0.2-x86_64/README	2005-08-15 00:58:57.000000000 -0700
+++ tpm_emulator/README	2005-09-14 20:27:22.000000000 -0700
@@ -13,7 +13,8 @@ $Id: README 8 2005-01-25 21:11:45Z jmoli
 Copyright
 --------------------------------------------------------------------------
 Copyright (C) 2004 Mario Strasser <mast@gmx.net> and Swiss Federal 
-Institute of Technology (ETH) Zurich.
+                   Institute of Technology (ETH) Zurich.
+Copyright (C) 2005 
               
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
diff -uprN orig/tpm_emulator-0.2-x86_64/tpm/tpm_data.c tpm_emulator/tpm/tpm_data.c
--- orig/tpm_emulator-0.2-x86_64/tpm/tpm_data.c	2005-09-15 19:21:14.847078264 -0700
+++ tpm_emulator/tpm/tpm_data.c	2005-09-14 20:27:22.000000000 -0700
@@ -1,6 +1,7 @@
 /* Software-Based Trusted Platform Module (TPM) Emulator for Linux
  * Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
  *                    Swiss Federal Institute of Technology (ETH) Zurich
+ * Copyright (C) 2005 INTEL Corp
  *
  * This module is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published
@@ -85,6 +86,11 @@ void tpm_init_data(void)
   tpmData.permanent.data.version.revMinor = VERSION_MINOR;
   /* setup PCR attributes */
   for (i = 0; i < TPM_NUM_PCR; i++) {
+    int j;
+    for (j=0; j < TPM_NUM_LOCALITY; j++) {
+      tpmData.permanent.data.pcrAttrib[i].pcrExtendLocal[j] = TRUE;
+    }
+
     tpmData.permanent.data.pcrAttrib[i].pcrReset = TRUE;
   }
   /* set tick type */