1 | // =================================================================== |
---|
2 | // |
---|
3 | // Copyright (c) 2005, Intel Corp. |
---|
4 | // All rights reserved. |
---|
5 | // |
---|
6 | // Redistribution and use in source and binary forms, with or without |
---|
7 | // modification, are permitted provided that the following conditions |
---|
8 | // are met: |
---|
9 | // |
---|
10 | // * Redistributions of source code must retain the above copyright |
---|
11 | // notice, this list of conditions and the following disclaimer. |
---|
12 | // * Redistributions in binary form must reproduce the above |
---|
13 | // copyright notice, this list of conditions and the following |
---|
14 | // disclaimer in the documentation and/or other materials provided |
---|
15 | // with the distribution. |
---|
16 | // * Neither the name of Intel Corporation nor the names of its |
---|
17 | // contributors may be used to endorse or promote products derived |
---|
18 | // from this software without specific prior written permission. |
---|
19 | // |
---|
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
---|
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
---|
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
---|
23 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
---|
24 | // COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
---|
25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
---|
26 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
---|
27 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
---|
28 | // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
---|
29 | // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
---|
31 | // OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
32 | // =================================================================== |
---|
33 | // |
---|
34 | // contextmgr.c |
---|
35 | // |
---|
36 | // This file contains the context management functions for TCS. |
---|
37 | // |
---|
38 | // ================================================================== |
---|
39 | |
---|
40 | #ifndef __CONTEXTMGR_H__ |
---|
41 | #define __CONTEXTMGR_H__ |
---|
42 | |
---|
43 | #include "tcg.h" |
---|
44 | |
---|
45 | #define BLOCK_SIZE 300 |
---|
46 | |
---|
47 | typedef struct block { |
---|
48 | int nBlockSize; |
---|
49 | BYTE* aMemory; |
---|
50 | struct block* pNextBlock; |
---|
51 | } BLOCK; |
---|
52 | |
---|
53 | typedef struct handle_List { |
---|
54 | TPM_HANDLE handle; |
---|
55 | TPM_RESOURCE_TYPE type; |
---|
56 | struct handle_List* pNextHandle; |
---|
57 | } HANDLE_LIST; |
---|
58 | |
---|
59 | typedef struct context_handle { |
---|
60 | TCS_CONTEXT_HANDLE handle; |
---|
61 | int nBlockCount; |
---|
62 | BLOCK* pTopBlock; |
---|
63 | HANDLE_LIST* pHandleList; |
---|
64 | } CONTEXT_HANDLE; |
---|
65 | |
---|
66 | BYTE* AddMemBlock( CONTEXT_HANDLE* pContextHandle, // in |
---|
67 | int BlockSize); // in |
---|
68 | |
---|
69 | BOOL DeleteMemBlock(CONTEXT_HANDLE* pContextHandle, // in |
---|
70 | BYTE* pTCPA_BYTEs); // in |
---|
71 | |
---|
72 | |
---|
73 | BOOL AddHandleToList( TCS_CONTEXT_HANDLE hContext, // in |
---|
74 | TPM_RESOURCE_TYPE type, // in |
---|
75 | TPM_HANDLE handle); // in |
---|
76 | |
---|
77 | BOOL DeleteHandleFromList( TCS_CONTEXT_HANDLE hContext, // in |
---|
78 | TPM_HANDLE handle); // in |
---|
79 | |
---|
80 | BOOL FreeHandleList( CONTEXT_HANDLE* pContextHandle); // in |
---|
81 | |
---|
82 | #endif //_CONTEXTMGR_H_ |
---|