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 19 matching lines...) Expand all Loading... |
30 TSS_RESULT | 30 TSS_RESULT |
31 tcs_wrap_KillMaintenanceFeature(struct tcsd_thread_data *data) | 31 tcs_wrap_KillMaintenanceFeature(struct tcsd_thread_data *data) |
32 { | 32 { |
33 TCS_CONTEXT_HANDLE hContext; | 33 TCS_CONTEXT_HANDLE hContext; |
34 TSS_RESULT result; | 34 TSS_RESULT result; |
35 TPM_AUTH ownerAuth; | 35 TPM_AUTH ownerAuth; |
36 | 36 |
37 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) | 37 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) |
38 return TCSERR(TSS_E_INTERNAL_ERROR); | 38 return TCSERR(TSS_E_INTERNAL_ERROR); |
39 | 39 |
40 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); | 40 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext); |
41 | 41 |
42 if (getData(TCSD_PACKET_TYPE_AUTH, 1, &ownerAuth, 0, &data->comm)) | 42 if (getData(TCSD_PACKET_TYPE_AUTH, 1, &ownerAuth, 0, &data->comm)) |
43 return TCSERR(TSS_E_INTERNAL_ERROR); | 43 return TCSERR(TSS_E_INTERNAL_ERROR); |
44 | 44 |
45 MUTEX_LOCK(tcsp_lock); | 45 MUTEX_LOCK(tcsp_lock); |
46 | 46 |
47 result = TCSP_KillMaintenanceFeature_Internal(hContext, &ownerAuth); | 47 result = TCSP_KillMaintenanceFeature_Internal(hContext, &ownerAuth); |
48 | 48 |
49 MUTEX_UNLOCK(tcsp_lock); | 49 MUTEX_UNLOCK(tcsp_lock); |
50 | 50 |
(...skipping 16 matching lines...) Expand all Loading... |
67 TCS_CONTEXT_HANDLE hContext; | 67 TCS_CONTEXT_HANDLE hContext; |
68 TSS_RESULT result; | 68 TSS_RESULT result; |
69 TPM_AUTH ownerAuth; | 69 TPM_AUTH ownerAuth; |
70 TSS_BOOL generateRandom; | 70 TSS_BOOL generateRandom; |
71 UINT32 randomSize, archiveSize; | 71 UINT32 randomSize, archiveSize; |
72 BYTE *random, *archive; | 72 BYTE *random, *archive; |
73 | 73 |
74 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) | 74 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) |
75 return TCSERR(TSS_E_INTERNAL_ERROR); | 75 return TCSERR(TSS_E_INTERNAL_ERROR); |
76 | 76 |
77 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); | 77 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext); |
78 | 78 |
79 if (getData(TCSD_PACKET_TYPE_BOOL, 1, &generateRandom, 0, &data->comm)) | 79 if (getData(TCSD_PACKET_TYPE_BOOL, 1, &generateRandom, 0, &data->comm)) |
80 return TCSERR(TSS_E_INTERNAL_ERROR); | 80 return TCSERR(TSS_E_INTERNAL_ERROR); |
81 | 81 |
82 if (getData(TCSD_PACKET_TYPE_AUTH, 2, &ownerAuth, 0, &data->comm)) | 82 if (getData(TCSD_PACKET_TYPE_AUTH, 2, &ownerAuth, 0, &data->comm)) |
83 return TCSERR(TSS_E_INTERNAL_ERROR); | 83 return TCSERR(TSS_E_INTERNAL_ERROR); |
84 | 84 |
85 MUTEX_LOCK(tcsp_lock); | 85 MUTEX_LOCK(tcsp_lock); |
86 | 86 |
87 result = TCSP_CreateMaintenanceArchive_Internal(hContext, generateRandom
, &ownerAuth, | 87 result = TCSP_CreateMaintenanceArchive_Internal(hContext, generateRandom
, &ownerAuth, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 { | 135 { |
136 TCS_CONTEXT_HANDLE hContext; | 136 TCS_CONTEXT_HANDLE hContext; |
137 TSS_RESULT result; | 137 TSS_RESULT result; |
138 TPM_AUTH ownerAuth; | 138 TPM_AUTH ownerAuth; |
139 UINT32 dataInSize, dataOutSize; | 139 UINT32 dataInSize, dataOutSize; |
140 BYTE *dataIn, *dataOut; | 140 BYTE *dataIn, *dataOut; |
141 | 141 |
142 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) | 142 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) |
143 return TCSERR(TSS_E_INTERNAL_ERROR); | 143 return TCSERR(TSS_E_INTERNAL_ERROR); |
144 | 144 |
145 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); | 145 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext); |
146 | 146 |
147 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &dataInSize, 0, &data->comm)) | 147 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &dataInSize, 0, &data->comm)) |
148 return TCSERR(TSS_E_INTERNAL_ERROR); | 148 return TCSERR(TSS_E_INTERNAL_ERROR); |
149 | 149 |
150 dataIn = (BYTE *)malloc(dataInSize); | 150 dataIn = (BYTE *)malloc(dataInSize); |
151 if (dataIn == NULL) { | 151 if (dataIn == NULL) { |
152 LogError("malloc of %d bytes failed.", dataInSize); | 152 LogError("malloc of %d bytes failed.", dataInSize); |
153 return TCSERR(TSS_E_INTERNAL_ERROR); | 153 return TCSERR(TSS_E_INTERNAL_ERROR); |
154 } | 154 } |
155 if (getData(TCSD_PACKET_TYPE_PBYTE, 2, dataIn, dataInSize, &data->comm))
{ | 155 if (getData(TCSD_PACKET_TYPE_PBYTE, 2, dataIn, dataInSize, &data->comm))
{ |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 TCS_CONTEXT_HANDLE hContext; | 200 TCS_CONTEXT_HANDLE hContext; |
201 TSS_RESULT result; | 201 TSS_RESULT result; |
202 UINT32 pubKeySize; | 202 UINT32 pubKeySize; |
203 BYTE *pubKey; | 203 BYTE *pubKey; |
204 TCPA_NONCE antiReplay; | 204 TCPA_NONCE antiReplay; |
205 TCPA_DIGEST checksum; | 205 TCPA_DIGEST checksum; |
206 | 206 |
207 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) | 207 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) |
208 return TCSERR(TSS_E_INTERNAL_ERROR); | 208 return TCSERR(TSS_E_INTERNAL_ERROR); |
209 | 209 |
210 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); | 210 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext); |
211 | 211 |
212 if (getData(TCSD_PACKET_TYPE_NONCE, 1, &antiReplay, 0, &data->comm)) | 212 if (getData(TCSD_PACKET_TYPE_NONCE, 1, &antiReplay, 0, &data->comm)) |
213 return TCSERR(TSS_E_INTERNAL_ERROR); | 213 return TCSERR(TSS_E_INTERNAL_ERROR); |
214 | 214 |
215 if (getData(TCSD_PACKET_TYPE_UINT32, 2, &pubKeySize, 0, &data->comm)) | 215 if (getData(TCSD_PACKET_TYPE_UINT32, 2, &pubKeySize, 0, &data->comm)) |
216 return TCSERR(TSS_E_INTERNAL_ERROR); | 216 return TCSERR(TSS_E_INTERNAL_ERROR); |
217 | 217 |
218 pubKey = (BYTE *)malloc(pubKeySize); | 218 pubKey = (BYTE *)malloc(pubKeySize); |
219 if (pubKey == NULL) { | 219 if (pubKey == NULL) { |
220 LogError("malloc of %d bytes failed.", pubKeySize); | 220 LogError("malloc of %d bytes failed.", pubKeySize); |
(...skipping 30 matching lines...) Expand all Loading... |
251 tcs_wrap_ReadManuMaintPub(struct tcsd_thread_data *data) | 251 tcs_wrap_ReadManuMaintPub(struct tcsd_thread_data *data) |
252 { | 252 { |
253 TCS_CONTEXT_HANDLE hContext; | 253 TCS_CONTEXT_HANDLE hContext; |
254 TSS_RESULT result; | 254 TSS_RESULT result; |
255 TCPA_NONCE antiReplay; | 255 TCPA_NONCE antiReplay; |
256 TCPA_DIGEST checksum; | 256 TCPA_DIGEST checksum; |
257 | 257 |
258 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) | 258 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) |
259 return TCSERR(TSS_E_INTERNAL_ERROR); | 259 return TCSERR(TSS_E_INTERNAL_ERROR); |
260 | 260 |
261 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); | 261 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext); |
262 | 262 |
263 if (getData(TCSD_PACKET_TYPE_NONCE, 1, &antiReplay, 0, &data->comm)) | 263 if (getData(TCSD_PACKET_TYPE_NONCE, 1, &antiReplay, 0, &data->comm)) |
264 return TCSERR(TSS_E_INTERNAL_ERROR); | 264 return TCSERR(TSS_E_INTERNAL_ERROR); |
265 | 265 |
266 MUTEX_LOCK(tcsp_lock); | 266 MUTEX_LOCK(tcsp_lock); |
267 | 267 |
268 result = TCSP_ReadManuMaintPub_Internal(hContext, antiReplay, &checksum)
; | 268 result = TCSP_ReadManuMaintPub_Internal(hContext, antiReplay, &checksum)
; |
269 | 269 |
270 MUTEX_UNLOCK(tcsp_lock); | 270 MUTEX_UNLOCK(tcsp_lock); |
271 | 271 |
272 if (result == TSS_SUCCESS) { | 272 if (result == TSS_SUCCESS) { |
273 initData(&data->comm, 1); | 273 initData(&data->comm, 1); |
274 if (setData(TCSD_PACKET_TYPE_DIGEST, 0, &checksum, 0, &data->com
m)) { | 274 if (setData(TCSD_PACKET_TYPE_DIGEST, 0, &checksum, 0, &data->com
m)) { |
275 return TCSERR(TSS_E_INTERNAL_ERROR); | 275 return TCSERR(TSS_E_INTERNAL_ERROR); |
276 } | 276 } |
277 } else | 277 } else |
278 initData(&data->comm, 0); | 278 initData(&data->comm, 0); |
279 | 279 |
280 data->comm.hdr.u.result = result; | 280 data->comm.hdr.u.result = result; |
281 | 281 |
282 return TSS_SUCCESS; | 282 return TSS_SUCCESS; |
283 } | 283 } |
OLD | NEW |