OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Licensed Materials - Property of IBM | 3 * Licensed Materials - Property of IBM |
4 * | 4 * |
5 * trousers - An open source TCG Software Stack | 5 * trousers - An open source TCG Software Stack |
6 * | 6 * |
7 * (C) Copyright International Business Machines Corp. 2004-2006 | 7 * (C) Copyright International Business Machines Corp. 2004-2006 |
8 * | 8 * |
9 */ | 9 */ |
10 | 10 |
(...skipping 24 matching lines...) Expand all Loading... |
35 TSS_UUID KeyUUID; | 35 TSS_UUID KeyUUID; |
36 UINT32 cKeySize; | 36 UINT32 cKeySize; |
37 BYTE *rgbKey; | 37 BYTE *rgbKey; |
38 UINT32 cVendorData; | 38 UINT32 cVendorData; |
39 BYTE *gbVendorData; | 39 BYTE *gbVendorData; |
40 TSS_RESULT result; | 40 TSS_RESULT result; |
41 | 41 |
42 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) | 42 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) |
43 return TCSERR(TSS_E_INTERNAL_ERROR); | 43 return TCSERR(TSS_E_INTERNAL_ERROR); |
44 | 44 |
45 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); | 45 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext); |
46 | 46 |
47 if (getData(TCSD_PACKET_TYPE_UUID, 1, &WrappingKeyUUID, 0, &data->comm)) | 47 if (getData(TCSD_PACKET_TYPE_UUID, 1, &WrappingKeyUUID, 0, &data->comm)) |
48 return TCSERR(TSS_E_INTERNAL_ERROR); | 48 return TCSERR(TSS_E_INTERNAL_ERROR); |
49 if (getData(TCSD_PACKET_TYPE_UUID, 2, &KeyUUID, 0, &data->comm)) | 49 if (getData(TCSD_PACKET_TYPE_UUID, 2, &KeyUUID, 0, &data->comm)) |
50 return TCSERR(TSS_E_INTERNAL_ERROR); | 50 return TCSERR(TSS_E_INTERNAL_ERROR); |
51 if (getData(TCSD_PACKET_TYPE_UINT32, 3, &cKeySize, 0, &data->comm)) | 51 if (getData(TCSD_PACKET_TYPE_UINT32, 3, &cKeySize, 0, &data->comm)) |
52 return TCSERR(TSS_E_INTERNAL_ERROR); | 52 return TCSERR(TSS_E_INTERNAL_ERROR); |
53 | 53 |
54 rgbKey = calloc(1, cKeySize); | 54 rgbKey = calloc(1, cKeySize); |
55 if (rgbKey == NULL) { | 55 if (rgbKey == NULL) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 TSS_RESULT | 96 TSS_RESULT |
97 tcs_wrap_UnregisterKey(struct tcsd_thread_data *data) | 97 tcs_wrap_UnregisterKey(struct tcsd_thread_data *data) |
98 { | 98 { |
99 TCS_CONTEXT_HANDLE hContext; | 99 TCS_CONTEXT_HANDLE hContext; |
100 TSS_UUID uuid; | 100 TSS_UUID uuid; |
101 TSS_RESULT result; | 101 TSS_RESULT result; |
102 | 102 |
103 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) | 103 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) |
104 return TCSERR(TSS_E_INTERNAL_ERROR); | 104 return TCSERR(TSS_E_INTERNAL_ERROR); |
105 | 105 |
106 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); | 106 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext); |
107 | 107 |
108 if (getData(TCSD_PACKET_TYPE_UUID, 1, &uuid, 0, &data->comm)) | 108 if (getData(TCSD_PACKET_TYPE_UUID, 1, &uuid, 0, &data->comm)) |
109 return TCSERR(TSS_E_INTERNAL_ERROR); | 109 return TCSERR(TSS_E_INTERNAL_ERROR); |
110 | 110 |
111 result = TCS_UnregisterKey_Internal(hContext, uuid); | 111 result = TCS_UnregisterKey_Internal(hContext, uuid); |
112 | 112 |
113 initData(&data->comm, 0); | 113 initData(&data->comm, 0); |
114 data->comm.hdr.u.result = result; | 114 data->comm.hdr.u.result = result; |
115 | 115 |
116 return TSS_SUCCESS; | 116 return TSS_SUCCESS; |
117 } | 117 } |
118 | 118 |
119 TSS_RESULT | 119 TSS_RESULT |
120 tcs_wrap_GetRegisteredKeyBlob(struct tcsd_thread_data *data) | 120 tcs_wrap_GetRegisteredKeyBlob(struct tcsd_thread_data *data) |
121 { | 121 { |
122 TCS_CONTEXT_HANDLE hContext; | 122 TCS_CONTEXT_HANDLE hContext; |
123 TSS_UUID uuid; | 123 TSS_UUID uuid; |
124 UINT32 pcKeySize; | 124 UINT32 pcKeySize; |
125 BYTE *prgbKey; | 125 BYTE *prgbKey; |
126 TSS_RESULT result; | 126 TSS_RESULT result; |
127 | 127 |
128 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) | 128 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) |
129 return TCSERR(TSS_E_INTERNAL_ERROR); | 129 return TCSERR(TSS_E_INTERNAL_ERROR); |
130 | 130 |
131 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); | 131 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext); |
132 | 132 |
133 if (getData(TCSD_PACKET_TYPE_UUID, 1, &uuid, 0, &data->comm)) | 133 if (getData(TCSD_PACKET_TYPE_UUID, 1, &uuid, 0, &data->comm)) |
134 return TCSERR(TSS_E_INTERNAL_ERROR); | 134 return TCSERR(TSS_E_INTERNAL_ERROR); |
135 | 135 |
136 result = TCS_GetRegisteredKeyBlob_Internal(hContext, &uuid, &pcKeySize, | 136 result = TCS_GetRegisteredKeyBlob_Internal(hContext, &uuid, &pcKeySize, |
137 &prgbKey); | 137 &prgbKey); |
138 | 138 |
139 if (result == TSS_SUCCESS) { | 139 if (result == TSS_SUCCESS) { |
140 initData(&data->comm, 2); | 140 initData(&data->comm, 2); |
141 if (setData(TCSD_PACKET_TYPE_UINT32, 0, &pcKeySize, 0, &data->co
mm)) { | 141 if (setData(TCSD_PACKET_TYPE_UINT32, 0, &pcKeySize, 0, &data->co
mm)) { |
(...skipping 17 matching lines...) Expand all Loading... |
159 { | 159 { |
160 TCS_CONTEXT_HANDLE hContext; | 160 TCS_CONTEXT_HANDLE hContext; |
161 TSS_UUID uuid; | 161 TSS_UUID uuid; |
162 TCS_LOADKEY_INFO info, *pInfo; | 162 TCS_LOADKEY_INFO info, *pInfo; |
163 TCS_KEY_HANDLE phKeyTCSI; | 163 TCS_KEY_HANDLE phKeyTCSI; |
164 TSS_RESULT result; | 164 TSS_RESULT result; |
165 | 165 |
166 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) | 166 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) |
167 return TCSERR(TSS_E_INTERNAL_ERROR); | 167 return TCSERR(TSS_E_INTERNAL_ERROR); |
168 | 168 |
169 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); | 169 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext); |
170 | 170 |
171 if (getData(TCSD_PACKET_TYPE_UUID, 1, &uuid, 0, &data->comm)) | 171 if (getData(TCSD_PACKET_TYPE_UUID, 1, &uuid, 0, &data->comm)) |
172 return TCSERR(TSS_E_INTERNAL_ERROR); | 172 return TCSERR(TSS_E_INTERNAL_ERROR); |
173 | 173 |
174 result = getData(TCSD_PACKET_TYPE_LOADKEY_INFO, 2, &info, 0, &data->comm
); | 174 result = getData(TCSD_PACKET_TYPE_LOADKEY_INFO, 2, &info, 0, &data->comm
); |
175 if (result == TSS_TCP_RPC_BAD_PACKET_TYPE) | 175 if (result == TSS_TCP_RPC_BAD_PACKET_TYPE) |
176 pInfo = NULL; | 176 pInfo = NULL; |
177 else if (result) | 177 else if (result) |
178 return result; | 178 return result; |
179 else | 179 else |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 TSS_UUID uuid, *pUuid; | 212 TSS_UUID uuid, *pUuid; |
213 UINT32 cKeyHierarchySize; | 213 UINT32 cKeyHierarchySize; |
214 TSS_KM_KEYINFO *pKeyHierarchy; | 214 TSS_KM_KEYINFO *pKeyHierarchy; |
215 unsigned int i, j; | 215 unsigned int i, j; |
216 TSS_RESULT result; | 216 TSS_RESULT result; |
217 | 217 |
218 /* Receive */ | 218 /* Receive */ |
219 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) | 219 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) |
220 return TCSERR(TSS_E_INTERNAL_ERROR); | 220 return TCSERR(TSS_E_INTERNAL_ERROR); |
221 | 221 |
222 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); | 222 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext); |
223 | 223 |
224 result = getData(TCSD_PACKET_TYPE_UUID , 1, &uuid, 0, &data->comm); | 224 result = getData(TCSD_PACKET_TYPE_UUID , 1, &uuid, 0, &data->comm); |
225 if (result == TSS_TCP_RPC_BAD_PACKET_TYPE) | 225 if (result == TSS_TCP_RPC_BAD_PACKET_TYPE) |
226 pUuid = NULL; | 226 pUuid = NULL; |
227 else if (result) | 227 else if (result) |
228 return result; | 228 return result; |
229 else | 229 else |
230 pUuid = &uuid; | 230 pUuid = &uuid; |
231 | 231 |
232 result = TCS_EnumRegisteredKeys_Internal( | 232 result = TCS_EnumRegisteredKeys_Internal( |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 TSS_UUID uuid, *pUuid; | 265 TSS_UUID uuid, *pUuid; |
266 UINT32 cKeyHierarchySize; | 266 UINT32 cKeyHierarchySize; |
267 TSS_KM_KEYINFO2 *pKeyHierarchy; | 267 TSS_KM_KEYINFO2 *pKeyHierarchy; |
268 unsigned int i, j; | 268 unsigned int i, j; |
269 TSS_RESULT result; | 269 TSS_RESULT result; |
270 | 270 |
271 /* Receive */ | 271 /* Receive */ |
272 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) | 272 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) |
273 return TCSERR(TSS_E_INTERNAL_ERROR); | 273 return TCSERR(TSS_E_INTERNAL_ERROR); |
274 | 274 |
275 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); | 275 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext); |
276 | 276 |
277 result = getData(TCSD_PACKET_TYPE_UUID , 1, &uuid, 0, &data->comm); | 277 result = getData(TCSD_PACKET_TYPE_UUID , 1, &uuid, 0, &data->comm); |
278 if (result == TSS_TCP_RPC_BAD_PACKET_TYPE) | 278 if (result == TSS_TCP_RPC_BAD_PACKET_TYPE) |
279 pUuid = NULL; | 279 pUuid = NULL; |
280 else if (result) | 280 else if (result) |
281 return result; | 281 return result; |
282 else | 282 else |
283 pUuid = &uuid; | 283 pUuid = &uuid; |
284 | 284 |
285 result = TCS_EnumRegisteredKeys_Internal2( | 285 result = TCS_EnumRegisteredKeys_Internal2( |
(...skipping 29 matching lines...) Expand all Loading... |
315 tcs_wrap_GetRegisteredKeyByPublicInfo(struct tcsd_thread_data *data) | 315 tcs_wrap_GetRegisteredKeyByPublicInfo(struct tcsd_thread_data *data) |
316 { | 316 { |
317 TCS_CONTEXT_HANDLE hContext; | 317 TCS_CONTEXT_HANDLE hContext; |
318 TSS_RESULT result; | 318 TSS_RESULT result; |
319 UINT32 algId, ulPublicInfoLength, keySize; | 319 UINT32 algId, ulPublicInfoLength, keySize; |
320 BYTE *rgbPublicInfo, *keyBlob; | 320 BYTE *rgbPublicInfo, *keyBlob; |
321 | 321 |
322 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) | 322 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) |
323 return TCSERR(TSS_E_INTERNAL_ERROR); | 323 return TCSERR(TSS_E_INTERNAL_ERROR); |
324 | 324 |
325 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); | 325 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext); |
326 | 326 |
327 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &algId, 0, &data->comm)) | 327 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &algId, 0, &data->comm)) |
328 return TCSERR(TSS_E_INTERNAL_ERROR); | 328 return TCSERR(TSS_E_INTERNAL_ERROR); |
329 if (getData(TCSD_PACKET_TYPE_UINT32, 2, &ulPublicInfoLength, 0, &data->c
omm)) | 329 if (getData(TCSD_PACKET_TYPE_UINT32, 2, &ulPublicInfoLength, 0, &data->c
omm)) |
330 return TCSERR(TSS_E_INTERNAL_ERROR); | 330 return TCSERR(TSS_E_INTERNAL_ERROR); |
331 | 331 |
332 rgbPublicInfo = (BYTE *)calloc(1, ulPublicInfoLength); | 332 rgbPublicInfo = (BYTE *)calloc(1, ulPublicInfoLength); |
333 if (rgbPublicInfo == NULL) { | 333 if (rgbPublicInfo == NULL) { |
334 LogError("malloc of %d bytes failed.", ulPublicInfoLength); | 334 LogError("malloc of %d bytes failed.", ulPublicInfoLength); |
335 return TCSERR(TSS_E_INTERNAL_ERROR); | 335 return TCSERR(TSS_E_INTERNAL_ERROR); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 | 501 |
502 /* Extract the infos of the blob regarding the new data type TSS_KM_KEYI
NFO2 */ | 502 /* Extract the infos of the blob regarding the new data type TSS_KM_KEYI
NFO2 */ |
503 UnloadBlob_UINT32(offset, &info->persistentStorageType, blob); | 503 UnloadBlob_UINT32(offset, &info->persistentStorageType, blob); |
504 UnloadBlob_UINT32(offset, &info->persistentStorageTypeParent, blob); | 504 UnloadBlob_UINT32(offset, &info->persistentStorageTypeParent, blob); |
505 | 505 |
506 UnloadBlob_BOOL(offset, &info->fIsLoaded, blob); | 506 UnloadBlob_BOOL(offset, &info->fIsLoaded, blob); |
507 UnloadBlob_UINT32(offset, &info->ulVendorDataLength, blob); | 507 UnloadBlob_UINT32(offset, &info->ulVendorDataLength, blob); |
508 UnloadBlob(offset, info->ulVendorDataLength, info->rgbVendorData, blob); | 508 UnloadBlob(offset, info->ulVendorDataLength, info->rgbVendorData, blob); |
509 } | 509 } |
510 #endif | 510 #endif |
OLD | NEW |