Index: tpm/tpm_structures.h |
diff --git a/tpm/tpm_structures.h b/tpm/tpm_structures.h |
index 82c184911ffe269f42da4d977287fe21deb67e42..91a76cecc5fc3e7c041f074ab5b9fec67714c01e 100644 |
--- a/tpm/tpm_structures.h |
+++ b/tpm/tpm_structures.h |
@@ -1,7 +1,6 @@ |
-/* Software-Based Trusted Platform Module (TPM) Emulator for Linux |
- * Copyright (C) 2004 Mario Strasser <mast@gmx.net>, |
- * Swiss Federal Institute of Technology (ETH) Zurich |
- * 2006, 2007 Heiko Stamer <stamer@gaos.org> |
+/* Software-based Trusted Platform Module (TPM) Emulator |
+ * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net> |
+ * 2005-2008 Heiko Stamer <stamer@gaos.org> |
* |
* This module is free software; you can redistribute it and/or modify |
* it under the terms of the GNU General Public License as published |
@@ -13,7 +12,7 @@ |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* GNU General Public License for more details. |
* |
- * $Id$ |
+ * $Id: tpm_structures.h 367 2010-02-13 15:52:18Z mast $ |
*/ |
#ifndef _TPM_STRUCTURES_H_ |
@@ -150,6 +149,7 @@ typedef UINT32 TPM_FAMILY_OPERATION; |
#define TPM_ET_COUNTER 0x0A |
#define TPM_ET_NV 0x0B |
#define TPM_ET_OPERATOR 0x0C |
+#define TPM_ET_VERIFICATION_AUTH 0x0D |
#define TPM_ET_RESERVED_HANDLE 0x40 |
/* MSB Values */ |
#define TPM_ET_XOR 0x00 |
@@ -2236,6 +2236,17 @@ static inline int sizeof_TPM_PERMANENT_DATA(TPM_PERMANENT_DATA *s) { |
return size; |
} |
+static inline void free_TPM_PERMANENT_DATA(TPM_PERMANENT_DATA *s) |
+{ |
+ int i; |
+ /* release the EK, SRK as well as all other rsa keys */ |
+ if (s->endorsementKey.size > 0) tpm_rsa_release_private_key(&s->endorsementKey); |
+ if (s->srk.payload) free_TPM_KEY_DATA(s->srk); |
+ if (s->manuMaintPub.valid) free_TPM_PUBKEY_DATA(s->manuMaintPub); |
+ for (i = 0; i < TPM_MAX_KEYS; i++) |
+ if (s->keys[i].payload) free_TPM_KEY_DATA(s->keys[i]); |
+} |
+ |
/* |
* TPM_STCLEAR_DATA ([TPM_Part2], Section 7.5) |
* Most of the data in this structure resets on TPM_Startup(ST_Clear). |
@@ -2347,6 +2358,13 @@ typedef struct tdTPM_DATA { |
TPM_STANY_DATA data; |
} stany; |
} TPM_DATA; |
+#define sizeof_TPM_DATA(s) ( \ |
+ sizeof_TPM_PERMANENT_FLAGS(s.permanent.flags) + 2 \ |
+ + sizeof_TPM_PERMANENT_DATA(&s.permanent.data) \ |
+ + sizeof_TPM_STCLEAR_FLAGS(s.stclear.flags) \ |
+ + sizeof_TPM_STCLEAR_DATA(s.stclear.data) \ |
+ + sizeof_TPM_STANY_DATA(s.stany.data)) |
+#define free_TPM_DATA(s) { free_TPM_PERMANENT_DATA(&s.permanent.data); } |
/* |
* Context Structures |