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-2007 | 7 * (C) Copyright International Business Machines Corp. 2004-2007 |
8 * | 8 * |
9 */ | 9 */ |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 tcs_wrap_ReadCounter(struct tcsd_thread_data *data) | 31 tcs_wrap_ReadCounter(struct tcsd_thread_data *data) |
32 { | 32 { |
33 TCS_CONTEXT_HANDLE hContext; | 33 TCS_CONTEXT_HANDLE hContext; |
34 TSS_COUNTER_ID idCounter; | 34 TSS_COUNTER_ID idCounter; |
35 TPM_COUNTER_VALUE counterValue; | 35 TPM_COUNTER_VALUE counterValue; |
36 TSS_RESULT result; | 36 TSS_RESULT result; |
37 | 37 |
38 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) | 38 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) |
39 return TCSERR(TSS_E_INTERNAL_ERROR); | 39 return TCSERR(TSS_E_INTERNAL_ERROR); |
40 | 40 |
41 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); | 41 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext); |
42 | 42 |
43 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &idCounter, 0, &data->comm)) | 43 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &idCounter, 0, &data->comm)) |
44 return TCSERR(TSS_E_INTERNAL_ERROR); | 44 return TCSERR(TSS_E_INTERNAL_ERROR); |
45 | 45 |
46 MUTEX_LOCK(tcsp_lock); | 46 MUTEX_LOCK(tcsp_lock); |
47 | 47 |
48 result = TCSP_ReadCounter_Internal(hContext, idCounter, &counterValue); | 48 result = TCSP_ReadCounter_Internal(hContext, idCounter, &counterValue); |
49 | 49 |
50 MUTEX_UNLOCK(tcsp_lock); | 50 MUTEX_UNLOCK(tcsp_lock); |
51 | 51 |
(...skipping 16 matching lines...) Expand all Loading... |
68 TPM_COUNTER_VALUE counterValue; | 68 TPM_COUNTER_VALUE counterValue; |
69 TPM_AUTH auth; | 69 TPM_AUTH auth; |
70 TPM_ENCAUTH encauth; | 70 TPM_ENCAUTH encauth; |
71 UINT32 LabelSize; | 71 UINT32 LabelSize; |
72 BYTE *pLabel = NULL; | 72 BYTE *pLabel = NULL; |
73 TSS_RESULT result; | 73 TSS_RESULT result; |
74 | 74 |
75 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) | 75 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) |
76 return TCSERR(TSS_E_INTERNAL_ERROR); | 76 return TCSERR(TSS_E_INTERNAL_ERROR); |
77 | 77 |
78 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); | 78 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext); |
79 | 79 |
80 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &LabelSize, 0, &data->comm)) | 80 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &LabelSize, 0, &data->comm)) |
81 return TCSERR(TSS_E_INTERNAL_ERROR); | 81 return TCSERR(TSS_E_INTERNAL_ERROR); |
82 | 82 |
83 if ((pLabel = calloc(1, LabelSize)) == NULL) { | 83 if ((pLabel = calloc(1, LabelSize)) == NULL) { |
84 LogError("malloc of %u bytes failed.", LabelSize); | 84 LogError("malloc of %u bytes failed.", LabelSize); |
85 return TCSERR(TSS_E_OUTOFMEMORY); | 85 return TCSERR(TSS_E_OUTOFMEMORY); |
86 } | 86 } |
87 | 87 |
88 if (getData(TCSD_PACKET_TYPE_PBYTE, 2, &pLabel, LabelSize, &data->comm))
{ | 88 if (getData(TCSD_PACKET_TYPE_PBYTE, 2, &pLabel, LabelSize, &data->comm))
{ |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 { | 127 { |
128 TCS_CONTEXT_HANDLE hContext; | 128 TCS_CONTEXT_HANDLE hContext; |
129 TSS_COUNTER_ID idCounter; | 129 TSS_COUNTER_ID idCounter; |
130 TPM_COUNTER_VALUE counterValue; | 130 TPM_COUNTER_VALUE counterValue; |
131 TPM_AUTH auth; | 131 TPM_AUTH auth; |
132 TSS_RESULT result; | 132 TSS_RESULT result; |
133 | 133 |
134 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) | 134 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) |
135 return TCSERR(TSS_E_INTERNAL_ERROR); | 135 return TCSERR(TSS_E_INTERNAL_ERROR); |
136 | 136 |
137 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); | 137 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext); |
138 | 138 |
139 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &idCounter, 0, &data->comm)) | 139 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &idCounter, 0, &data->comm)) |
140 return TCSERR(TSS_E_INTERNAL_ERROR); | 140 return TCSERR(TSS_E_INTERNAL_ERROR); |
141 if (getData(TCSD_PACKET_TYPE_AUTH, 2, &auth, 0, &data->comm)) | 141 if (getData(TCSD_PACKET_TYPE_AUTH, 2, &auth, 0, &data->comm)) |
142 return TCSERR(TSS_E_INTERNAL_ERROR); | 142 return TCSERR(TSS_E_INTERNAL_ERROR); |
143 | 143 |
144 MUTEX_LOCK(tcsp_lock); | 144 MUTEX_LOCK(tcsp_lock); |
145 | 145 |
146 result = TCSP_IncrementCounter_Internal(hContext, idCounter, &auth, &cou
nterValue); | 146 result = TCSP_IncrementCounter_Internal(hContext, idCounter, &auth, &cou
nterValue); |
147 | 147 |
(...skipping 16 matching lines...) Expand all Loading... |
164 tcs_wrap_ReleaseCounter(struct tcsd_thread_data *data) | 164 tcs_wrap_ReleaseCounter(struct tcsd_thread_data *data) |
165 { | 165 { |
166 TCS_CONTEXT_HANDLE hContext; | 166 TCS_CONTEXT_HANDLE hContext; |
167 TSS_COUNTER_ID idCounter; | 167 TSS_COUNTER_ID idCounter; |
168 TPM_AUTH auth; | 168 TPM_AUTH auth; |
169 TSS_RESULT result; | 169 TSS_RESULT result; |
170 | 170 |
171 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) | 171 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) |
172 return TCSERR(TSS_E_INTERNAL_ERROR); | 172 return TCSERR(TSS_E_INTERNAL_ERROR); |
173 | 173 |
174 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); | 174 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext); |
175 | 175 |
176 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &idCounter, 0, &data->comm)) | 176 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &idCounter, 0, &data->comm)) |
177 return TCSERR(TSS_E_INTERNAL_ERROR); | 177 return TCSERR(TSS_E_INTERNAL_ERROR); |
178 if (getData(TCSD_PACKET_TYPE_AUTH, 2, &auth, 0, &data->comm)) | 178 if (getData(TCSD_PACKET_TYPE_AUTH, 2, &auth, 0, &data->comm)) |
179 return TCSERR(TSS_E_INTERNAL_ERROR); | 179 return TCSERR(TSS_E_INTERNAL_ERROR); |
180 | 180 |
181 MUTEX_LOCK(tcsp_lock); | 181 MUTEX_LOCK(tcsp_lock); |
182 | 182 |
183 result = TCSP_ReleaseCounter_Internal(hContext, idCounter, &auth); | 183 result = TCSP_ReleaseCounter_Internal(hContext, idCounter, &auth); |
184 | 184 |
(...skipping 14 matching lines...) Expand all Loading... |
199 tcs_wrap_ReleaseCounterOwner(struct tcsd_thread_data *data) | 199 tcs_wrap_ReleaseCounterOwner(struct tcsd_thread_data *data) |
200 { | 200 { |
201 TCS_CONTEXT_HANDLE hContext; | 201 TCS_CONTEXT_HANDLE hContext; |
202 TSS_COUNTER_ID idCounter; | 202 TSS_COUNTER_ID idCounter; |
203 TPM_AUTH auth; | 203 TPM_AUTH auth; |
204 TSS_RESULT result; | 204 TSS_RESULT result; |
205 | 205 |
206 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) | 206 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) |
207 return TCSERR(TSS_E_INTERNAL_ERROR); | 207 return TCSERR(TSS_E_INTERNAL_ERROR); |
208 | 208 |
209 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); | 209 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext); |
210 | 210 |
211 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &idCounter, 0, &data->comm)) | 211 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &idCounter, 0, &data->comm)) |
212 return TCSERR(TSS_E_INTERNAL_ERROR); | 212 return TCSERR(TSS_E_INTERNAL_ERROR); |
213 if (getData(TCSD_PACKET_TYPE_AUTH, 2, &auth, 0, &data->comm)) | 213 if (getData(TCSD_PACKET_TYPE_AUTH, 2, &auth, 0, &data->comm)) |
214 return TCSERR(TSS_E_INTERNAL_ERROR); | 214 return TCSERR(TSS_E_INTERNAL_ERROR); |
215 | 215 |
216 MUTEX_LOCK(tcsp_lock); | 216 MUTEX_LOCK(tcsp_lock); |
217 | 217 |
218 result = TCSP_ReleaseCounterOwner_Internal(hContext, idCounter, &auth); | 218 result = TCSP_ReleaseCounterOwner_Internal(hContext, idCounter, &auth); |
219 | 219 |
220 MUTEX_UNLOCK(tcsp_lock); | 220 MUTEX_UNLOCK(tcsp_lock); |
221 | 221 |
222 if (result == TSS_SUCCESS) { | 222 if (result == TSS_SUCCESS) { |
223 initData(&data->comm, 1); | 223 initData(&data->comm, 1); |
224 if (setData(TCSD_PACKET_TYPE_AUTH, 0, &auth, 0, &data->comm)) | 224 if (setData(TCSD_PACKET_TYPE_AUTH, 0, &auth, 0, &data->comm)) |
225 return TCSERR(TSS_E_INTERNAL_ERROR); | 225 return TCSERR(TSS_E_INTERNAL_ERROR); |
226 } else | 226 } else |
227 initData(&data->comm, 0); | 227 initData(&data->comm, 0); |
228 | 228 |
229 data->comm.hdr.u.result = result; | 229 data->comm.hdr.u.result = result; |
230 return TSS_SUCCESS; | 230 return TSS_SUCCESS; |
231 } | 231 } |
OLD | NEW |