Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: src/tcs/rpc/tcstp/rpc_key.c

Issue 3581012: Upgrade from trousers 0.3.3 to 0.3.6 and from testsuite 0.2 to 0.3. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/trousers.git
Patch Set: git cl push Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/tcs/rpc/tcstp/rpc_evlog.c ('k') | src/tcs/rpc/tcstp/rpc_maint.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
30 TSS_RESULT 30 TSS_RESULT
31 tcs_wrap_EvictKey(struct tcsd_thread_data *data) 31 tcs_wrap_EvictKey(struct tcsd_thread_data *data)
32 { 32 {
33 TCS_CONTEXT_HANDLE hContext; 33 TCS_CONTEXT_HANDLE hContext;
34 TCS_KEY_HANDLE hKey; 34 TCS_KEY_HANDLE hKey;
35 TSS_RESULT result; 35 TSS_RESULT result;
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_UINT32, 1, &hKey, 0, &data->comm)) 42 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &hKey, 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 = key_mgr_evict(hContext, hKey); 47 result = key_mgr_evict(hContext, hKey);
48 48
49 MUTEX_UNLOCK(tcsp_lock); 49 MUTEX_UNLOCK(tcsp_lock);
50 50
(...skipping 11 matching lines...) Expand all
62 TPM_AUTH auth; 62 TPM_AUTH auth;
63 TPM_AUTH *pAuth; 63 TPM_AUTH *pAuth;
64 UINT32 pubKeySize; 64 UINT32 pubKeySize;
65 BYTE *pubKey; 65 BYTE *pubKey;
66 TSS_RESULT result; 66 TSS_RESULT result;
67 int i; 67 int i;
68 68
69 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) 69 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm))
70 return TCSERR(TSS_E_INTERNAL_ERROR); 70 return TCSERR(TSS_E_INTERNAL_ERROR);
71 71
72 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); 72 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext);
73 73
74 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &hKey, 0, &data->comm)) 74 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &hKey, 0, &data->comm))
75 return TCSERR(TSS_E_INTERNAL_ERROR); 75 return TCSERR(TSS_E_INTERNAL_ERROR);
76 76
77 result = getData(TCSD_PACKET_TYPE_AUTH, 2, &auth, 0, &data->comm); 77 result = getData(TCSD_PACKET_TYPE_AUTH, 2, &auth, 0, &data->comm);
78 if (result == TSS_TCP_RPC_BAD_PACKET_TYPE) 78 if (result == TSS_TCP_RPC_BAD_PACKET_TYPE)
79 pAuth = NULL; 79 pAuth = NULL;
80 else if (result) 80 else if (result)
81 return result; 81 return result;
82 else 82 else
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 TSS_RESULT 115 TSS_RESULT
116 tcs_wrap_TerminateHandle(struct tcsd_thread_data *data) 116 tcs_wrap_TerminateHandle(struct tcsd_thread_data *data)
117 { 117 {
118 TCS_CONTEXT_HANDLE hContext; 118 TCS_CONTEXT_HANDLE hContext;
119 TCS_AUTHHANDLE authHandle; 119 TCS_AUTHHANDLE authHandle;
120 TSS_RESULT result; 120 TSS_RESULT result;
121 121
122 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) 122 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm))
123 return TCSERR(TSS_E_INTERNAL_ERROR); 123 return TCSERR(TSS_E_INTERNAL_ERROR);
124 124
125 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); 125 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext);
126 126
127 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &authHandle, 0, &data->comm)) 127 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &authHandle, 0, &data->comm))
128 return TCSERR(TSS_E_INTERNAL_ERROR); 128 return TCSERR(TSS_E_INTERNAL_ERROR);
129 129
130 MUTEX_LOCK(tcsp_lock); 130 MUTEX_LOCK(tcsp_lock);
131 131
132 result = TCSP_TerminateHandle_Internal(hContext, authHandle); 132 result = TCSP_TerminateHandle_Internal(hContext, authHandle);
133 133
134 MUTEX_UNLOCK(tcsp_lock); 134 MUTEX_UNLOCK(tcsp_lock);
135 135
(...skipping 16 matching lines...) Expand all
152 TCS_KEY_HANDLE phKeyTCSI; 152 TCS_KEY_HANDLE phKeyTCSI;
153 TCS_KEY_HANDLE phKeyHMAC; 153 TCS_KEY_HANDLE phKeyHMAC;
154 154
155 TPM_AUTH *pAuth; 155 TPM_AUTH *pAuth;
156 TSS_RESULT result; 156 TSS_RESULT result;
157 int i; 157 int i;
158 158
159 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) 159 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm))
160 return TCSERR(TSS_E_INTERNAL_ERROR); 160 return TCSERR(TSS_E_INTERNAL_ERROR);
161 161
162 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); 162 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext);
163 163
164 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &hUnwrappingKey, 0, &data->comm) ) 164 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &hUnwrappingKey, 0, &data->comm) )
165 return TCSERR(TSS_E_INTERNAL_ERROR); 165 return TCSERR(TSS_E_INTERNAL_ERROR);
166 if (getData(TCSD_PACKET_TYPE_UINT32, 2, &cWrappedKeyBlob, 0, &data->comm )) 166 if (getData(TCSD_PACKET_TYPE_UINT32, 2, &cWrappedKeyBlob, 0, &data->comm ))
167 return TCSERR(TSS_E_INTERNAL_ERROR); 167 return TCSERR(TSS_E_INTERNAL_ERROR);
168 168
169 rgbWrappedKeyBlob = calloc(1, cWrappedKeyBlob); 169 rgbWrappedKeyBlob = calloc(1, cWrappedKeyBlob);
170 if (rgbWrappedKeyBlob == NULL) { 170 if (rgbWrappedKeyBlob == NULL) {
171 LogError("malloc of %d bytes failed.", cWrappedKeyBlob); 171 LogError("malloc of %d bytes failed.", cWrappedKeyBlob);
172 return TCSERR(TSS_E_OUTOFMEMORY); 172 return TCSERR(TSS_E_OUTOFMEMORY);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 BYTE *rgbWrappedKeyBlob; 228 BYTE *rgbWrappedKeyBlob;
229 TPM_AUTH auth; 229 TPM_AUTH auth;
230 TCS_KEY_HANDLE phKeyTCSI; 230 TCS_KEY_HANDLE phKeyTCSI;
231 TPM_AUTH *pAuth; 231 TPM_AUTH *pAuth;
232 TSS_RESULT result; 232 TSS_RESULT result;
233 int i; 233 int i;
234 234
235 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) 235 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm))
236 return TCSERR(TSS_E_INTERNAL_ERROR); 236 return TCSERR(TSS_E_INTERNAL_ERROR);
237 237
238 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); 238 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext);
239 239
240 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &hUnwrappingKey, 0, &data->comm) ) 240 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &hUnwrappingKey, 0, &data->comm) )
241 return TCSERR(TSS_E_INTERNAL_ERROR); 241 return TCSERR(TSS_E_INTERNAL_ERROR);
242 if (getData(TCSD_PACKET_TYPE_UINT32, 2, &cWrappedKeyBlob, 0, &data->comm )) 242 if (getData(TCSD_PACKET_TYPE_UINT32, 2, &cWrappedKeyBlob, 0, &data->comm ))
243 return TCSERR(TSS_E_INTERNAL_ERROR); 243 return TCSERR(TSS_E_INTERNAL_ERROR);
244 244
245 rgbWrappedKeyBlob = calloc(1, cWrappedKeyBlob); 245 rgbWrappedKeyBlob = calloc(1, cWrappedKeyBlob);
246 if (rgbWrappedKeyBlob == NULL) { 246 if (rgbWrappedKeyBlob == NULL) {
247 LogError("malloc of %d bytes failed.", cWrappedKeyBlob); 247 LogError("malloc of %d bytes failed.", cWrappedKeyBlob);
248 return TCSERR(TSS_E_OUTOFMEMORY); 248 return TCSERR(TSS_E_OUTOFMEMORY);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 304
305 TPM_AUTH *pAuth, auth; 305 TPM_AUTH *pAuth, auth;
306 306
307 UINT32 keyDataSize; 307 UINT32 keyDataSize;
308 BYTE *keyData; 308 BYTE *keyData;
309 TSS_RESULT result; 309 TSS_RESULT result;
310 310
311 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) 311 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm))
312 return TCSERR(TSS_E_INTERNAL_ERROR); 312 return TCSERR(TSS_E_INTERNAL_ERROR);
313 313
314 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); 314 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext);
315 315
316 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &hWrappingKey, 0, &data->comm)) 316 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &hWrappingKey, 0, &data->comm))
317 return TCSERR(TSS_E_INTERNAL_ERROR); 317 return TCSERR(TSS_E_INTERNAL_ERROR);
318 if (getData(TCSD_PACKET_TYPE_ENCAUTH, 2, &KeyUsageAuth, 0, &data->comm)) 318 if (getData(TCSD_PACKET_TYPE_ENCAUTH, 2, &KeyUsageAuth, 0, &data->comm))
319 return TCSERR(TSS_E_INTERNAL_ERROR); 319 return TCSERR(TSS_E_INTERNAL_ERROR);
320 if (getData(TCSD_PACKET_TYPE_ENCAUTH, 3, &KeyMigrationAuth, 0, &data->co mm)) 320 if (getData(TCSD_PACKET_TYPE_ENCAUTH, 3, &KeyMigrationAuth, 0, &data->co mm))
321 return TCSERR(TSS_E_INTERNAL_ERROR); 321 return TCSERR(TSS_E_INTERNAL_ERROR);
322 if (getData(TCSD_PACKET_TYPE_UINT32, 4, &keyInfoSize, 0, &data->comm)) 322 if (getData(TCSD_PACKET_TYPE_UINT32, 4, &keyInfoSize, 0, &data->comm))
323 return TCSERR(TSS_E_INTERNAL_ERROR); 323 return TCSERR(TSS_E_INTERNAL_ERROR);
324 324
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 TCS_CONTEXT_HANDLE hContext; 374 TCS_CONTEXT_HANDLE hContext;
375 TCS_KEY_HANDLE hKey; 375 TCS_KEY_HANDLE hKey;
376 TPM_AUTH ownerAuth; 376 TPM_AUTH ownerAuth;
377 UINT32 pubKeySize; 377 UINT32 pubKeySize;
378 BYTE *pubKeyData; 378 BYTE *pubKeyData;
379 TSS_RESULT result; 379 TSS_RESULT result;
380 380
381 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) 381 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm))
382 return TCSERR(TSS_E_INTERNAL_ERROR); 382 return TCSERR(TSS_E_INTERNAL_ERROR);
383 383
384 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); 384 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext);
385 385
386 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &hKey, 0, &data->comm)) 386 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &hKey, 0, &data->comm))
387 return TCSERR(TSS_E_INTERNAL_ERROR); 387 return TCSERR(TSS_E_INTERNAL_ERROR);
388 if (getData(TCSD_PACKET_TYPE_AUTH, 2, &ownerAuth, 0, &data->comm)) 388 if (getData(TCSD_PACKET_TYPE_AUTH, 2, &ownerAuth, 0, &data->comm))
389 return TCSERR(TSS_E_INTERNAL_ERROR); 389 return TCSERR(TSS_E_INTERNAL_ERROR);
390 390
391 MUTEX_LOCK(tcsp_lock); 391 MUTEX_LOCK(tcsp_lock);
392 392
393 result = TCSP_OwnerReadInternalPub_Internal(hContext, hKey, &ownerAuth, &pubKeySize, &pubKeyData); 393 result = TCSP_OwnerReadInternalPub_Internal(hContext, hKey, &ownerAuth, &pubKeySize, &pubKeyData);
394 394
(...skipping 22 matching lines...) Expand all
417 UINT32 ulPublicKeyLength; 417 UINT32 ulPublicKeyLength;
418 BYTE* rgbPublicKey; 418 BYTE* rgbPublicKey;
419 UINT32 attribName; 419 UINT32 attribName;
420 TSS_BOOL attribValue; 420 TSS_BOOL attribValue;
421 TPM_AUTH ownerAuth; 421 TPM_AUTH ownerAuth;
422 TSS_UUID uuidData; 422 TSS_UUID uuidData;
423 TSS_RESULT result; 423 TSS_RESULT result;
424 424
425 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) 425 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm))
426 return TCSERR(TSS_E_INTERNAL_ERROR); 426 return TCSERR(TSS_E_INTERNAL_ERROR);
427 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); 427 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext);
428 428
429 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &hKey, 0, &data->comm)) 429 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &hKey, 0, &data->comm))
430 return TCSERR(TSS_E_INTERNAL_ERROR); 430 return TCSERR(TSS_E_INTERNAL_ERROR);
431 if (getData(TCSD_PACKET_TYPE_UINT32, 2, &ulPublicKeyLength, 0, &data->co mm)) 431 if (getData(TCSD_PACKET_TYPE_UINT32, 2, &ulPublicKeyLength, 0, &data->co mm))
432 return TCSERR(TSS_E_INTERNAL_ERROR); 432 return TCSERR(TSS_E_INTERNAL_ERROR);
433 433
434 rgbPublicKey = (BYTE *) malloc(ulPublicKeyLength); 434 rgbPublicKey = (BYTE *) malloc(ulPublicKeyLength);
435 if (rgbPublicKey == NULL) { 435 if (rgbPublicKey == NULL) {
436 LogError("malloc of %u bytes failed.", ulPublicKeyLength); 436 LogError("malloc of %u bytes failed.", ulPublicKeyLength);
437 return TCSERR(TSS_E_OUTOFMEMORY); 437 return TCSERR(TSS_E_OUTOFMEMORY);
(...skipping 29 matching lines...) Expand all
467 if (setData(TCSD_PACKET_TYPE_UUID, 1, &uuidData, 0, &data->comm) ) 467 if (setData(TCSD_PACKET_TYPE_UUID, 1, &uuidData, 0, &data->comm) )
468 return TCSERR(TSS_E_INTERNAL_ERROR); 468 return TCSERR(TSS_E_INTERNAL_ERROR);
469 } else 469 } else
470 initData(&data->comm, 0); 470 initData(&data->comm, 0);
471 471
472 data->comm.hdr.u.result = result; 472 data->comm.hdr.u.result = result;
473 return TSS_SUCCESS; 473 return TSS_SUCCESS;
474 474
475 } 475 }
476 #endif 476 #endif
OLDNEW
« no previous file with comments | « src/tcs/rpc/tcstp/rpc_evlog.c ('k') | src/tcs/rpc/tcstp/rpc_maint.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698