Line | Count | Source (jump to first uncovered line) |
1 | | // This file was extracted from the TCG Published |
2 | | // Trusted Platform Module Library |
3 | | // Part 3: Commands |
4 | | // Family "2.0" |
5 | | // Level 00 Revision 01.16 |
6 | | // October 30, 2014 |
7 | | |
8 | | #include "InternalRoutines.h" |
9 | | #include "FlushContext_fp.h" |
10 | | // |
11 | | // |
12 | | // Error Returns Meaning |
13 | | // |
14 | | // TPM_RC_HANDLE flushHandle does not reference a loaded object or session |
15 | | // |
16 | | TPM_RC |
17 | | TPM2_FlushContext( |
18 | | FlushContext_In *in // IN: input parameter list |
19 | | ) |
20 | 0 | { |
21 | | // Internal Data Update |
22 | | |
23 | | // Call object or session specific routine to flush |
24 | 0 | switch(HandleGetType(in->flushHandle)) |
25 | 0 | { |
26 | 0 | case TPM_HT_TRANSIENT: |
27 | 0 | if(!ObjectIsPresent(in->flushHandle)) |
28 | 0 | return TPM_RC_HANDLE; |
29 | | // Flush object |
30 | 0 | ObjectFlush(in->flushHandle); |
31 | 0 | break; |
32 | 0 | case TPM_HT_HMAC_SESSION: |
33 | 0 | case TPM_HT_POLICY_SESSION: |
34 | 0 | if( !SessionIsLoaded(in->flushHandle) |
35 | 0 | && !SessionIsSaved(in->flushHandle) |
36 | 0 | ) |
37 | 0 | return TPM_RC_HANDLE; |
38 | | |
39 | | // If the session to be flushed is the exclusive audit session, then |
40 | | // indicate that there is no exclusive audit session any longer. |
41 | 0 | if(in->flushHandle == g_exclusiveAuditSession) |
42 | 0 | g_exclusiveAuditSession = TPM_RH_UNASSIGNED; |
43 | | |
44 | | // Flush session |
45 | 0 | SessionFlush(in->flushHandle); |
46 | 0 | break; |
47 | 0 | default: |
48 | | // This command only take object or session handle. Other handles |
49 | | // should be filtered out at handle unmarshal |
50 | 0 | pAssert(FALSE); |
51 | 0 | break; |
52 | 0 | } |
53 | | |
54 | 0 | return TPM_RC_SUCCESS; |
55 | 0 | } |