Initial commit to seed TPM2.0 source code directory
LICENSE file text copied from TCG library specification. README
describes the procedure used to extract source code from parts 3 and 4
of the specification.
The python scripts and part{34}.txt files will be removed in the
following commits.
Change-Id: Ie281e6e988481831f33483053455e8aff8f3f75f
Signed-off-by: Vadim Bendebury <[email protected]>
diff --git a/FlushContext.c b/FlushContext.c
new file mode 100644
index 0000000..2d1f09b
--- /dev/null
+++ b/FlushContext.c
@@ -0,0 +1,55 @@
+// This file was extracted from the TCG Published
+// Trusted Platform Module Library
+// Part 3: Commands
+// Family "2.0"
+// Level 00 Revision 01.16
+// October 30, 2014
+
+#include "InternalRoutines.h"
+#include "FlushContext_fp.h"
+//
+//
+// Error Returns Meaning
+//
+// TPM_RC_HANDLE flushHandle does not reference a loaded object or session
+//
+TPM_RC
+TPM2_FlushContext(
+ FlushContext_In *in // IN: input parameter list
+ )
+{
+// Internal Data Update
+
+ // Call object or session specific routine to flush
+ switch(HandleGetType(in->flushHandle))
+ {
+ case TPM_HT_TRANSIENT:
+ if(!ObjectIsPresent(in->flushHandle))
+ return TPM_RC_HANDLE;
+ // Flush object
+ ObjectFlush(in->flushHandle);
+ break;
+ case TPM_HT_HMAC_SESSION:
+ case TPM_HT_POLICY_SESSION:
+ if( !SessionIsLoaded(in->flushHandle)
+ && !SessionIsSaved(in->flushHandle)
+ )
+ return TPM_RC_HANDLE;
+
+ // If the session to be flushed is the exclusive audit session, then
+ // indicate that there is no exclusive audit session any longer.
+ if(in->flushHandle == g_exclusiveAuditSession)
+ g_exclusiveAuditSession = TPM_RH_UNASSIGNED;
+
+ // Flush session
+ SessionFlush(in->flushHandle);
+ break;
+ default:
+ // This command only take object or session handle. Other handles
+ // should be filtered out at handle unmarshal
+ pAssert(FALSE);
+ break;
+ }
+
+ return TPM_RC_SUCCESS;
+}