1 | /********************************************************************************/
|
---|
2 | /* */
|
---|
3 | /* Storage Functions */
|
---|
4 | /* Written by Ken Goldman */
|
---|
5 | /* IBM Thomas J. Watson Research Center */
|
---|
6 | /* $Id: tpm_storage.h 4071 2010-04-29 19:26:45Z kgoldman $ */
|
---|
7 | /* */
|
---|
8 | /* (c) Copyright IBM Corporation 2006, 2010. */
|
---|
9 | /* */
|
---|
10 | /* All rights reserved. */
|
---|
11 | /* */
|
---|
12 | /* Redistribution and use in source and binary forms, with or without */
|
---|
13 | /* modification, are permitted provided that the following conditions are */
|
---|
14 | /* met: */
|
---|
15 | /* */
|
---|
16 | /* Redistributions of source code must retain the above copyright notice, */
|
---|
17 | /* this list of conditions and the following disclaimer. */
|
---|
18 | /* */
|
---|
19 | /* Redistributions in binary form must reproduce the above copyright */
|
---|
20 | /* notice, this list of conditions and the following disclaimer in the */
|
---|
21 | /* documentation and/or other materials provided with the distribution. */
|
---|
22 | /* */
|
---|
23 | /* Neither the names of the IBM Corporation nor the names of its */
|
---|
24 | /* contributors may be used to endorse or promote products derived from */
|
---|
25 | /* this software without specific prior written permission. */
|
---|
26 | /* */
|
---|
27 | /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
|
---|
28 | /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
|
---|
29 | /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
|
---|
30 | /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
|
---|
31 | /* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
|
---|
32 | /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
|
---|
33 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
|
---|
34 | /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
|
---|
35 | /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
|
---|
36 | /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
|
---|
37 | /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
|
---|
38 | /********************************************************************************/
|
---|
39 |
|
---|
40 | #ifndef TPM_STORAGE_H
|
---|
41 | #define TPM_STORAGE_H
|
---|
42 |
|
---|
43 | #include "tpm_global.h"
|
---|
44 | #include "tpm_store.h"
|
---|
45 | #include "tpm_types.h"
|
---|
46 |
|
---|
47 | /*
|
---|
48 | TPM_BOUND_DATA
|
---|
49 | */
|
---|
50 |
|
---|
51 | void TPM_BoundData_Init(TPM_BOUND_DATA *tpm_bound_data);
|
---|
52 | TPM_RESULT TPM_BoundData_Load(TPM_BOUND_DATA *tpm_bound_data,
|
---|
53 | unsigned char **stream,
|
---|
54 | uint32_t *stream_size);
|
---|
55 | #if 0
|
---|
56 | TPM_RESULT TPM_BoundData_Store(TPM_STORE_BUFFER *sbuffer,
|
---|
57 | const TPM_BOUND_DATA *tpm_bound_data);
|
---|
58 | #endif
|
---|
59 | void TPM_BoundData_Delete(TPM_BOUND_DATA *tpm_bound_data);
|
---|
60 |
|
---|
61 | /*
|
---|
62 | TPM_SEALED_DATA
|
---|
63 | */
|
---|
64 |
|
---|
65 | void TPM_SealedData_Init(TPM_SEALED_DATA *tpm_sealed_data);
|
---|
66 | TPM_RESULT TPM_SealedData_Load(TPM_SEALED_DATA *tpm_sealed_data,
|
---|
67 | unsigned char **stream,
|
---|
68 | uint32_t *stream_size);
|
---|
69 | TPM_RESULT TPM_SealedData_Store(TPM_STORE_BUFFER *sbuffer,
|
---|
70 | const TPM_SEALED_DATA *tpm_sealed_data);
|
---|
71 | void TPM_SealedData_Delete(TPM_SEALED_DATA *tpm_sealed_data);
|
---|
72 |
|
---|
73 | TPM_RESULT TPM_SealedData_DecryptEncData(TPM_SEALED_DATA *tpm_sealed_data,
|
---|
74 | TPM_SIZED_BUFFER *enc_data,
|
---|
75 | TPM_KEY *tpm_key);
|
---|
76 | TPM_RESULT TPM_SealedData_GenerateEncData(TPM_SIZED_BUFFER *enc_data,
|
---|
77 | const TPM_SEALED_DATA *tpm_sealed_data,
|
---|
78 | TPM_KEY *tpm_key);
|
---|
79 |
|
---|
80 | /*
|
---|
81 | TPM_STORED_DATA
|
---|
82 | */
|
---|
83 |
|
---|
84 | void TPM_StoredData_Init(TPM_STORED_DATA *tpm_stored_data,
|
---|
85 | unsigned int version);
|
---|
86 | TPM_RESULT TPM_StoredData_Load(TPM_STORED_DATA *tpm_stored_data,
|
---|
87 | unsigned int *version,
|
---|
88 | unsigned char **stream,
|
---|
89 | uint32_t *stream_size);
|
---|
90 | TPM_RESULT TPM_StoredData_Store(TPM_STORE_BUFFER *sbuffer,
|
---|
91 | TPM_STORED_DATA *tpm_stored_data,
|
---|
92 | unsigned int version);
|
---|
93 | void TPM_StoredData_Delete(TPM_STORED_DATA *tpm_stored_data,
|
---|
94 | unsigned int version);
|
---|
95 |
|
---|
96 | TPM_RESULT TPM_StoredData_CheckTag(TPM_STORED_DATA12 *tpm_stored_data12);
|
---|
97 | TPM_RESULT TPM_StoredData_StoreClearData(TPM_STORE_BUFFER *sbuffer,
|
---|
98 | TPM_STORED_DATA *tpm_stored_data,
|
---|
99 | unsigned int version);
|
---|
100 | TPM_RESULT TPM_StoredData_GenerateDigest(TPM_DIGEST tpm_digest,
|
---|
101 | TPM_STORED_DATA *tpm_stored_data,
|
---|
102 | unsigned int version);
|
---|
103 |
|
---|
104 | /*
|
---|
105 | Processing functions
|
---|
106 | */
|
---|
107 |
|
---|
108 | TPM_RESULT TPM_Process_Seal(tpm_state_t *tpm_state,
|
---|
109 | TPM_STORE_BUFFER *response,
|
---|
110 | TPM_TAG tag,
|
---|
111 | uint32_t paramSize,
|
---|
112 | TPM_COMMAND_CODE ordinal,
|
---|
113 | unsigned char *command,
|
---|
114 | TPM_TRANSPORT_INTERNAL *transportInternal);
|
---|
115 | TPM_RESULT TPM_Process_Sealx(tpm_state_t *tpm_state,
|
---|
116 | TPM_STORE_BUFFER *response,
|
---|
117 | TPM_TAG tag,
|
---|
118 | uint32_t paramSize,
|
---|
119 | TPM_COMMAND_CODE ordinal,
|
---|
120 | unsigned char *command,
|
---|
121 | TPM_TRANSPORT_INTERNAL *transportInternal);
|
---|
122 | TPM_RESULT TPM_Process_Unseal(tpm_state_t *tpm_state,
|
---|
123 | TPM_STORE_BUFFER *response,
|
---|
124 | TPM_TAG tag,
|
---|
125 | uint32_t paramSize,
|
---|
126 | TPM_COMMAND_CODE ordinal,
|
---|
127 | unsigned char *command,
|
---|
128 | TPM_TRANSPORT_INTERNAL *transportInternal);
|
---|
129 | TPM_RESULT TPM_Process_UnBind(tpm_state_t *tpm_state,
|
---|
130 | TPM_STORE_BUFFER *response,
|
---|
131 | TPM_TAG tag,
|
---|
132 | uint32_t paramSize,
|
---|
133 | TPM_COMMAND_CODE ordinal,
|
---|
134 | unsigned char *command,
|
---|
135 | TPM_TRANSPORT_INTERNAL *transportInternal);
|
---|
136 | TPM_RESULT TPM_Process_CreateWrapKey(tpm_state_t *tpm_state,
|
---|
137 | TPM_STORE_BUFFER *response,
|
---|
138 | TPM_TAG tag,
|
---|
139 | uint32_t paramSize,
|
---|
140 | TPM_COMMAND_CODE ordinal,
|
---|
141 | unsigned char *command,
|
---|
142 | TPM_TRANSPORT_INTERNAL *transportInternal);
|
---|
143 | TPM_RESULT TPM_Process_LoadKey(tpm_state_t *tpm_state,
|
---|
144 | TPM_STORE_BUFFER *response,
|
---|
145 | TPM_TAG tag,
|
---|
146 | uint32_t paramSize,
|
---|
147 | TPM_COMMAND_CODE ordinal,
|
---|
148 | unsigned char *command,
|
---|
149 | TPM_TRANSPORT_INTERNAL *transportInternal);
|
---|
150 | TPM_RESULT TPM_Process_LoadKey2(tpm_state_t *tpm_state,
|
---|
151 | TPM_STORE_BUFFER *response,
|
---|
152 | TPM_TAG tag,
|
---|
153 | uint32_t paramSize,
|
---|
154 | TPM_COMMAND_CODE ordinal,
|
---|
155 | unsigned char *command,
|
---|
156 | TPM_TRANSPORT_INTERNAL *transportInternal);
|
---|
157 | TPM_RESULT TPM_Process_GetPubKey(tpm_state_t *tpm_state,
|
---|
158 | TPM_STORE_BUFFER *response,
|
---|
159 | TPM_TAG tag,
|
---|
160 | uint32_t paramSize,
|
---|
161 | TPM_COMMAND_CODE ordinal,
|
---|
162 | unsigned char *command,
|
---|
163 | TPM_TRANSPORT_INTERNAL *transportInternal);
|
---|
164 |
|
---|
165 |
|
---|
166 |
|
---|
167 | #endif
|
---|