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 23 matching lines...) Expand all Loading... |
34 TCPA_CAPABILITY_AREA capArea; | 34 TCPA_CAPABILITY_AREA capArea; |
35 UINT32 subCapSize; | 35 UINT32 subCapSize; |
36 BYTE *subCap; | 36 BYTE *subCap; |
37 UINT32 respSize; | 37 UINT32 respSize; |
38 BYTE *resp; | 38 BYTE *resp; |
39 TSS_RESULT result; | 39 TSS_RESULT result; |
40 | 40 |
41 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) | 41 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) |
42 return TCSERR(TSS_E_INTERNAL_ERROR); | 42 return TCSERR(TSS_E_INTERNAL_ERROR); |
43 | 43 |
44 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); | 44 » LogDebugFn("thread %ldd context %x", THREAD_ID, hContext); |
45 | 45 |
46 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &capArea, 0, &data->comm)) | 46 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &capArea, 0, &data->comm)) |
47 return TCSERR(TSS_E_INTERNAL_ERROR); | 47 return TCSERR(TSS_E_INTERNAL_ERROR); |
48 if (getData(TCSD_PACKET_TYPE_UINT32, 2, &subCapSize, 0, &data->comm)) | 48 if (getData(TCSD_PACKET_TYPE_UINT32, 2, &subCapSize, 0, &data->comm)) |
49 return TCSERR(TSS_E_INTERNAL_ERROR); | 49 return TCSERR(TSS_E_INTERNAL_ERROR); |
50 | 50 |
51 if (subCapSize == 0) | 51 if (subCapSize == 0) |
52 subCap = NULL; | 52 subCap = NULL; |
53 else { | 53 else { |
54 subCap = calloc(1, subCapSize); | 54 subCap = calloc(1, subCapSize); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 TCS_CONTEXT_HANDLE hContext; | 94 TCS_CONTEXT_HANDLE hContext; |
95 TPM_AUTH ownerAuth; | 95 TPM_AUTH ownerAuth; |
96 TCPA_VERSION version; | 96 TCPA_VERSION version; |
97 UINT32 nonVol; | 97 UINT32 nonVol; |
98 UINT32 vol; | 98 UINT32 vol; |
99 TSS_RESULT result; | 99 TSS_RESULT result; |
100 | 100 |
101 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) | 101 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) |
102 return TCSERR(TSS_E_INTERNAL_ERROR); | 102 return TCSERR(TSS_E_INTERNAL_ERROR); |
103 | 103 |
104 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); | 104 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext); |
105 | 105 |
106 if (getData(TCSD_PACKET_TYPE_AUTH, 1, &ownerAuth, 0, &data->comm)) | 106 if (getData(TCSD_PACKET_TYPE_AUTH, 1, &ownerAuth, 0, &data->comm)) |
107 return TCSERR(TSS_E_INTERNAL_ERROR); | 107 return TCSERR(TSS_E_INTERNAL_ERROR); |
108 | 108 |
109 MUTEX_LOCK(tcsp_lock); | 109 MUTEX_LOCK(tcsp_lock); |
110 | 110 |
111 result = TCSP_GetCapabilityOwner_Internal(hContext, &ownerAuth, &version
, &nonVol, &vol); | 111 result = TCSP_GetCapabilityOwner_Internal(hContext, &ownerAuth, &version
, &nonVol, &vol); |
112 | 112 |
113 MUTEX_UNLOCK(tcsp_lock); | 113 MUTEX_UNLOCK(tcsp_lock); |
114 | 114 |
(...skipping 26 matching lines...) Expand all Loading... |
141 UINT32 subCapSize; | 141 UINT32 subCapSize; |
142 BYTE *subCap; | 142 BYTE *subCap; |
143 UINT32 valueSize; | 143 UINT32 valueSize; |
144 BYTE *value; | 144 BYTE *value; |
145 TSS_RESULT result; | 145 TSS_RESULT result; |
146 TPM_AUTH ownerAuth, *pOwnerAuth; | 146 TPM_AUTH ownerAuth, *pOwnerAuth; |
147 | 147 |
148 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) | 148 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) |
149 return TCSERR(TSS_E_INTERNAL_ERROR); | 149 return TCSERR(TSS_E_INTERNAL_ERROR); |
150 | 150 |
151 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); | 151 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext); |
152 | 152 |
153 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &capArea, 0, &data->comm)) | 153 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &capArea, 0, &data->comm)) |
154 return TCSERR(TSS_E_INTERNAL_ERROR); | 154 return TCSERR(TSS_E_INTERNAL_ERROR); |
155 if (getData(TCSD_PACKET_TYPE_UINT32, 2, &subCapSize, 0, &data->comm)) | 155 if (getData(TCSD_PACKET_TYPE_UINT32, 2, &subCapSize, 0, &data->comm)) |
156 return TCSERR(TSS_E_INTERNAL_ERROR); | 156 return TCSERR(TSS_E_INTERNAL_ERROR); |
157 | 157 |
158 if (subCapSize == 0) | 158 if (subCapSize == 0) |
159 subCap = NULL; | 159 subCap = NULL; |
160 else { | 160 else { |
161 subCap = calloc(1, subCapSize); | 161 subCap = calloc(1, subCapSize); |
162 if (subCap == NULL) { | 162 if (subCap == NULL) { |
163 LogError("malloc of %u bytes failed.", subCapSize); | 163 LogError("malloc of %u bytes failed.", subCapSize); |
164 return TCSERR(TSS_E_OUTOFMEMORY); | 164 return TCSERR(TSS_E_OUTOFMEMORY); |
165 } | 165 } |
166 if (getData(TCSD_PACKET_TYPE_PBYTE, 3, subCap, subCapSize, &data
->comm)) { | 166 if (getData(TCSD_PACKET_TYPE_PBYTE, 3, subCap, subCapSize, &data
->comm)) { |
167 free(subCap); | 167 free(subCap); |
168 return TCSERR(TSS_E_INTERNAL_ERROR); | 168 return TCSERR(TSS_E_INTERNAL_ERROR); |
169 } | 169 } |
170 } | 170 } |
171 | 171 |
172 » if (getData(TCSD_PACKET_TYPE_UINT32, 4, &valueSize, 0, &data->comm)) | 172 » if (getData(TCSD_PACKET_TYPE_UINT32, 4, &valueSize, 0, &data->comm)) { |
| 173 » » free(subCap); |
173 return TCSERR(TSS_E_INTERNAL_ERROR); | 174 return TCSERR(TSS_E_INTERNAL_ERROR); |
| 175 } |
174 | 176 |
175 if (valueSize == 0) | 177 if (valueSize == 0) |
176 value = NULL; | 178 value = NULL; |
177 else { | 179 else { |
178 value = calloc(1, valueSize); | 180 value = calloc(1, valueSize); |
179 if (value == NULL) { | 181 if (value == NULL) { |
180 free(subCap); | 182 free(subCap); |
181 LogError("malloc of %u bytes failed.", valueSize); | 183 LogError("malloc of %u bytes failed.", valueSize); |
182 return TCSERR(TSS_E_OUTOFMEMORY); | 184 return TCSERR(TSS_E_OUTOFMEMORY); |
183 } | 185 } |
(...skipping 25 matching lines...) Expand all Loading... |
209 if (setData(TCSD_PACKET_TYPE_AUTH, 0, pOwnerAuth, 0, &da
ta->comm)) { | 211 if (setData(TCSD_PACKET_TYPE_AUTH, 0, pOwnerAuth, 0, &da
ta->comm)) { |
210 return TCSERR(TSS_E_INTERNAL_ERROR); | 212 return TCSERR(TSS_E_INTERNAL_ERROR); |
211 } | 213 } |
212 } | 214 } |
213 } else | 215 } else |
214 initData(&data->comm, 0); | 216 initData(&data->comm, 0); |
215 | 217 |
216 data->comm.hdr.u.result = result; | 218 data->comm.hdr.u.result = result; |
217 return TSS_SUCCESS; | 219 return TSS_SUCCESS; |
218 } | 220 } |
OLD | NEW |