| 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. 2007 | 7 * (C) Copyright International Business Machines Corp. 2007 |
| 8 * | 8 * |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 BYTE *retData; | 40 BYTE *retData; |
| 41 TSS_RESULT result; | 41 TSS_RESULT result; |
| 42 int i; | 42 int i; |
| 43 | 43 |
| 44 memset(&ownerAuth, 0, sizeof(TPM_AUTH)); | 44 memset(&ownerAuth, 0, sizeof(TPM_AUTH)); |
| 45 memset(&nullAuth, 0, sizeof(TPM_AUTH)); | 45 memset(&nullAuth, 0, sizeof(TPM_AUTH)); |
| 46 | 46 |
| 47 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) | 47 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) |
| 48 return TCSERR(TSS_E_INTERNAL_ERROR); | 48 return TCSERR(TSS_E_INTERNAL_ERROR); |
| 49 | 49 |
| 50 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); | 50 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext); |
| 51 | 51 |
| 52 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &familyId, 0, &data->comm)) | 52 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &familyId, 0, &data->comm)) |
| 53 return TCSERR(TSS_E_INTERNAL_ERROR); | 53 return TCSERR(TSS_E_INTERNAL_ERROR); |
| 54 | 54 |
| 55 if (getData(TCSD_PACKET_TYPE_UINT32, 2, &opFlag, 0, &data->comm)) | 55 if (getData(TCSD_PACKET_TYPE_UINT32, 2, &opFlag, 0, &data->comm)) |
| 56 return TCSERR(TSS_E_INTERNAL_ERROR); | 56 return TCSERR(TSS_E_INTERNAL_ERROR); |
| 57 | 57 |
| 58 if (getData(TCSD_PACKET_TYPE_UINT32, 3, &opDataSize, 0, &data->comm)) | 58 if (getData(TCSD_PACKET_TYPE_UINT32, 3, &opDataSize, 0, &data->comm)) |
| 59 return TCSERR(TSS_E_INTERNAL_ERROR); | 59 return TCSERR(TSS_E_INTERNAL_ERROR); |
| 60 | 60 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 BYTE *blob; | 126 BYTE *blob; |
| 127 TSS_RESULT result; | 127 TSS_RESULT result; |
| 128 int i; | 128 int i; |
| 129 | 129 |
| 130 memset(&keyAuth, 0, sizeof(TPM_AUTH)); | 130 memset(&keyAuth, 0, sizeof(TPM_AUTH)); |
| 131 memset(&nullAuth, 0, sizeof(TPM_AUTH)); | 131 memset(&nullAuth, 0, sizeof(TPM_AUTH)); |
| 132 | 132 |
| 133 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) | 133 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) |
| 134 return TCSERR(TSS_E_INTERNAL_ERROR); | 134 return TCSERR(TSS_E_INTERNAL_ERROR); |
| 135 | 135 |
| 136 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); | 136 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext); |
| 137 | 137 |
| 138 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &hKey, 0, &data->comm)) | 138 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &hKey, 0, &data->comm)) |
| 139 return TCSERR(TSS_E_INTERNAL_ERROR); | 139 return TCSERR(TSS_E_INTERNAL_ERROR); |
| 140 | 140 |
| 141 if (getData(TCSD_PACKET_TYPE_UINT32, 2, &publicInfoSize, 0, &data->comm)
) | 141 if (getData(TCSD_PACKET_TYPE_UINT32, 2, &publicInfoSize, 0, &data->comm)
) |
| 142 return TCSERR(TSS_E_INTERNAL_ERROR); | 142 return TCSERR(TSS_E_INTERNAL_ERROR); |
| 143 | 143 |
| 144 publicInfo = malloc(publicInfoSize); | 144 publicInfo = malloc(publicInfoSize); |
| 145 if (publicInfo == NULL) { | 145 if (publicInfo == NULL) { |
| 146 LogError("malloc of %u bytes failed.", publicInfoSize); | 146 LogError("malloc of %u bytes failed.", publicInfoSize); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 BYTE *blob; | 214 BYTE *blob; |
| 215 TSS_RESULT result; | 215 TSS_RESULT result; |
| 216 int i; | 216 int i; |
| 217 | 217 |
| 218 memset(&ownerAuth, 0, sizeof(TPM_AUTH)); | 218 memset(&ownerAuth, 0, sizeof(TPM_AUTH)); |
| 219 memset(&nullAuth, 0, sizeof(TPM_AUTH)); | 219 memset(&nullAuth, 0, sizeof(TPM_AUTH)); |
| 220 | 220 |
| 221 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) | 221 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) |
| 222 return TCSERR(TSS_E_INTERNAL_ERROR); | 222 return TCSERR(TSS_E_INTERNAL_ERROR); |
| 223 | 223 |
| 224 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); | 224 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext); |
| 225 | 225 |
| 226 if (getData(TCSD_PACKET_TYPE_BOOL, 1, &increment, 0, &data->comm)) | 226 if (getData(TCSD_PACKET_TYPE_BOOL, 1, &increment, 0, &data->comm)) |
| 227 return TCSERR(TSS_E_INTERNAL_ERROR); | 227 return TCSERR(TSS_E_INTERNAL_ERROR); |
| 228 | 228 |
| 229 if (getData(TCSD_PACKET_TYPE_UINT32, 2, &publicInfoSize, 0, &data->comm)
) | 229 if (getData(TCSD_PACKET_TYPE_UINT32, 2, &publicInfoSize, 0, &data->comm)
) |
| 230 return TCSERR(TSS_E_INTERNAL_ERROR); | 230 return TCSERR(TSS_E_INTERNAL_ERROR); |
| 231 | 231 |
| 232 publicInfo = malloc(publicInfoSize); | 232 publicInfo = malloc(publicInfoSize); |
| 233 if (publicInfo == NULL) { | 233 if (publicInfo == NULL) { |
| 234 LogError("malloc of %u bytes failed.", publicInfoSize); | 234 LogError("malloc of %u bytes failed.", publicInfoSize); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 BYTE *blob; | 298 BYTE *blob; |
| 299 TPM_AUTH ownerAuth, nullAuth, *pAuth; | 299 TPM_AUTH ownerAuth, nullAuth, *pAuth; |
| 300 TSS_RESULT result; | 300 TSS_RESULT result; |
| 301 | 301 |
| 302 memset(&ownerAuth, 0, sizeof(TPM_AUTH)); | 302 memset(&ownerAuth, 0, sizeof(TPM_AUTH)); |
| 303 memset(&nullAuth, 0, sizeof(TPM_AUTH)); | 303 memset(&nullAuth, 0, sizeof(TPM_AUTH)); |
| 304 | 304 |
| 305 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) | 305 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) |
| 306 return TCSERR(TSS_E_INTERNAL_ERROR); | 306 return TCSERR(TSS_E_INTERNAL_ERROR); |
| 307 | 307 |
| 308 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); | 308 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext); |
| 309 | 309 |
| 310 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &index, 0, &data->comm)) | 310 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &index, 0, &data->comm)) |
| 311 return TCSERR(TSS_E_INTERNAL_ERROR); | 311 return TCSERR(TSS_E_INTERNAL_ERROR); |
| 312 | 312 |
| 313 if (getData(TCSD_PACKET_TYPE_UINT32, 2, &blobSize, 0, &data->comm)) | 313 if (getData(TCSD_PACKET_TYPE_UINT32, 2, &blobSize, 0, &data->comm)) |
| 314 return TCSERR(TSS_E_INTERNAL_ERROR); | 314 return TCSERR(TSS_E_INTERNAL_ERROR); |
| 315 | 315 |
| 316 blob = malloc(blobSize); | 316 blob = malloc(blobSize); |
| 317 if (blob == NULL) { | 317 if (blob == NULL) { |
| 318 LogError("malloc of %u bytes failed.", blobSize); | 318 LogError("malloc of %u bytes failed.", blobSize); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 338 result = TCSP_Delegate_LoadOwnerDelegation_Internal(hContext, index, blo
bSize, blob, | 338 result = TCSP_Delegate_LoadOwnerDelegation_Internal(hContext, index, blo
bSize, blob, |
| 339 pAuth); | 339 pAuth); |
| 340 | 340 |
| 341 MUTEX_UNLOCK(tcsp_lock); | 341 MUTEX_UNLOCK(tcsp_lock); |
| 342 free(blob); | 342 free(blob); |
| 343 | 343 |
| 344 if (result == TSS_SUCCESS) { | 344 if (result == TSS_SUCCESS) { |
| 345 initData(&data->comm, 1); | 345 initData(&data->comm, 1); |
| 346 if (pAuth) { | 346 if (pAuth) { |
| 347 if (setData(TCSD_PACKET_TYPE_AUTH, 0, pAuth, 0, &data->c
omm)) { | 347 if (setData(TCSD_PACKET_TYPE_AUTH, 0, pAuth, 0, &data->c
omm)) { |
| 348 free(blob); | |
| 349 return TCSERR(TSS_E_INTERNAL_ERROR); | 348 return TCSERR(TSS_E_INTERNAL_ERROR); |
| 350 } | 349 } |
| 351 } | 350 } |
| 352 } else | 351 } else |
| 353 initData(&data->comm, 0); | 352 initData(&data->comm, 0); |
| 354 | 353 |
| 355 data->comm.hdr.u.result = result; | 354 data->comm.hdr.u.result = result; |
| 356 | 355 |
| 357 return TSS_SUCCESS; | 356 return TSS_SUCCESS; |
| 358 } | 357 } |
| 359 | 358 |
| 360 TSS_RESULT | 359 TSS_RESULT |
| 361 tcs_wrap_Delegate_ReadTable(struct tcsd_thread_data *data) | 360 tcs_wrap_Delegate_ReadTable(struct tcsd_thread_data *data) |
| 362 { | 361 { |
| 363 TCS_CONTEXT_HANDLE hContext; | 362 TCS_CONTEXT_HANDLE hContext; |
| 364 UINT32 familyTableSize; | 363 UINT32 familyTableSize; |
| 365 BYTE *familyTable; | 364 BYTE *familyTable; |
| 366 UINT32 delegateTableSize; | 365 UINT32 delegateTableSize; |
| 367 BYTE *delegateTable; | 366 BYTE *delegateTable; |
| 368 TSS_RESULT result; | 367 TSS_RESULT result; |
| 369 | 368 |
| 370 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) | 369 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) |
| 371 return TCSERR(TSS_E_INTERNAL_ERROR); | 370 return TCSERR(TSS_E_INTERNAL_ERROR); |
| 372 | 371 |
| 373 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); | 372 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext); |
| 374 | 373 |
| 375 MUTEX_LOCK(tcsp_lock); | 374 MUTEX_LOCK(tcsp_lock); |
| 376 | 375 |
| 377 result = TCSP_Delegate_ReadTable_Internal(hContext, &familyTableSize, &f
amilyTable, | 376 result = TCSP_Delegate_ReadTable_Internal(hContext, &familyTableSize, &f
amilyTable, |
| 378 &delegateTableSize, &delegateTable); | 377 &delegateTableSize, &delegateTable); |
| 379 | 378 |
| 380 MUTEX_UNLOCK(tcsp_lock); | 379 MUTEX_UNLOCK(tcsp_lock); |
| 381 | 380 |
| 382 if (result == TSS_SUCCESS) { | 381 if (result == TSS_SUCCESS) { |
| 383 initData(&data->comm, 4); | 382 initData(&data->comm, 4); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 BYTE *output; | 420 BYTE *output; |
| 422 TSS_RESULT result; | 421 TSS_RESULT result; |
| 423 int i; | 422 int i; |
| 424 | 423 |
| 425 memset(&ownerAuth, 0, sizeof(TPM_AUTH)); | 424 memset(&ownerAuth, 0, sizeof(TPM_AUTH)); |
| 426 memset(&nullAuth, 0, sizeof(TPM_AUTH)); | 425 memset(&nullAuth, 0, sizeof(TPM_AUTH)); |
| 427 | 426 |
| 428 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) | 427 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) |
| 429 return TCSERR(TSS_E_INTERNAL_ERROR); | 428 return TCSERR(TSS_E_INTERNAL_ERROR); |
| 430 | 429 |
| 431 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); | 430 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext); |
| 432 | 431 |
| 433 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &inputSize, 0, &data->comm)) | 432 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &inputSize, 0, &data->comm)) |
| 434 return TCSERR(TSS_E_INTERNAL_ERROR); | 433 return TCSERR(TSS_E_INTERNAL_ERROR); |
| 435 | 434 |
| 436 input = malloc(inputSize); | 435 input = malloc(inputSize); |
| 437 if (input == NULL) { | 436 if (input == NULL) { |
| 438 LogError("malloc of %u bytes failed.", inputSize); | 437 LogError("malloc of %u bytes failed.", inputSize); |
| 439 return TCSERR(TSS_E_OUTOFMEMORY); | 438 return TCSERR(TSS_E_OUTOFMEMORY); |
| 440 } | 439 } |
| 441 if (getData(TCSD_PACKET_TYPE_PBYTE, 2, input, inputSize, &data->comm)) { | 440 if (getData(TCSD_PACKET_TYPE_PBYTE, 2, input, inputSize, &data->comm)) { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 tcs_wrap_Delegate_VerifyDelegation(struct tcsd_thread_data *data) | 491 tcs_wrap_Delegate_VerifyDelegation(struct tcsd_thread_data *data) |
| 493 { | 492 { |
| 494 TCS_CONTEXT_HANDLE hContext; | 493 TCS_CONTEXT_HANDLE hContext; |
| 495 UINT32 delegateSize; | 494 UINT32 delegateSize; |
| 496 BYTE *delegate; | 495 BYTE *delegate; |
| 497 TSS_RESULT result; | 496 TSS_RESULT result; |
| 498 | 497 |
| 499 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) | 498 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) |
| 500 return TCSERR(TSS_E_INTERNAL_ERROR); | 499 return TCSERR(TSS_E_INTERNAL_ERROR); |
| 501 | 500 |
| 502 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); | 501 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext); |
| 503 | 502 |
| 504 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &delegateSize, 0, &data->comm)) | 503 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &delegateSize, 0, &data->comm)) |
| 505 return TCSERR(TSS_E_INTERNAL_ERROR); | 504 return TCSERR(TSS_E_INTERNAL_ERROR); |
| 506 | 505 |
| 507 delegate = malloc(delegateSize); | 506 delegate = malloc(delegateSize); |
| 508 if (delegate == NULL) { | 507 if (delegate == NULL) { |
| 509 LogError("malloc of %u bytes failed.", delegateSize); | 508 LogError("malloc of %u bytes failed.", delegateSize); |
| 510 return TCSERR(TSS_E_OUTOFMEMORY); | 509 return TCSERR(TSS_E_OUTOFMEMORY); |
| 511 } | 510 } |
| 512 if (getData(TCSD_PACKET_TYPE_PBYTE, 2, delegate, delegateSize, &data->co
mm)) { | 511 if (getData(TCSD_PACKET_TYPE_PBYTE, 2, delegate, delegateSize, &data->co
mm)) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 536 TCS_KEY_HANDLE keyHandle; | 535 TCS_KEY_HANDLE keyHandle; |
| 537 TPM_NONCE nonceOddDSAP, nonceEven, nonceEvenDSAP; | 536 TPM_NONCE nonceOddDSAP, nonceEven, nonceEvenDSAP; |
| 538 UINT32 entityValueSize; | 537 UINT32 entityValueSize; |
| 539 BYTE *entityValue; | 538 BYTE *entityValue; |
| 540 TCS_AUTHHANDLE authHandle; | 539 TCS_AUTHHANDLE authHandle; |
| 541 TSS_RESULT result; | 540 TSS_RESULT result; |
| 542 | 541 |
| 543 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) | 542 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) |
| 544 return TCSERR(TSS_E_INTERNAL_ERROR); | 543 return TCSERR(TSS_E_INTERNAL_ERROR); |
| 545 | 544 |
| 546 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); | 545 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext); |
| 547 | 546 |
| 548 if (getData(TCSD_PACKET_TYPE_UINT16, 1, &entityType, 0, &data->comm)) | 547 if (getData(TCSD_PACKET_TYPE_UINT16, 1, &entityType, 0, &data->comm)) |
| 549 return TCSERR(TSS_E_INTERNAL_ERROR); | 548 return TCSERR(TSS_E_INTERNAL_ERROR); |
| 550 if (getData(TCSD_PACKET_TYPE_UINT32, 2, &keyHandle, 0, &data->comm)) | 549 if (getData(TCSD_PACKET_TYPE_UINT32, 2, &keyHandle, 0, &data->comm)) |
| 551 return TCSERR(TSS_E_INTERNAL_ERROR); | 550 return TCSERR(TSS_E_INTERNAL_ERROR); |
| 552 if (getData(TCSD_PACKET_TYPE_NONCE, 3, &nonceOddDSAP, 0, &data->comm)) | 551 if (getData(TCSD_PACKET_TYPE_NONCE, 3, &nonceOddDSAP, 0, &data->comm)) |
| 553 return TCSERR(TSS_E_INTERNAL_ERROR); | 552 return TCSERR(TSS_E_INTERNAL_ERROR); |
| 554 if (getData(TCSD_PACKET_TYPE_UINT32, 4, &entityValueSize, 0, &data->comm
)) | 553 if (getData(TCSD_PACKET_TYPE_UINT32, 4, &entityValueSize, 0, &data->comm
)) |
| 555 return TCSERR(TSS_E_INTERNAL_ERROR); | 554 return TCSERR(TSS_E_INTERNAL_ERROR); |
| 556 | 555 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 582 if (setData(TCSD_PACKET_TYPE_NONCE, 2, &nonceEvenDSAP, 0, &data-
>comm)) | 581 if (setData(TCSD_PACKET_TYPE_NONCE, 2, &nonceEvenDSAP, 0, &data-
>comm)) |
| 583 return TCSERR(TSS_E_INTERNAL_ERROR); | 582 return TCSERR(TSS_E_INTERNAL_ERROR); |
| 584 } else | 583 } else |
| 585 initData(&data->comm, 0); | 584 initData(&data->comm, 0); |
| 586 | 585 |
| 587 data->comm.hdr.u.result = result; | 586 data->comm.hdr.u.result = result; |
| 588 | 587 |
| 589 return TSS_SUCCESS; | 588 return TSS_SUCCESS; |
| 590 } | 589 } |
| 591 | 590 |
| OLD | NEW |