[VTPM_TOOLS] Updated vtpm for new release of the tpm_emulator.

New emulator includes AIK, DAA, and Transport Sessions
Signed-off-by: Vinnie Scarlata <Vincent.r.scarlata@intel.com>
This commit is contained in:
kaf24@firebug.cl.cam.ac.uk committed 2006-05-31 07:45:20 +01:00
1 parent 7469df6c08
commit 5426ba079f
4 files changed
+424 -210

No files matched your search

+7 -7
View File
@@ -9,7 +9,7 @@ TPM_EMULATOR_DIR = tpm_emulator
VTPM_DIR = vtpm
# Emulator tarball name
TPM_EMULATOR_TARFILE = tpm_emulator-0.2b.tar.gz
TPM_EMULATOR_TARFILE = tpm_emulator-0.3.tar.gz
GMP_HEADER = /usr/include/gmp.h
@@ -47,23 +47,23 @@ $(TPM_EMULATOR_TARFILE):
# Create vtpm and TPM emulator dirs
# apply patches for 1) used as dom0 tpm driver 2) used as vtpm device instance
$(TPM_EMULATOR_DIR): $(TPM_EMULATOR_TARFILE) tpm_emulator.patch tpm_emulator-0.2b-x86_64.patch
$(TPM_EMULATOR_DIR): $(TPM_EMULATOR_TARFILE) tpm_emulator.patch tpm_emulator-0.3-x86_64.patch
if [ "$(BUILD_EMULATOR)" = "y" ]; then \
tar -xzf $(TPM_EMULATOR_TARFILE); \
rm -rf $(TPM_EMULATOR_DIR); \
mv tpm_emulator-0.2 $(TPM_EMULATOR_DIR); \
mv tpm_emulator-0.3 $(TPM_EMULATOR_DIR); \
cd $(TPM_EMULATOR_DIR); \
patch -p1 < ../tpm_emulator-0.2b-x86_64.patch; \
patch -p1 < ../tpm_emulator-0.3-x86_64.patch; \
patch -p1 <../tpm_emulator.patch; \
fi
$(VTPM_DIR): $(TPM_EMULATOR_TARFILE) tpm_emulator-0.2b-x86_64.patch vtpm.patch
$(VTPM_DIR): $(TPM_EMULATOR_TARFILE) tpm_emulator-0.3-x86_64.patch vtpm.patch
tar -xzf $(TPM_EMULATOR_TARFILE);
rm -rf $(VTPM_DIR)
mv tpm_emulator-0.2 $(VTPM_DIR);
mv tpm_emulator-0.3 $(VTPM_DIR);
cd $(VTPM_DIR); \
patch -p1 < ../tpm_emulator-0.2b-x86_64.patch; \
patch -p1 < ../tpm_emulator-0.3-x86_64.patch; \
patch -p1 <../vtpm.patch
.PHONY: build_sub
+1
View File
@@ -33,6 +33,7 @@ $(OBJS): $(SRCS)
-include $(DEP_FILES)
# Emulator does not work on 64-bit systems, and may be broken on 32 right now
BUILD_EMULATOR = n
# Make sure these are just rules
@@ -1,6 +1,6 @@
diff -uprN tpm_emulator-0.2/crypto/gmp_kernel_wrapper.c tpm_emulator-0.2-x86_64/crypto/gmp_kernel_wrapper.c
--- tpm_emulator-0.2/crypto/gmp_kernel_wrapper.c 2005-08-15 00:58:57.000000000 -0700
+++ tpm_emulator-0.2-x86_64/crypto/gmp_kernel_wrapper.c 2005-09-19 14:10:29.000000000 -0700
diff -uprN tpm_emulator-0.3/crypto/gmp_kernel_wrapper.c tpm_emulator-0.3-x86_64/crypto/gmp_kernel_wrapper.c
--- tpm_emulator-0.3/crypto/gmp_kernel_wrapper.c 2006-01-10 04:21:45.000000000 -0800
+++ tpm_emulator-0.3-x86_64/crypto/gmp_kernel_wrapper.c 2006-05-26 11:26:02.000000000 -0700
@@ -79,7 +79,7 @@ void __attribute__ ((regparm(0))) *kerne
{
void *ret = (void*)kmalloc(size, GFP_KERNEL);
@@ -19,10 +19,10 @@ diff -uprN tpm_emulator-0.2/crypto/gmp_kernel_wrapper.c tpm_emulator-0.2-x86_64/
memcpy(ret, oldptr, old_size);
kfree(oldptr);
return ret;
diff -uprN tpm_emulator-0.2/linux_module.c tpm_emulator-0.2-x86_64/linux_module.c
--- tpm_emulator-0.2/linux_module.c 2005-08-15 00:58:57.000000000 -0700
+++ tpm_emulator-0.2-x86_64/linux_module.c 2005-09-19 14:10:29.000000000 -0700
@@ -66,7 +66,7 @@ static int tpm_release(struct inode *ino
diff -uprN tpm_emulator-0.3/linux_module.c tpm_emulator-0.3-x86_64/linux_module.c
--- tpm_emulator-0.3/linux_module.c 2006-01-10 04:21:45.000000000 -0800
+++ tpm_emulator-0.3-x86_64/linux_module.c 2006-05-26 11:26:02.000000000 -0700
@@ -72,7 +72,7 @@ static int tpm_release(struct inode *ino
static ssize_t tpm_read(struct file *file, char *buf, size_t count, loff_t *ppos)
{
@@ -31,7 +31,7 @@ diff -uprN tpm_emulator-0.2/linux_module.c tpm_emulator-0.2-x86_64/linux_module.
down(&tpm_mutex);
if (tpm_response.data != NULL) {
count = min(count, (size_t)tpm_response.size - (size_t)*ppos);
@@ -81,7 +81,7 @@ static ssize_t tpm_read(struct file *fil
@@ -91,7 +91,7 @@ static ssize_t tpm_read(struct file *fil
static ssize_t tpm_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
{
@@ -40,9 +40,9 @@ diff -uprN tpm_emulator-0.2/linux_module.c tpm_emulator-0.2-x86_64/linux_module.
down(&tpm_mutex);
*ppos = 0;
if (tpm_response.data != NULL) kfree(tpm_response.data);
diff -uprN tpm_emulator-0.2/linux_module.h tpm_emulator-0.2-x86_64/linux_module.h
--- tpm_emulator-0.2/linux_module.h 2005-08-15 00:58:57.000000000 -0700
+++ tpm_emulator-0.2-x86_64/linux_module.h 2005-09-19 14:10:29.000000000 -0700
diff -uprN tpm_emulator-0.3/linux_module.h tpm_emulator-0.3-x86_64/linux_module.h
--- tpm_emulator-0.3/linux_module.h 2006-01-10 04:21:45.000000000 -0800
+++ tpm_emulator-0.3-x86_64/linux_module.h 2006-05-26 11:26:02.000000000 -0700
@@ -28,8 +28,10 @@
/* module settings */
@@ -54,9 +54,9 @@ diff -uprN tpm_emulator-0.2/linux_module.h tpm_emulator-0.2-x86_64/linux_module.
#include "tpm_version.h"
#define TPM_DEVICE_MINOR 224
diff -uprN tpm_emulator-0.2/Makefile tpm_emulator-0.2-x86_64/Makefile
--- tpm_emulator-0.2/Makefile 2005-08-15 00:58:57.000000000 -0700
+++ tpm_emulator-0.2-x86_64/Makefile 2005-09-19 14:10:29.000000000 -0700
diff -uprN tpm_emulator-0.3/Makefile tpm_emulator-0.3-x86_64/Makefile
--- tpm_emulator-0.3/Makefile 2006-01-10 04:21:45.000000000 -0800
+++ tpm_emulator-0.3-x86_64/Makefile 2006-05-26 11:26:02.000000000 -0700
@@ -7,6 +7,7 @@
KERNEL_RELEASE := $(shell uname -r)
KERNEL_BUILD := /lib/modules/$(KERNEL_RELEASE)/build
@@ -67,7 +67,7 @@ diff -uprN tpm_emulator-0.2/Makefile tpm_emulator-0.2-x86_64/Makefile
MODULE_NAME := tpm_emulator
@@ -17,8 +18,14 @@ VERSION_BUILD := $(shell date +"%s")
# enable/disable DEBUG messages
EXTRA_CFLAGS += -DDEBUG -g
EXTRA_CFLAGS += -Wall -DDEBUG -g
+ifeq ($(COMPILE_ARCH),x86_64)
+LIBDIR = lib64
@@ -81,10 +81,10 @@ diff -uprN tpm_emulator-0.2/Makefile tpm_emulator-0.2-x86_64/Makefile
GMP_HEADER := /usr/include/gmp.h
# sources and objects
diff -uprN tpm_emulator-0.2/README tpm_emulator-0.2-x86_64/README
--- tpm_emulator-0.2/README 2005-08-15 00:58:57.000000000 -0700
+++ tpm_emulator-0.2-x86_64/README 2005-09-19 14:21:43.000000000 -0700
@@ -45,6 +45,12 @@ Example:
diff -uprN tpm_emulator-0.3/README tpm_emulator-0.3-x86_64/README
--- tpm_emulator-0.3/README 2006-01-10 04:21:45.000000000 -0800
+++ tpm_emulator-0.3-x86_64/README 2006-05-26 11:26:02.000000000 -0700
@@ -43,6 +43,12 @@ Example:
GMP_LIB := /usr/lib/libgmp.a
GMP_HEADER := /usr/include/gmp.h
@@ -97,9 +97,9 @@ diff -uprN tpm_emulator-0.2/README tpm_emulator-0.2-x86_64/README
Installation
--------------------------------------------------------------------------
The compilation and installation process uses the build environment for
diff -uprN tpm_emulator-0.2/tpm/tpm_credentials.c tpm_emulator-0.2-x86_64/tpm/tpm_credentials.c
--- tpm_emulator-0.2/tpm/tpm_credentials.c 2005-08-15 00:58:57.000000000 -0700
+++ tpm_emulator-0.2-x86_64/tpm/tpm_credentials.c 2005-09-19 14:10:29.000000000 -0700
diff -uprN tpm_emulator-0.3/tpm/tpm_credentials.c tpm_emulator-0.3-x86_64/tpm/tpm_credentials.c
--- tpm_emulator-0.3/tpm/tpm_credentials.c 2006-01-10 04:21:45.000000000 -0800
+++ tpm_emulator-0.3-x86_64/tpm/tpm_credentials.c 2006-05-26 11:26:02.000000000 -0700
@@ -47,16 +47,16 @@ int tpm_compute_pubkey_checksum(TPM_NONC
TPM_RESULT tpm_get_pubek(TPM_PUBKEY *pubEndorsementKey)
@@ -122,7 +122,7 @@ diff -uprN tpm_emulator-0.2/tpm/tpm_credentials.c tpm_emulator-0.2-x86_64/tpm/tp
pubEndorsementKey->algorithmParms.algorithmID = TPM_ALG_RSA;
pubEndorsementKey->algorithmParms.encScheme = TPM_ES_RSAESOAEP_SHA1_MGF1;
pubEndorsementKey->algorithmParms.sigScheme = TPM_SS_NONE;
@@ -169,6 +169,7 @@ TPM_RESULT TPM_OwnerReadInternalPub(TPM_
@@ -175,6 +175,7 @@ TPM_RESULT TPM_OwnerReadInternalPub(TPM_
{
TPM_RESULT res;
TPM_KEY_DATA *srk = &tpmData.permanent.data.srk;
@@ -130,7 +130,7 @@ diff -uprN tpm_emulator-0.2/tpm/tpm_credentials.c tpm_emulator-0.2-x86_64/tpm/tp
info("TPM_OwnerReadInternalPub()");
/* verify authorization */
res = tpm_verify_auth(auth1, tpmData.permanent.data.ownerAuth, TPM_KH_OWNER);
@@ -180,7 +181,8 @@ TPM_RESULT TPM_OwnerReadInternalPub(TPM_
@@ -186,7 +187,8 @@ TPM_RESULT TPM_OwnerReadInternalPub(TPM_
publicPortion->pubKey.key = tpm_malloc(publicPortion->pubKey.keyLength);
if (publicPortion->pubKey.key == NULL) return TPM_FAIL;
rsa_export_modulus(&srk->key, publicPortion->pubKey.key,
@@ -140,9 +140,9 @@ diff -uprN tpm_emulator-0.2/tpm/tpm_credentials.c tpm_emulator-0.2-x86_64/tpm/tp
publicPortion->algorithmParms.algorithmID = TPM_ALG_RSA;
publicPortion->algorithmParms.encScheme = srk->encScheme;
publicPortion->algorithmParms.sigScheme = srk->sigScheme;
diff -uprN tpm_emulator-0.2/tpm/tpm_crypto.c tpm_emulator-0.2-x86_64/tpm/tpm_crypto.c
--- tpm_emulator-0.2/tpm/tpm_crypto.c 2005-08-15 00:58:57.000000000 -0700
+++ tpm_emulator-0.2-x86_64/tpm/tpm_crypto.c 2005-09-19 14:10:29.000000000 -0700
diff -uprN tpm_emulator-0.3/tpm/tpm_crypto.c tpm_emulator-0.3-x86_64/tpm/tpm_crypto.c
--- tpm_emulator-0.3/tpm/tpm_crypto.c 2006-01-10 04:21:45.000000000 -0800
+++ tpm_emulator-0.3-x86_64/tpm/tpm_crypto.c 2006-05-26 11:26:02.000000000 -0700
@@ -182,7 +182,8 @@ TPM_RESULT TPM_CertifyKey(TPM_KEY_HANDLE
TPM_KEY_DATA *cert, *key;
sha1_ctx_t sha1_ctx;
@@ -192,10 +192,10 @@ diff -uprN tpm_emulator-0.2/tpm/tpm_crypto.c tpm_emulator-0.2-x86_64/tpm/tpm_cry
free_TPM_KEY_PARMS(certifyInfo->algorithmParms);
return TPM_FAIL;
}
diff -uprN tpm_emulator-0.2/tpm/tpm_data.c tpm_emulator-0.2-x86_64/tpm/tpm_data.c
--- tpm_emulator-0.2/tpm/tpm_data.c 2005-08-15 00:58:57.000000000 -0700
+++ tpm_emulator-0.2-x86_64/tpm/tpm_data.c 2005-09-19 14:10:29.000000000 -0700
@@ -179,7 +179,7 @@ static int read_from_file(uint8_t **data
diff -uprN tpm_emulator-0.3/tpm/tpm_data.c tpm_emulator-0.3-x86_64/tpm/tpm_data.c
--- tpm_emulator-0.3/tpm/tpm_data.c 2006-01-10 04:21:45.000000000 -0800
+++ tpm_emulator-0.3-x86_64/tpm/tpm_data.c 2006-05-26 11:26:02.000000000 -0700
@@ -214,7 +214,7 @@ static int read_from_file(uint8_t **data
int tpm_store_permanent_data(void)
{
uint8_t *buf, *ptr;
@@ -204,7 +204,7 @@ diff -uprN tpm_emulator-0.2/tpm/tpm_data.c tpm_emulator-0.2-x86_64/tpm/tpm_data.
/* marshal data */
buf_length = len = sizeof_TPM_STCLEAR_FLAGS(tpmData.stclear.flags)
@@ -207,13 +207,14 @@ int tpm_store_permanent_data(void)
@@ -242,13 +242,14 @@ int tpm_store_permanent_data(void)
int tpm_restore_permanent_data(void)
{
uint8_t *buf, *ptr;
@@ -221,10 +221,10 @@ diff -uprN tpm_emulator-0.2/tpm/tpm_data.c tpm_emulator-0.2-x86_64/tpm/tpm_data.
/* unmarshal data */
if (tpm_unmarshal_TPM_VERSION(&ptr, &len, &ver)
|| memcmp(&ver, &tpmData.permanent.data.version, sizeof(TPM_VERSION))
diff -uprN tpm_emulator-0.2/tpm/tpm_marshalling.c tpm_emulator-0.2-x86_64/tpm/tpm_marshalling.c
--- tpm_emulator-0.2/tpm/tpm_marshalling.c 2005-08-15 00:58:57.000000000 -0700
+++ tpm_emulator-0.2-x86_64/tpm/tpm_marshalling.c 2005-09-19 14:10:29.000000000 -0700
@@ -981,7 +981,7 @@ int tpm_unmarshal_TPM_STANY_FLAGS(BYTE *
diff -uprN tpm_emulator-0.3/tpm/tpm_marshalling.c tpm_emulator-0.3-x86_64/tpm/tpm_marshalling.c
--- tpm_emulator-0.3/tpm/tpm_marshalling.c 2006-01-10 04:21:45.000000000 -0800
+++ tpm_emulator-0.3-x86_64/tpm/tpm_marshalling.c 2006-05-26 11:26:02.000000000 -0700
@@ -1212,7 +1212,7 @@ int tpm_unmarshal_TPM_STANY_FLAGS(BYTE *
int tpm_marshal_RSA(BYTE **ptr, UINT32 *length, rsa_private_key_t *v)
{
@@ -233,9 +233,9 @@ diff -uprN tpm_emulator-0.2/tpm/tpm_marshalling.c tpm_emulator-0.2-x86_64/tpm/tp
if (*length < sizeof_RSA((*v))) return -1;
if (v->size > 0) {
rsa_export_modulus(v, &(*ptr)[6], &m_len);
diff -uprN tpm_emulator-0.2/tpm/tpm_owner.c tpm_emulator-0.2-x86_64/tpm/tpm_owner.c
--- tpm_emulator-0.2/tpm/tpm_owner.c 2005-08-15 00:58:57.000000000 -0700
+++ tpm_emulator-0.2-x86_64/tpm/tpm_owner.c 2005-09-19 14:10:29.000000000 -0700
diff -uprN tpm_emulator-0.3/tpm/tpm_owner.c tpm_emulator-0.3-x86_64/tpm/tpm_owner.c
--- tpm_emulator-0.3/tpm/tpm_owner.c 2006-01-10 04:21:45.000000000 -0800
+++ tpm_emulator-0.3-x86_64/tpm/tpm_owner.c 2006-05-26 11:26:02.000000000 -0700
@@ -108,7 +108,7 @@ TPM_RESULT TPM_TakeOwnership(TPM_PROTOCO
TPM_RESULT res;
rsa_private_key_t *ek = &tpmData.permanent.data.endorsementKey;
@@ -255,9 +255,9 @@ diff -uprN tpm_emulator-0.2/tpm/tpm_owner.c tpm_emulator-0.2-x86_64/tpm/tpm_owne
/* setup tpmProof and set state to owned */
tpm_get_random_bytes(tpmData.permanent.data.tpmProof.nonce,
sizeof(tpmData.permanent.data.tpmProof.nonce));
diff -uprN tpm_emulator-0.2/tpm/tpm_storage.c tpm_emulator-0.2-x86_64/tpm/tpm_storage.c
--- tpm_emulator-0.2/tpm/tpm_storage.c 2005-08-15 00:58:57.000000000 -0700
+++ tpm_emulator-0.2-x86_64/tpm/tpm_storage.c 2005-09-19 14:10:29.000000000 -0700
diff -uprN tpm_emulator-0.3/tpm/tpm_storage.c tpm_emulator-0.3-x86_64/tpm/tpm_storage.c
--- tpm_emulator-0.3/tpm/tpm_storage.c 2006-01-10 04:21:45.000000000 -0800
+++ tpm_emulator-0.3-x86_64/tpm/tpm_storage.c 2006-05-26 14:33:18.000000000 -0700
@@ -58,6 +58,7 @@ int encrypt_sealed_data(TPM_KEY_DATA *ke
BYTE *enc, UINT32 *enc_size)
{
@@ -330,7 +330,7 @@ diff -uprN tpm_emulator-0.2/tpm/tpm_storage.c tpm_emulator-0.2-x86_64/tpm/tpm_st
}
if (rsa_decrypt(&key->key, scheme, inData, inDataSize,
- *outData, outDataSize)) {
+ *outData, &outDataSize) ) {
+ *outData, &outDataSize)) {
tpm_free(*outData);
return TPM_DECRYPT_ERROR;
}
@@ -343,12 +343,11 @@ diff -uprN tpm_emulator-0.2/tpm/tpm_storage.c tpm_emulator-0.2-x86_64/tpm/tpm_st
return TPM_DECRYPT_ERROR;
}
- *outDataSize -= 5;
- memmove(*outData, &(*outData)[5], *outDataSize);
- }
- memmove(*outData, &(*outData)[5], *outDataSize);
+ outDataSize -= 5;
+ memmove(*outData, &(*outData)[5], outDataSize);
+ }
+ *outDataSize32 = (UINT32) outDataSize;
+ memmove(*outData, &(*outData)[5], outDataSize);
}
+ *outDataSize32 = (UINT32) outDataSize;
return TPM_SUCCESS;
}
@@ -391,7 +390,7 @@ diff -uprN tpm_emulator-0.2/tpm/tpm_storage.c tpm_emulator-0.2-x86_64/tpm/tpm_st
BYTE *ptr;
int scheme;
switch (key->encScheme) {
@@ -352,11 +363,16 @@ int decrypt_private_key(TPM_KEY_DATA *ke
@@ -352,8 +363,12 @@ int decrypt_private_key(TPM_KEY_DATA *ke
len = enc_size;
*buf = ptr = tpm_malloc(len);
if (*buf == NULL
@@ -406,11 +405,7 @@ diff -uprN tpm_emulator-0.2/tpm/tpm_storage.c tpm_emulator-0.2-x86_64/tpm/tpm_st
tpm_free(*buf);
return -1;
}
+
return 0;
}
@@ -371,7 +387,7 @@ TPM_RESULT TPM_CreateWrapKey(TPM_KEY_HAN
@@ -371,7 +386,7 @@ TPM_RESULT TPM_CreateWrapKey(TPM_KEY_HAN
TPM_SESSION_DATA *session;
TPM_STORE_ASYMKEY store;
rsa_private_key_t rsa;
@@ -419,7 +414,7 @@ diff -uprN tpm_emulator-0.2/tpm/tpm_storage.c tpm_emulator-0.2-x86_64/tpm/tpm_st
info("TPM_CreateWrapKey()");
/* get parent key */
@@ -428,11 +444,11 @@ TPM_RESULT TPM_CreateWrapKey(TPM_KEY_HAN
@@ -428,11 +443,11 @@ TPM_RESULT TPM_CreateWrapKey(TPM_KEY_HAN
}
if (compute_key_digest(wrappedKey, &store.pubDataDigest)) return TPM_FAIL;
/* generate key and store it */
@@ -435,7 +430,7 @@ diff -uprN tpm_emulator-0.2/tpm/tpm_storage.c tpm_emulator-0.2-x86_64/tpm/tpm_st
store.privKey.key = tpm_malloc(store.privKey.keyLength);
wrappedKey->encDataSize = parent->key.size >> 3;
wrappedKey->encData = tpm_malloc(wrappedKey->encDataSize);
@@ -444,9 +460,11 @@ TPM_RESULT TPM_CreateWrapKey(TPM_KEY_HAN
@@ -444,9 +459,11 @@ TPM_RESULT TPM_CreateWrapKey(TPM_KEY_HAN
tpm_free(wrappedKey->encData);
return TPM_FAIL;
}
@@ -450,7 +445,7 @@ diff -uprN tpm_emulator-0.2/tpm/tpm_storage.c tpm_emulator-0.2-x86_64/tpm/tpm_st
rsa_release_private_key(&rsa);
/* encrypt private key data */
if (encrypt_private_key(parent, &store, wrappedKey->encData,
@@ -560,6 +578,7 @@ TPM_RESULT TPM_LoadKey(TPM_KEY_HANDLE pa
@@ -567,6 +584,7 @@ TPM_RESULT TPM_LoadKey2(TPM_KEY_HANDLE p
int tpm_setup_key_parms(TPM_KEY_DATA *key, TPM_KEY_PARMS *parms)
{
@@ -458,17 +453,17 @@ diff -uprN tpm_emulator-0.2/tpm/tpm_storage.c tpm_emulator-0.2-x86_64/tpm/tpm_st
parms->algorithmID = TPM_ALG_RSA;
parms->encScheme = key->encScheme;
parms->sigScheme = key->sigScheme;
@@ -569,7 +588,8 @@ int tpm_setup_key_parms(TPM_KEY_DATA *ke
@@ -576,7 +594,8 @@ int tpm_setup_key_parms(TPM_KEY_DATA *ke
parms->parms.rsa.exponent = tpm_malloc(parms->parms.rsa.exponentSize);
if (parms->parms.rsa.exponent == NULL) return -1;
rsa_export_exponent(&key->key, parms->parms.rsa.exponent,
- &parms->parms.rsa.exponentSize);
+ &key_length);
+ &key_length);
+ parms->parms.rsa.exponentSize = (UINT32) key_length;
parms->parmSize = 12 + parms->parms.rsa.exponentSize;
parms->parmSize = 12 + parms->parms.rsa.exponentSize;
return 0;
}
@@ -580,6 +600,7 @@ TPM_RESULT TPM_GetPubKey(TPM_KEY_HANDLE
@@ -587,6 +606,7 @@ TPM_RESULT TPM_GetPubKey(TPM_KEY_HANDLE
TPM_RESULT res;
TPM_KEY_DATA *key;
TPM_DIGEST digest;
@@ -476,7 +471,7 @@ diff -uprN tpm_emulator-0.2/tpm/tpm_storage.c tpm_emulator-0.2-x86_64/tpm/tpm_st
info("TPM_GetPubKey()");
/* get key */
if (keyHandle == TPM_KH_SRK) return TPM_BAD_PARAMETER;
@@ -607,8 +628,8 @@ TPM_RESULT TPM_GetPubKey(TPM_KEY_HANDLE
@@ -614,8 +634,8 @@ TPM_RESULT TPM_GetPubKey(TPM_KEY_HANDLE
pubKey->pubKey.keyLength = key->key.size >> 3;
pubKey->pubKey.key = tpm_malloc(pubKey->pubKey.keyLength);
if (pubKey->pubKey.key == NULL) return TPM_FAIL;
@@ -486,14 +481,4 @@ diff -uprN tpm_emulator-0.2/tpm/tpm_storage.c tpm_emulator-0.2-x86_64/tpm/tpm_st
+ pubKey->pubKey.keyLength = (UINT32) key_length;
if (tpm_setup_key_parms(key, &pubKey->algorithmParms) != 0) {
tpm_free(pubKey->pubKey.key);
return TPM_FAIL;
diff -uprN tpm_emulator-0.2/tpm_version.h tpm_emulator-0.2-x86_64/tpm_version.h
--- tpm_emulator-0.2/tpm_version.h 2005-08-15 00:58:57.000000000 -0700
+++ tpm_emulator-0.2-x86_64/tpm_version.h 1969-12-31 16:00:00.000000000 -0800
@@ -1,6 +0,0 @@
-#ifndef _TPM_VERSION_H_
-#define _TPM_VERSION_H_
-#define VERSION_MAJOR 0
-#define VERSION_MINOR 2
-#define VERSION_BUILD 1123950310
-#endif /* _TPM_VERSION_H_ */
return TPM_FAIL;
+358 -130
View File
@@ -1,23 +1,24 @@
diff -uprN orig/tpm_emulator-0.2-x86_64/AUTHORS vtpm/AUTHORS
--- orig/tpm_emulator-0.2-x86_64/AUTHORS 2005-08-15 00:58:57.000000000 -0700
+++ vtpm/AUTHORS 2006-05-17 09:31:11.000000000 -0700
@@ -1 +1,2 @@
diff -uprN orig/tpm_emulator-0.3-x86_64/AUTHORS vtpm/AUTHORS
--- orig/tpm_emulator-0.3-x86_64/AUTHORS 2006-01-10 04:21:45.000000000 -0800
+++ vtpm/AUTHORS 2006-05-30 12:23:26.000000000 -0700
@@ -1,2 +1,3 @@
Mario Strasser <mast@gmx.net>
+INTEL Corp <>
diff -uprN orig/tpm_emulator-0.2-x86_64/ChangeLog vtpm/ChangeLog
--- orig/tpm_emulator-0.2-x86_64/ChangeLog 2005-08-15 00:58:57.000000000 -0700
+++ vtpm/ChangeLog 2006-05-17 09:31:11.000000000 -0700
Heiko Stamer <stamer@gaos.org> [DAA]
+INTEL Corp <> [VTPM Extensions]
diff -uprN orig/tpm_emulator-0.3-x86_64/ChangeLog vtpm/ChangeLog
--- orig/tpm_emulator-0.3-x86_64/ChangeLog 2006-01-10 04:21:45.000000000 -0800
+++ vtpm/ChangeLog 2006-05-30 12:23:26.000000000 -0700
@@ -1,3 +1,7 @@
+2005-08-16 Intel Corp
+ Moved module out of kernel to run as a ring 3 app
+ Modified save_to_file and load_from_file to call a xen backend driver to call a VTPM manager
+ * Moved module out of kernel to run as a ring 3 app
+ * Modified save_to_file and load_from_file to call a xen backend driver to call a VTPM manager
+
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/crypto/gmp_kernel_wrapper.c vtpm/crypto/gmp_kernel_wrapper.c
--- orig/tpm_emulator-0.2-x86_64/crypto/gmp_kernel_wrapper.c 2006-05-17 09:34:13.000000000 -0700
+++ vtpm/crypto/gmp_kernel_wrapper.c 2006-05-17 09:31:11.000000000 -0700
2005-12-24 Mario Strasser <mast@gmx.net>
* tpm_transport.c, tpm_marshalling.c, tpm_structures.h:
Transport session functionality added
diff -uprN orig/tpm_emulator-0.3-x86_64/crypto/gmp_kernel_wrapper.c vtpm/crypto/gmp_kernel_wrapper.c
--- orig/tpm_emulator-0.3-x86_64/crypto/gmp_kernel_wrapper.c 2006-05-30 12:28:02.000000000 -0700
+++ vtpm/crypto/gmp_kernel_wrapper.c 2006-05-30 12:23:26.000000000 -0700
@@ -1,5 +1,6 @@
/* Software-Based Trusted Platform Module (TPM) Emulator for Linux
* Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
@@ -77,9 +78,9 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/crypto/gmp_kernel_wrapper.c vtpm/crypto/
}
}
diff -uprN orig/tpm_emulator-0.2-x86_64/crypto/rsa.c vtpm/crypto/rsa.c
--- orig/tpm_emulator-0.2-x86_64/crypto/rsa.c 2005-08-15 00:58:57.000000000 -0700
+++ vtpm/crypto/rsa.c 2006-05-17 09:31:11.000000000 -0700
diff -uprN orig/tpm_emulator-0.3-x86_64/crypto/rsa.c vtpm/crypto/rsa.c
--- orig/tpm_emulator-0.3-x86_64/crypto/rsa.c 2006-01-10 04:21:45.000000000 -0800
+++ vtpm/crypto/rsa.c 2006-05-30 12:23:26.000000000 -0700
@@ -1,5 +1,6 @@
/* Software-Based Trusted Platform Module (TPM) Emulator for Linux
* Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
@@ -87,7 +88,7 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/crypto/rsa.c vtpm/crypto/rsa.c
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
@@ -363,7 +364,7 @@ static int encode_message(int type, uint
@@ -381,7 +382,7 @@ static int encode_message(int type, uint
msg[0] = 0x00;
get_random_bytes(&msg[1], SHA1_DIGEST_LENGTH);
sha1_init(&ctx);
@@ -96,7 +97,7 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/crypto/rsa.c vtpm/crypto/rsa.c
sha1_final(&ctx, &msg[1 + SHA1_DIGEST_LENGTH]);
memset(&msg[1 + 2 * SHA1_DIGEST_LENGTH], 0x00,
msg_len - data_len - 2 * SHA1_DIGEST_LENGTH - 2);
@@ -411,7 +412,7 @@ static int decode_message(int type, uint
@@ -429,7 +430,7 @@ static int decode_message(int type, uint
mask_generation(&msg[1], SHA1_DIGEST_LENGTH,
&msg[1 + SHA1_DIGEST_LENGTH], msg_len - SHA1_DIGEST_LENGTH - 1);
sha1_init(&ctx);
@@ -105,10 +106,10 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/crypto/rsa.c vtpm/crypto/rsa.c
sha1_final(&ctx, &msg[1]);
if (memcmp(&msg[1], &msg[1 + SHA1_DIGEST_LENGTH],
SHA1_DIGEST_LENGTH) != 0) return -1;
diff -uprN orig/tpm_emulator-0.2-x86_64/linux_module.c vtpm/linux_module.c
--- orig/tpm_emulator-0.2-x86_64/linux_module.c 2006-05-17 09:34:13.000000000 -0700
diff -uprN orig/tpm_emulator-0.3-x86_64/linux_module.c vtpm/linux_module.c
--- orig/tpm_emulator-0.3-x86_64/linux_module.c 2006-05-30 12:28:02.000000000 -0700
+++ vtpm/linux_module.c 1969-12-31 16:00:00.000000000 -0800
@@ -1,163 +0,0 @@
@@ -1,194 +0,0 @@
-/* Software-Based Trusted Platform Module (TPM) Emulator for Linux
- * Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
- *
@@ -122,7 +123,7 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/linux_module.c vtpm/linux_module.c
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * $Id: linux_module.c 19 2005-05-18 08:29:37Z mast $
- * $Id: linux_module.c 76 2006-01-02 22:17:58Z hstamer $
- */
-
-#include <linux/module.h>
@@ -140,11 +141,11 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/linux_module.c vtpm/linux_module.c
-
-/* module startup parameters */
-char *startup = "save";
-MODULE_PARM(startup, "s");
-module_param(startup, charp, 0444);
-MODULE_PARM_DESC(startup, " Sets the startup mode of the TPM. "
- "Possible values are 'clear', 'save' (default) and 'deactivated.");
-char *storage_file = "/var/tpm/tpm_emulator-1.2.0.1";
-MODULE_PARM(storage_file, "s");
-char *storage_file = "/var/tpm/tpm_emulator-1.2.0.2";
-module_param(storage_file, charp, 0644);
-MODULE_PARM_DESC(storage_file, " Sets the persistent-data storage "
- "file of the TPM.");
-
@@ -172,6 +173,12 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/linux_module.c vtpm/linux_module.c
-{
- debug("%s()", __FUNCTION__);
- clear_bit(STATE_IS_OPEN, (void*)&module_state);
- down(&tpm_mutex);
- if (tpm_response.data != NULL) {
- kfree(tpm_response.data);
- tpm_response.data = NULL;
- }
- up(&tpm_mutex);
- return 0;
-}
-
@@ -183,6 +190,10 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/linux_module.c vtpm/linux_module.c
- count = min(count, (size_t)tpm_response.size - (size_t)*ppos);
- count -= copy_to_user(buf, &tpm_response.data[*ppos], count);
- *ppos += count;
- if ((size_t)tpm_response.size == (size_t)*ppos) {
- kfree(tpm_response.data);
- tpm_response.data = NULL;
- }
- } else {
- count = 0;
- }
@@ -205,9 +216,29 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/linux_module.c vtpm/linux_module.c
- return count;
-}
-
-#define TPMIOC_CANCEL _IO('T', 0x00)
-#define TPMIOC_TRANSMIT _IO('T', 0x01)
-
-static int tpm_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
-{
- debug("%s(%d, %ld)", __FUNCTION__, cmd, arg);
- debug("%s(%d, %p)", __FUNCTION__, cmd, (char*)arg);
- if (cmd == TPMIOC_TRANSMIT) {
- uint32_t count = ntohl(*(uint32_t*)(arg + 2));
- down(&tpm_mutex);
- if (tpm_response.data != NULL) kfree(tpm_response.data);
- if (tpm_handle_command((char*)arg, count, &tpm_response.data,
- &tpm_response.size) == 0) {
- tpm_response.size -= copy_to_user((char*)arg, tpm_response.data,
- tpm_response.size);
- kfree(tpm_response.data);
- tpm_response.data = NULL;
- } else {
- tpm_response.size = 0;
- tpm_response.data = NULL;
- }
- up(&tpm_mutex);
- return tpm_response.size;
- }
- return -1;
-}
-
@@ -240,7 +271,7 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/linux_module.c vtpm/linux_module.c
- /* initialize TPM emulator */
- if (!strcmp(startup, "clear")) {
- tpm_emulator_init(1);
- } else if (!strcmp(startup, "save")) {
- } else if (!strcmp(startup, "save")) {
- tpm_emulator_init(2);
- } else if (!strcmp(startup, "deactivated")) {
- tpm_emulator_init(3);
@@ -257,6 +288,7 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/linux_module.c vtpm/linux_module.c
-{
- tpm_emulator_shutdown();
- misc_deregister(&tpm_dev);
- if (tpm_response.data != NULL) kfree(tpm_response.data);
-}
-
-module_init(init_tpm_module);
@@ -264,7 +296,7 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/linux_module.c vtpm/linux_module.c
-
-uint64_t tpm_get_ticks(void)
-{
- static struct timespec old_time = {0, 0};
- static struct timespec old_time = {0, 0};
- struct timespec new_time = current_kernel_time();
- uint64_t ticks = (uint64_t)(old_time.tv_sec - new_time.tv_sec) * 1000000
- + (old_time.tv_nsec - new_time.tv_nsec) / 1000;
@@ -272,9 +304,9 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/linux_module.c vtpm/linux_module.c
- return (ticks > 0) ? ticks : 1;
-}
-
diff -uprN orig/tpm_emulator-0.2-x86_64/linux_module.h vtpm/linux_module.h
--- orig/tpm_emulator-0.2-x86_64/linux_module.h 2006-05-17 09:34:13.000000000 -0700
+++ vtpm/linux_module.h 2006-05-17 09:31:11.000000000 -0700
diff -uprN orig/tpm_emulator-0.3-x86_64/linux_module.h vtpm/linux_module.h
--- orig/tpm_emulator-0.3-x86_64/linux_module.h 2006-05-30 12:28:02.000000000 -0700
+++ vtpm/linux_module.h 2006-05-30 12:23:26.000000000 -0700
@@ -1,5 +1,6 @@
/* Software-Based Trusted Platform Module (TPM) Emulator for Linux
* Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
@@ -374,15 +406,15 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/linux_module.h vtpm/linux_module.h
#define BE16_TO_CPU(x) __be16_to_cpu(x)
#define LE16_TO_CPU(x) __le16_to_cpu(x)
diff -uprN orig/tpm_emulator-0.2-x86_64/Makefile vtpm/Makefile
--- orig/tpm_emulator-0.2-x86_64/Makefile 2006-05-17 09:34:13.000000000 -0700
+++ vtpm/Makefile 2006-05-17 09:31:11.000000000 -0700
diff -uprN orig/tpm_emulator-0.3-x86_64/Makefile vtpm/Makefile
--- orig/tpm_emulator-0.3-x86_64/Makefile 2006-05-30 12:28:02.000000000 -0700
+++ vtpm/Makefile 2006-05-30 12:23:26.000000000 -0700
@@ -1,22 +1,31 @@
# Software-Based Trusted Platform Module (TPM) Emulator for Linux
# Copyright (C) 2004 Mario Strasser <mast@gmx.net>
+# Copyright (C) 2005 INTEL Corp.
+# Copyright (C) 2006 INTEL Corp.
#
# $Id: Makefile 10 2005-04-26 20:59:50Z mast $
# $Id: Makefile 69 2005-12-13 12:55:52Z mast $
-# kernel settings
-KERNEL_RELEASE := $(shell uname -r)
@@ -394,11 +426,11 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/Makefile vtpm/Makefile
-MODULE_NAME := tpm_emulator
+BIN := vtpmd
VERSION_MAJOR := 0
VERSION_MINOR := 2
VERSION_MINOR := 3
VERSION_BUILD := $(shell date +"%s")
-# enable/disable DEBUG messages
-EXTRA_CFLAGS += -DDEBUG -g
-EXTRA_CFLAGS += -Wall -DDEBUG -g
+# Installation program and options
+INSTALL = install
+INSTALL_PROG = $(INSTALL) -m0755
@@ -468,10 +500,10 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/Makefile vtpm/Makefile
$(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 vtpm/README
--- orig/tpm_emulator-0.2-x86_64/README 2006-05-17 09:34:13.000000000 -0700
+++ vtpm/README 2006-05-17 09:31:11.000000000 -0700
@@ -13,7 +13,8 @@ $Id: README 8 2005-01-25 21:11:45Z jmoli
diff -uprN orig/tpm_emulator-0.3-x86_64/README vtpm/README
--- orig/tpm_emulator-0.3-x86_64/README 2006-05-30 12:28:02.000000000 -0700
+++ vtpm/README 2006-05-30 12:23:26.000000000 -0700
@@ -13,7 +13,8 @@ $Id: README 78 2006-01-07 10:45:39Z mast
Copyright
--------------------------------------------------------------------------
Copyright (C) 2004 Mario Strasser <mast@gmx.net> and Swiss Federal
@@ -481,9 +513,9 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/README vtpm/README
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_audit.c vtpm/tpm/tpm_audit.c
--- orig/tpm_emulator-0.2-x86_64/tpm/tpm_audit.c 2005-08-15 00:58:57.000000000 -0700
+++ vtpm/tpm/tpm_audit.c 2006-05-17 09:31:11.000000000 -0700
diff -uprN orig/tpm_emulator-0.3-x86_64/tpm/tpm_audit.c vtpm/tpm/tpm_audit.c
--- orig/tpm_emulator-0.3-x86_64/tpm/tpm_audit.c 2006-01-10 04:21:45.000000000 -0800
+++ vtpm/tpm/tpm_audit.c 2006-05-30 12:23:26.000000000 -0700
@@ -1,6 +1,7 @@
/* Software-Based Trusted Platform Module (TPM) Emulator for Linux
* Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
@@ -546,9 +578,9 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/tpm/tpm_audit.c vtpm/tpm/tpm_audit.c
return TPM_SUCCESS;
}
-
diff -uprN orig/tpm_emulator-0.2-x86_64/tpm/tpm_authorization.c vtpm/tpm/tpm_authorization.c
--- orig/tpm_emulator-0.2-x86_64/tpm/tpm_authorization.c 2005-08-15 00:58:57.000000000 -0700
+++ vtpm/tpm/tpm_authorization.c 2006-05-17 09:31:11.000000000 -0700
diff -uprN orig/tpm_emulator-0.3-x86_64/tpm/tpm_authorization.c vtpm/tpm/tpm_authorization.c
--- orig/tpm_emulator-0.3-x86_64/tpm/tpm_authorization.c 2006-01-10 04:21:45.000000000 -0800
+++ vtpm/tpm/tpm_authorization.c 2006-05-30 12:23:26.000000000 -0700
@@ -1,6 +1,7 @@
/* Software-Based Trusted Platform Module (TPM) Emulator for Linux
* Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
@@ -557,7 +589,7 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/tpm/tpm_authorization.c vtpm/tpm/tpm_aut
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
@@ -268,7 +269,7 @@ TPM_RESULT tpm_verify_auth(TPM_AUTH *aut
@@ -279,7 +280,7 @@ TPM_RESULT tpm_verify_auth(TPM_AUTH *aut
{
hmac_ctx_t ctx;
TPM_SESSION_DATA *session;
@@ -565,16 +597,10 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/tpm/tpm_authorization.c vtpm/tpm/tpm_aut
+ UINT32 auth_handle = CPU_TO_BE32(auth->authHandle);
info("tpm_verify_auth(%08x)", auth->authHandle);
/* get dedicated authorization session */
@@ -316,5 +317,3 @@ void tpm_decrypt_auth_secret(TPM_ENCAUTH
for (i = 0; i < sizeof(TPM_SECRET); i++)
plainAuth[i] ^= encAuth[i];
}
-
-
diff -uprN orig/tpm_emulator-0.2-x86_64/tpm/tpm_capability.c vtpm/tpm/tpm_capability.c
--- orig/tpm_emulator-0.2-x86_64/tpm/tpm_capability.c 2005-08-15 00:58:57.000000000 -0700
+++ vtpm/tpm/tpm_capability.c 2006-05-17 09:31:11.000000000 -0700
/* get dedicated authorization or transport session */
diff -uprN orig/tpm_emulator-0.3-x86_64/tpm/tpm_capability.c vtpm/tpm/tpm_capability.c
--- orig/tpm_emulator-0.3-x86_64/tpm/tpm_capability.c 2006-01-10 04:21:45.000000000 -0800
+++ vtpm/tpm/tpm_capability.c 2006-05-30 12:23:26.000000000 -0700
@@ -1,6 +1,7 @@
/* Software-Based Trusted Platform Module (TPM) Emulator for Linux
* Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
@@ -583,7 +609,7 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/tpm/tpm_capability.c vtpm/tpm/tpm_capabi
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
@@ -398,7 +399,7 @@ TPM_RESULT TPM_GetCapability(TPM_CAPABIL
@@ -406,7 +407,7 @@ TPM_RESULT TPM_GetCapability(TPM_CAPABIL
case TPM_CAP_KEY_HANDLE:
debug("[TPM_CAP_KEY_HANDLE]");
@@ -592,14 +618,14 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/tpm/tpm_capability.c vtpm/tpm/tpm_capabi
return cap_handle(4, (BYTE*)&subCapSize, respSize, resp);
case TPM_CAP_CHECK_LOADED:
@@ -472,4 +473,3 @@ TPM_RESULT TPM_GetCapability(TPM_CAPABIL
@@ -480,4 +481,3 @@ TPM_RESULT TPM_GetCapability(TPM_CAPABIL
return TPM_BAD_MODE;
}
}
-
diff -uprN orig/tpm_emulator-0.2-x86_64/tpm/tpm_cmd_handler.c vtpm/tpm/tpm_cmd_handler.c
--- orig/tpm_emulator-0.2-x86_64/tpm/tpm_cmd_handler.c 2005-08-15 00:58:57.000000000 -0700
+++ vtpm/tpm/tpm_cmd_handler.c 2006-05-17 09:31:11.000000000 -0700
diff -uprN orig/tpm_emulator-0.3-x86_64/tpm/tpm_cmd_handler.c vtpm/tpm/tpm_cmd_handler.c
--- orig/tpm_emulator-0.3-x86_64/tpm/tpm_cmd_handler.c 2006-01-10 04:21:45.000000000 -0800
+++ vtpm/tpm/tpm_cmd_handler.c 2006-05-30 12:23:26.000000000 -0700
@@ -1,6 +1,7 @@
/* Software-Based Trusted Platform Module (TPM) Emulator for Linux
* Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
@@ -608,17 +634,17 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/tpm/tpm_cmd_handler.c vtpm/tpm/tpm_cmd_h
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
@@ -26,7 +27,7 @@ static void tpm_compute_in_param_digest(
@@ -73,7 +74,7 @@ void tpm_compute_in_param_digest(TPM_REQ
{
sha1_ctx_t sha1;
UINT32 offset;
UINT32 offset = tpm_get_param_offset(req->ordinal);
- UINT32 ord = cpu_to_be32(req->ordinal);
+ UINT32 ord = CPU_TO_BE32(req->ordinal);
/* skip all key-handles at the beginning */
switch (req->ordinal) {
@@ -82,8 +83,8 @@ static void tpm_compute_in_param_digest(
static void tpm_compute_out_param_digest(TPM_COMMAND_CODE ordinal, TPM_RESPONSE *rsp)
/* compute SHA1 hash */
if (offset <= req->paramSize) {
@@ -89,8 +90,8 @@ void tpm_compute_in_param_digest(TPM_REQ
void tpm_compute_out_param_digest(TPM_COMMAND_CODE ordinal, TPM_RESPONSE *rsp)
{
sha1_ctx_t sha1;
- UINT32 res = cpu_to_be32(rsp->result);
@@ -628,7 +654,7 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/tpm/tpm_cmd_handler.c vtpm/tpm/tpm_cmd_h
/* compute SHA1 hash */
sha1_init(&sha1);
@@ -3081,7 +3082,7 @@ static void tpm_setup_rsp_auth(TPM_COMMA
@@ -3123,7 +3124,7 @@ static void tpm_setup_rsp_auth(TPM_COMMA
hmac_update(&hmac, rsp->auth2->digest, sizeof(rsp->auth2->digest));
#if 0
if (tpm_get_auth(rsp->auth2->authHandle)->type == TPM_ST_OIAP) {
@@ -637,7 +663,7 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/tpm/tpm_cmd_handler.c vtpm/tpm/tpm_cmd_h
hmac_update(&hmac, (BYTE*)&handle, 4);
}
#endif
@@ -3096,7 +3097,7 @@ static void tpm_setup_rsp_auth(TPM_COMMA
@@ -3138,7 +3139,7 @@ static void tpm_setup_rsp_auth(TPM_COMMA
hmac_update(&hmac, rsp->auth1->digest, sizeof(rsp->auth1->digest));
#if 0
if (tpm_get_auth(rsp->auth1->authHandle)->type == TPM_ST_OIAP) {
@@ -646,25 +672,20 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/tpm/tpm_cmd_handler.c vtpm/tpm/tpm_cmd_h
hmac_update(&hmac, (BYTE*)&handle, 4);
}
#endif
@@ -3179,7 +3180,9 @@ extern const char *tpm_error_to_string(T
static void tpm_execute_command(TPM_REQUEST *req, TPM_RESPONSE *rsp)
@@ -3221,7 +3222,9 @@ extern const char *tpm_error_to_string(T
void tpm_execute_command(TPM_REQUEST *req, TPM_RESPONSE *rsp)
{
TPM_RESULT res;
-
+
+ req->tag = (BYTE) req->tag; // VIN HACK!!!
+ req->tag = (BYTE) req->tag; // FIXME: Why is this here
+
/* setup authorisation as well as response tag and size */
memset(rsp, 0, sizeof(*rsp));
switch (req->tag) {
@@ -3878,4 +3881,3 @@ int tpm_handle_command(const uint8_t *in
tpm_free(rsp.param);
return 0;
}
-
diff -uprN orig/tpm_emulator-0.2-x86_64/tpm/tpm_crypto.c vtpm/tpm/tpm_crypto.c
--- orig/tpm_emulator-0.2-x86_64/tpm/tpm_crypto.c 2006-05-17 09:34:13.000000000 -0700
+++ vtpm/tpm/tpm_crypto.c 2006-05-17 09:31:11.000000000 -0700
diff -uprN orig/tpm_emulator-0.3-x86_64/tpm/tpm_crypto.c vtpm/tpm/tpm_crypto.c
--- orig/tpm_emulator-0.3-x86_64/tpm/tpm_crypto.c 2006-05-30 12:28:02.000000000 -0700
+++ vtpm/tpm/tpm_crypto.c 2006-05-30 12:23:26.000000000 -0700
@@ -1,6 +1,7 @@
/* Software-Based Trusted Platform Module (TPM) Emulator for Linux
* Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
@@ -683,13 +704,170 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/tpm/tpm_crypto.c vtpm/tpm/tpm_crypto.c
if (rsa_sign(&key->key, RSA_SSA_PKCS1_SHA1,
buf, areaToSignSize + 30, *sig)) {
@@ -383,4 +384,3 @@ TPM_RESULT TPM_CertifyKey2(TPM_KEY_HANDL
}
}
return TPM_SUCCESS;
}
-
diff -uprN orig/tpm_emulator-0.2-x86_64/tpm/tpm_data.c vtpm/tpm/tpm_data.c
--- orig/tpm_emulator-0.2-x86_64/tpm/tpm_data.c 2006-05-17 09:34:13.000000000 -0700
+++ vtpm/tpm/tpm_data.c 2006-05-17 09:31:11.000000000 -0700
diff -uprN orig/tpm_emulator-0.3-x86_64/tpm/tpm_daa.c vtpm/tpm/tpm_daa.c
--- orig/tpm_emulator-0.3-x86_64/tpm/tpm_daa.c 2006-01-10 04:21:45.000000000 -0800
+++ vtpm/tpm/tpm_daa.c 2006-05-30 12:23:26.000000000 -0700
@@ -700,14 +700,14 @@ info("tested until here");
sizeof(session->DAA_tpmSpecific.DAA_rekey));
sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count,
sizeof(session->DAA_tpmSpecific.DAA_count));
- sha1_update(&sha1, "\x00", 1);
+ sha1_update(&sha1, (BYTE *) "\x00", 1);
sha1_final(&sha1, scratch);
sha1_init(&sha1);
sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_rekey,
sizeof(session->DAA_tpmSpecific.DAA_rekey));
sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count,
sizeof(session->DAA_tpmSpecific.DAA_count));
- sha1_update(&sha1, "\x01", 1);
+ sha1_update(&sha1, (BYTE *) "\x01", 1);
sha1_final(&sha1, scratch + SHA1_DIGEST_LENGTH);
mpz_init(f), mpz_init(q);
mpz_import(f, 2 * SHA1_DIGEST_LENGTH, 1, 1, 0, 0, scratch);
@@ -787,14 +787,14 @@ info("tested until here");
sizeof(session->DAA_tpmSpecific.DAA_rekey));
sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count,
sizeof(session->DAA_tpmSpecific.DAA_count));
- sha1_update(&sha1, "\x00", 1);
+ sha1_update(&sha1, (BYTE *) "\x00", 1);
sha1_final(&sha1, scratch);
sha1_init(&sha1);
sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_rekey,
sizeof(session->DAA_tpmSpecific.DAA_rekey));
sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count,
sizeof(session->DAA_tpmSpecific.DAA_count));
- sha1_update(&sha1, "\x01", 1);
+ sha1_update(&sha1, (BYTE *) "\x01", 1);
sha1_final(&sha1, scratch + SHA1_DIGEST_LENGTH);
mpz_init(f), mpz_init(q);
mpz_import(f, 2 * SHA1_DIGEST_LENGTH, 1, 1, 0, 0, scratch);
@@ -1440,14 +1440,14 @@ info("tested until here");
sizeof(session->DAA_tpmSpecific.DAA_rekey));
sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count,
sizeof(session->DAA_tpmSpecific.DAA_count));
- sha1_update(&sha1, "\x00", 1);
+ sha1_update(&sha1, (BYTE *) "\x00", 1);
sha1_final(&sha1, scratch);
sha1_init(&sha1);
sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_rekey,
sizeof(session->DAA_tpmSpecific.DAA_rekey));
sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count,
sizeof(session->DAA_tpmSpecific.DAA_count));
- sha1_update(&sha1, "\x01", 1);
+ sha1_update(&sha1, (BYTE *) "\x01", 1);
sha1_final(&sha1, scratch + SHA1_DIGEST_LENGTH);
mpz_init(f), mpz_init(q);
mpz_import(f, 2 * SHA1_DIGEST_LENGTH, 1, 1, 0, 0, scratch);
@@ -1660,14 +1660,14 @@ info("tested until here");
sizeof(session->DAA_tpmSpecific.DAA_rekey));
sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count,
sizeof(session->DAA_tpmSpecific.DAA_count));
- sha1_update(&sha1, "\x00", 1);
+ sha1_update(&sha1, (BYTE *) "\x00", 1);
sha1_final(&sha1, scratch);
sha1_init(&sha1);
sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_rekey,
sizeof(session->DAA_tpmSpecific.DAA_rekey));
sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count,
sizeof(session->DAA_tpmSpecific.DAA_count));
- sha1_update(&sha1, "\x01", 1);
+ sha1_update(&sha1, (BYTE *) "\x01", 1);
sha1_final(&sha1, scratch + SHA1_DIGEST_LENGTH);
mpz_init(f), mpz_init(q);
mpz_import(f, 2 * SHA1_DIGEST_LENGTH, 1, 1, 0, 0, scratch);
@@ -1740,14 +1740,14 @@ info("tested until here");
sizeof(session->DAA_tpmSpecific.DAA_rekey));
sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count,
sizeof(session->DAA_tpmSpecific.DAA_count));
- sha1_update(&sha1, "\x00", 1);
+ sha1_update(&sha1, (BYTE *) "\x00", 1);
sha1_final(&sha1, scratch);
sha1_init(&sha1);
sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_rekey,
sizeof(session->DAA_tpmSpecific.DAA_rekey));
sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count,
sizeof(session->DAA_tpmSpecific.DAA_count));
- sha1_update(&sha1, "\x01", 1);
+ sha1_update(&sha1, (BYTE *) "\x01", 1);
sha1_final(&sha1, scratch + SHA1_DIGEST_LENGTH);
mpz_init(f), mpz_init(q);
mpz_import(f, 2 * SHA1_DIGEST_LENGTH, 1, 1, 0, 0, scratch);
@@ -2828,14 +2828,14 @@ TPM_RESULT TPM_DAA_Sign(TPM_HANDLE handl
sizeof(session->DAA_tpmSpecific.DAA_rekey));
sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count,
sizeof(session->DAA_tpmSpecific.DAA_count));
- sha1_update(&sha1, "\x00", 1);
+ sha1_update(&sha1, (BYTE *) "\x00", 1);
sha1_final(&sha1, scratch);
sha1_init(&sha1);
sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_rekey,
sizeof(session->DAA_tpmSpecific.DAA_rekey));
sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count,
sizeof(session->DAA_tpmSpecific.DAA_count));
- sha1_update(&sha1, "\x01", 1);
+ sha1_update(&sha1, (BYTE *) "\x01", 1);
sha1_final(&sha1, scratch + SHA1_DIGEST_LENGTH);
mpz_init(f), mpz_init(q);
mpz_import(f, 2 * SHA1_DIGEST_LENGTH, 1, 1, 0, 0, scratch);
@@ -3050,7 +3050,7 @@ TPM_RESULT TPM_DAA_Sign(TPM_HANDLE handl
sha1_init(&sha1);
sha1_update(&sha1, (BYTE*) &session->DAA_session.DAA_digest,
sizeof(session->DAA_session.DAA_digest));
- sha1_update(&sha1, "\x01", 1);
+ sha1_update(&sha1, (BYTE *) "\x01", 1);
sha1_update(&sha1, inputData1, inputSize1);
sha1_final(&sha1, (BYTE*) &session->DAA_session.DAA_digest);
}
@@ -3078,7 +3078,7 @@ TPM_RESULT TPM_DAA_Sign(TPM_HANDLE handl
sha1_init(&sha1);
sha1_update(&sha1, (BYTE*) &session->DAA_session.DAA_digest,
sizeof(session->DAA_session.DAA_digest));
- sha1_update(&sha1, "\x01", 1);
+ sha1_update(&sha1, (BYTE *) "\x01", 1);
rsa_export_modulus(&aikData->key, scratch, &size);
sha1_update(&sha1, scratch, size);
sha1_final(&sha1, (BYTE*) &session->DAA_session.DAA_digest);
@@ -3134,14 +3134,14 @@ TPM_RESULT TPM_DAA_Sign(TPM_HANDLE handl
sizeof(session->DAA_tpmSpecific.DAA_rekey));
sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count,
sizeof(session->DAA_tpmSpecific.DAA_count));
- sha1_update(&sha1, "\x00", 1);
+ sha1_update(&sha1, (BYTE *) "\x00", 1);
sha1_final(&sha1, scratch);
sha1_init(&sha1);
sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_rekey,
sizeof(session->DAA_tpmSpecific.DAA_rekey));
sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count,
sizeof(session->DAA_tpmSpecific.DAA_count));
- sha1_update(&sha1, "\x01", 1);
+ sha1_update(&sha1, (BYTE *) "\x01", 1);
sha1_final(&sha1, scratch + SHA1_DIGEST_LENGTH);
mpz_init(f), mpz_init(q);
mpz_import(f, 2 * SHA1_DIGEST_LENGTH, 1, 1, 0, 0, scratch);
@@ -3213,14 +3213,14 @@ TPM_RESULT TPM_DAA_Sign(TPM_HANDLE handl
sizeof(session->DAA_tpmSpecific.DAA_rekey));
sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count,
sizeof(session->DAA_tpmSpecific.DAA_count));
- sha1_update(&sha1, "\x00", 1);
+ sha1_update(&sha1, (BYTE *) "\x00", 1);
sha1_final(&sha1, scratch);
sha1_init(&sha1);
sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_rekey,
sizeof(session->DAA_tpmSpecific.DAA_rekey));
sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count,
sizeof(session->DAA_tpmSpecific.DAA_count));
- sha1_update(&sha1, "\x01", 1);
+ sha1_update(&sha1, (BYTE *) "\x01", 1);
sha1_final(&sha1, scratch + SHA1_DIGEST_LENGTH);
mpz_init(f), mpz_init(q);
mpz_import(f, 2 * SHA1_DIGEST_LENGTH, 1, 1, 0, 0, scratch);
diff -uprN orig/tpm_emulator-0.3-x86_64/tpm/tpm_data.c vtpm/tpm/tpm_data.c
--- orig/tpm_emulator-0.3-x86_64/tpm/tpm_data.c 2006-05-30 12:28:02.000000000 -0700
+++ vtpm/tpm/tpm_data.c 2006-05-30 12:23:26.000000000 -0700
@@ -1,6 +1,7 @@
/* Software-Based Trusted Platform Module (TPM) Emulator for Linux
* Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
@@ -698,8 +876,8 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/tpm/tpm_data.c vtpm/tpm/tpm_data.c
*
* This module is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
@@ -15,9 +16,15 @@
* $Id: tpm_data.c 9 2005-04-26 18:15:31Z mast $
@@ -15,10 +16,15 @@
* $Id: tpm_data.c 36 2005-10-26 20:31:19Z hstamer $
*/
+#include <sys/types.h>
@@ -710,11 +888,12 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/tpm/tpm_data.c vtpm/tpm/tpm_data.c
#include "tpm_emulator.h"
#include "tpm_structures.h"
#include "tpm_marshalling.h"
-#include "linux_module.h"
+#include "vtpm_manager.h"
TPM_DATA tpmData;
@@ -28,6 +35,7 @@ BOOL tpm_get_physical_presence(void)
@@ -39,6 +45,7 @@ static inline void init_pcr_attr(int pcr
void tpm_init_data(void)
{
@@ -722,7 +901,7 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/tpm/tpm_data.c vtpm/tpm/tpm_data.c
/* endorsement key */
uint8_t ek_n[] = "\xa8\xdb\xa9\x42\xa8\xf3\xb8\x06\x85\x90\x76\x93\xad\xf7"
"\x74\xec\x3f\xd3\x3d\x9d\xe8\x2e\xff\x15\xed\x0e\xce\x5f\x93"
@@ -66,6 +74,8 @@ void tpm_init_data(void)
@@ -77,6 +84,8 @@ void tpm_init_data(void)
"\xd1\xc0\x8b\x5b\xa2\x2e\xa7\x15\xca\x50\x75\x10\x48\x9c\x2b"
"\x18\xb9\x67\x8f\x5d\x64\xc3\x28\x9f\x2f\x16\x2f\x08\xda\x47"
"\xec\x86\x43\x0c\x80\x99\x07\x34\x0f";
@@ -731,18 +910,7 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/tpm/tpm_data.c vtpm/tpm/tpm_data.c
int i;
/* reset all data to NULL, FALSE or 0 */
memset(&tpmData, 0, sizeof(tpmData));
@@ -85,6 +95,10 @@ 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 */
@@ -115,49 +129,235 @@ void tpm_release_data(void)
@@ -150,49 +159,235 @@ void tpm_release_data(void)
#ifdef TPM_STORE_TO_FILE
@@ -1009,7 +1177,7 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/tpm/tpm_data.c vtpm/tpm/tpm_data.c
}
#else
@@ -232,7 +432,6 @@ int tpm_restore_permanent_data(void)
@@ -267,7 +462,6 @@ int tpm_restore_permanent_data(void)
int tpm_erase_permanent_data(void)
{
@@ -1018,9 +1186,9 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/tpm/tpm_data.c vtpm/tpm/tpm_data.c
return res;
}
-
diff -uprN orig/tpm_emulator-0.2-x86_64/tpm/tpm_deprecated.c vtpm/tpm/tpm_deprecated.c
--- orig/tpm_emulator-0.2-x86_64/tpm/tpm_deprecated.c 2005-08-15 00:58:57.000000000 -0700
+++ vtpm/tpm/tpm_deprecated.c 2006-05-17 09:31:11.000000000 -0700
diff -uprN orig/tpm_emulator-0.3-x86_64/tpm/tpm_deprecated.c vtpm/tpm/tpm_deprecated.c
--- orig/tpm_emulator-0.3-x86_64/tpm/tpm_deprecated.c 2006-01-10 04:21:45.000000000 -0800
+++ vtpm/tpm/tpm_deprecated.c 2006-05-30 12:23:26.000000000 -0700
@@ -1,6 +1,7 @@
/* Software-Based Trusted Platform Module (TPM) Emulator for Linux
* Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
@@ -1047,9 +1215,9 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/tpm/tpm_deprecated.c vtpm/tpm/tpm_deprec
authContextSize, &contextBlob);
if (res != TPM_SUCCESS) return res;
len = *authContextSize;
diff -uprN orig/tpm_emulator-0.2-x86_64/tpm/tpm_emulator.h vtpm/tpm/tpm_emulator.h
--- orig/tpm_emulator-0.2-x86_64/tpm/tpm_emulator.h 2005-08-15 00:58:57.000000000 -0700
+++ vtpm/tpm/tpm_emulator.h 2006-05-17 09:31:11.000000000 -0700
diff -uprN orig/tpm_emulator-0.3-x86_64/tpm/tpm_emulator.h vtpm/tpm/tpm_emulator.h
--- orig/tpm_emulator-0.3-x86_64/tpm/tpm_emulator.h 2006-01-10 04:21:45.000000000 -0800
+++ vtpm/tpm/tpm_emulator.h 2006-05-30 12:23:26.000000000 -0700
@@ -1,5 +1,6 @@
/* Software-Based Trusted Platform Module (TPM) Emulator for Linux
* Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
@@ -1064,12 +1232,12 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/tpm/tpm_emulator.h vtpm/tpm/tpm_emulator
-#undef TPM_GENERATE_EK
+//#undef TPM_GENERATE_EK
+#define TPM_GENERATE_EK
#undef TPM_GENERATE_SEED_DAA
/**
* tpm_emulator_init - initialises and starts the TPM emulator
diff -uprN orig/tpm_emulator-0.2-x86_64/tpm/tpm_integrity.c vtpm/tpm/tpm_integrity.c
--- orig/tpm_emulator-0.2-x86_64/tpm/tpm_integrity.c 2005-08-15 00:58:57.000000000 -0700
+++ vtpm/tpm/tpm_integrity.c 2006-05-17 09:31:11.000000000 -0700
#define TPM_MANUFACTURER 0x4554485A /* 'ETHZ' */
diff -uprN orig/tpm_emulator-0.3-x86_64/tpm/tpm_integrity.c vtpm/tpm/tpm_integrity.c
--- orig/tpm_emulator-0.3-x86_64/tpm/tpm_integrity.c 2006-01-10 04:21:45.000000000 -0800
+++ vtpm/tpm/tpm_integrity.c 2006-05-30 12:23:26.000000000 -0700
@@ -1,6 +1,7 @@
/* Software-Based Trusted Platform Module (TPM) Emulator for Linux
* Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
@@ -1083,9 +1251,9 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/tpm/tpm_integrity.c vtpm/tpm/tpm_integri
return TPM_SUCCESS;
}
-
diff -uprN orig/tpm_emulator-0.2-x86_64/tpm/tpm_structures.h vtpm/tpm/tpm_structures.h
--- orig/tpm_emulator-0.2-x86_64/tpm/tpm_structures.h 2005-08-15 00:58:57.000000000 -0700
+++ vtpm/tpm/tpm_structures.h 2006-05-17 09:31:11.000000000 -0700
diff -uprN orig/tpm_emulator-0.3-x86_64/tpm/tpm_structures.h vtpm/tpm/tpm_structures.h
--- orig/tpm_emulator-0.3-x86_64/tpm/tpm_structures.h 2006-01-10 04:21:45.000000000 -0800
+++ vtpm/tpm/tpm_structures.h 2006-05-30 12:23:26.000000000 -0700
@@ -1,6 +1,7 @@
/* Software-Based Trusted Platform Module (TPM) Emulator for Linux
* Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
@@ -1103,9 +1271,9 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/tpm/tpm_structures.h vtpm/tpm/tpm_struct
#include "crypto/rsa.h"
/*
diff -uprN orig/tpm_emulator-0.2-x86_64/tpm/tpm_testing.c vtpm/tpm/tpm_testing.c
--- orig/tpm_emulator-0.2-x86_64/tpm/tpm_testing.c 2005-08-15 00:58:57.000000000 -0700
+++ vtpm/tpm/tpm_testing.c 2006-05-17 09:31:11.000000000 -0700
diff -uprN orig/tpm_emulator-0.3-x86_64/tpm/tpm_testing.c vtpm/tpm/tpm_testing.c
--- orig/tpm_emulator-0.3-x86_64/tpm/tpm_testing.c 2006-01-10 04:21:45.000000000 -0800
+++ vtpm/tpm/tpm_testing.c 2006-05-30 12:23:26.000000000 -0700
@@ -1,6 +1,7 @@
/* Software-Based Trusted Platform Module (TPM) Emulator for Linux
* Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
@@ -1221,9 +1389,9 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/tpm/tpm_testing.c vtpm/tpm/tpm_testing.c
rsa_private_key_t priv_key;
rsa_public_key_t pub_key;
diff -uprN orig/tpm_emulator-0.2-x86_64/tpm/tpm_ticks.c vtpm/tpm/tpm_ticks.c
--- orig/tpm_emulator-0.2-x86_64/tpm/tpm_ticks.c 2005-08-15 00:58:57.000000000 -0700
+++ vtpm/tpm/tpm_ticks.c 2006-05-17 09:31:11.000000000 -0700
diff -uprN orig/tpm_emulator-0.3-x86_64/tpm/tpm_ticks.c vtpm/tpm/tpm_ticks.c
--- orig/tpm_emulator-0.3-x86_64/tpm/tpm_ticks.c 2006-01-10 04:21:45.000000000 -0800
+++ vtpm/tpm/tpm_ticks.c 2006-05-30 12:23:26.000000000 -0700
@@ -1,6 +1,7 @@
/* Software-Based Trusted Platform Module (TPM) Emulator for Linux
* Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
@@ -1306,9 +1474,69 @@ diff -uprN orig/tpm_emulator-0.2-x86_64/tpm/tpm_ticks.c vtpm/tpm/tpm_ticks.c
}
diff -uprN orig/tpm_emulator-0.2-x86_64/tpmd.c vtpm/tpmd.c
--- orig/tpm_emulator-0.2-x86_64/tpmd.c 1969-12-31 16:00:00.000000000 -0800
+++ vtpm/tpmd.c 2006-05-17 09:31:11.000000000 -0700
diff -uprN orig/tpm_emulator-0.3-x86_64/tpm/tpm_transport.c vtpm/tpm/tpm_transport.c
--- orig/tpm_emulator-0.3-x86_64/tpm/tpm_transport.c 2006-01-10 04:21:45.000000000 -0800
+++ vtpm/tpm/tpm_transport.c 2006-05-30 12:23:26.000000000 -0700
@@ -59,7 +59,7 @@ static int decrypt_transport_auth(TPM_KE
static void transport_log_in(TPM_COMMAND_CODE ordinal, BYTE parameters[20],
BYTE pubKeyHash[20], TPM_DIGEST *transDigest)
{
- UINT32 tag = cpu_to_be32(TPM_TAG_TRANSPORT_LOG_IN);
+ UINT32 tag = CPU_TO_BE32(TPM_TAG_TRANSPORT_LOG_IN);
BYTE *ptr, buf[sizeof_TPM_TRANSPORT_LOG_IN(x)];
UINT32 len = sizeof(buf);
sha1_ctx_t sha1;
@@ -76,7 +76,7 @@ static void transport_log_in(TPM_COMMAND
static void transport_log_out(TPM_CURRENT_TICKS *currentTicks, BYTE parameters[20],
TPM_MODIFIER_INDICATOR locality, TPM_DIGEST *transDigest)
{
- UINT32 tag = cpu_to_be32(TPM_TAG_TRANSPORT_LOG_OUT);
+ UINT32 tag = CPU_TO_BE32(TPM_TAG_TRANSPORT_LOG_OUT);
BYTE *ptr, buf[sizeof_TPM_TRANSPORT_LOG_OUT(x)];
UINT32 len = sizeof(buf);
sha1_ctx_t sha1;
@@ -191,7 +191,7 @@ static void decrypt_wrapped_command(BYTE
sha1_update(&sha1, auth->nonceOdd.nonce, sizeof(auth->nonceOdd.nonce));
sha1_update(&sha1, "in", 2);
sha1_update(&sha1, secret, sizeof(TPM_SECRET));
- j = cpu_to_be32(i);
+ j = CPU_TO_BE32(i);
sha1_update(&sha1, (BYTE*)&j, 4);
sha1_final(&sha1, mask);
for (j = 0; j < sizeof(mask) && buf_len > 0; j++) {
@@ -213,7 +213,7 @@ static void encrypt_wrapped_command(BYTE
sha1_update(&sha1, auth->nonceOdd.nonce, sizeof(auth->nonceOdd.nonce));
sha1_update(&sha1, "out", 3);
sha1_update(&sha1, secret, sizeof(TPM_SECRET));
- j = cpu_to_be32(i);
+ j = CPU_TO_BE32(i);
sha1_update(&sha1, (BYTE*)&j, 4);
sha1_final(&sha1, mask);
for (j = 0; j < sizeof(mask) && buf_len > 0; j++) {
@@ -253,9 +253,9 @@ TPM_RESULT TPM_ExecuteTransport(UINT32 i
/* verify authorization */
tpm_compute_in_param_digest(&req);
sha1_init(&sha1);
- res = cpu_to_be32(TPM_ORD_ExecuteTransport);
+ res = CPU_TO_BE32(TPM_ORD_ExecuteTransport);
sha1_update(&sha1, (BYTE*)&res, 4);
- res = cpu_to_be32(inWrappedCmdSize);
+ res = CPU_TO_BE32(inWrappedCmdSize);
sha1_update(&sha1, (BYTE*)&res, 4);
sha1_update(&sha1, req.auth1.digest, sizeof(req.auth1.digest));
sha1_final(&sha1, auth1->digest);
@@ -357,7 +357,7 @@ TPM_RESULT TPM_ReleaseTransportSigned(TP
/* setup a TPM_SIGN_INFO structure */
memcpy(&buf[0], "\x05\x00TRAN", 6);
memcpy(&buf[6], antiReplay->nonce, 20);
- *(UINT32*)&buf[26] = cpu_to_be32(20);
+ *(UINT32*)&buf[26] = CPU_TO_BE32(20);
memcpy(&buf[30], session->transInternal.transDigest.digest, 20);
/* sign info structure */
res = tpm_sign(key, auth1, TRUE, buf, sizeof(buf), signature, signSize);
diff -uprN orig/tpm_emulator-0.3-x86_64/tpmd.c vtpm/tpmd.c
--- orig/tpm_emulator-0.3-x86_64/tpmd.c 1969-12-31 16:00:00.000000000 -0800
+++ vtpm/tpmd.c 2006-05-30 12:23:26.000000000 -0700
@@ -0,0 +1,207 @@
+/* Software-Based Trusted Platform Module (TPM) Emulator for Linux
+ * Copyright (C) 2005 INTEL Corp
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.