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 18 matching lines...) Expand all Loading... |
29 | 29 |
30 TSS_RESULT | 30 TSS_RESULT |
31 tcs_wrap_SelfTestFull(struct tcsd_thread_data *data) | 31 tcs_wrap_SelfTestFull(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 | 35 |
36 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) | 36 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) |
37 return TCSERR(TSS_E_INTERNAL_ERROR); | 37 return TCSERR(TSS_E_INTERNAL_ERROR); |
38 | 38 |
39 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); | 39 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext); |
40 | 40 |
41 MUTEX_LOCK(tcsp_lock); | 41 MUTEX_LOCK(tcsp_lock); |
42 | 42 |
43 result = TCSP_SelfTestFull_Internal(hContext); | 43 result = TCSP_SelfTestFull_Internal(hContext); |
44 | 44 |
45 MUTEX_UNLOCK(tcsp_lock); | 45 MUTEX_UNLOCK(tcsp_lock); |
46 | 46 |
47 initData(&data->comm, 0); | 47 initData(&data->comm, 0); |
48 data->comm.hdr.u.result = result; | 48 data->comm.hdr.u.result = result; |
49 | 49 |
50 return TSS_SUCCESS; | 50 return TSS_SUCCESS; |
51 } | 51 } |
52 | 52 |
53 TSS_RESULT | 53 TSS_RESULT |
54 tcs_wrap_CertifySelfTest(struct tcsd_thread_data *data) | 54 tcs_wrap_CertifySelfTest(struct tcsd_thread_data *data) |
55 { | 55 { |
56 TCS_CONTEXT_HANDLE hContext; | 56 TCS_CONTEXT_HANDLE hContext; |
57 TSS_RESULT result; | 57 TSS_RESULT result; |
58 UINT32 sigSize; | 58 UINT32 sigSize; |
59 BYTE *sigData = NULL; | 59 BYTE *sigData = NULL; |
60 TCS_KEY_HANDLE hKey; | 60 TCS_KEY_HANDLE hKey; |
61 TCPA_NONCE antiReplay; | 61 TCPA_NONCE antiReplay; |
62 TPM_AUTH privAuth; | 62 TPM_AUTH privAuth; |
63 TPM_AUTH *pPrivAuth; | 63 TPM_AUTH *pPrivAuth; |
64 int i; | 64 int i; |
65 | 65 |
66 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) | 66 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) |
67 return TCSERR(TSS_E_INTERNAL_ERROR); | 67 return TCSERR(TSS_E_INTERNAL_ERROR); |
68 | 68 |
69 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); | 69 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext); |
70 | 70 |
71 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &hKey, 0, &data->comm)) | 71 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &hKey, 0, &data->comm)) |
72 return TCSERR(TSS_E_INTERNAL_ERROR); | 72 return TCSERR(TSS_E_INTERNAL_ERROR); |
73 if (getData(TCSD_PACKET_TYPE_NONCE, 2, &antiReplay, 0, &data->comm)) | 73 if (getData(TCSD_PACKET_TYPE_NONCE, 2, &antiReplay, 0, &data->comm)) |
74 return TCSERR(TSS_E_INTERNAL_ERROR); | 74 return TCSERR(TSS_E_INTERNAL_ERROR); |
75 | 75 |
76 result = getData(TCSD_PACKET_TYPE_AUTH, 3, &privAuth, 0, &data->comm); | 76 result = getData(TCSD_PACKET_TYPE_AUTH, 3, &privAuth, 0, &data->comm); |
77 if (result == TSS_TCP_RPC_BAD_PACKET_TYPE) | 77 if (result == TSS_TCP_RPC_BAD_PACKET_TYPE) |
78 pPrivAuth = NULL; | 78 pPrivAuth = NULL; |
79 else if (result) | 79 else if (result) |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 tcs_wrap_GetTestResult(struct tcsd_thread_data *data) | 119 tcs_wrap_GetTestResult(struct tcsd_thread_data *data) |
120 { | 120 { |
121 TCS_CONTEXT_HANDLE hContext; | 121 TCS_CONTEXT_HANDLE hContext; |
122 TSS_RESULT result; | 122 TSS_RESULT result; |
123 UINT32 resultDataSize; | 123 UINT32 resultDataSize; |
124 BYTE *resultData = NULL; | 124 BYTE *resultData = NULL; |
125 | 125 |
126 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) | 126 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) |
127 return TCSERR(TSS_E_INTERNAL_ERROR); | 127 return TCSERR(TSS_E_INTERNAL_ERROR); |
128 | 128 |
129 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); | 129 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext); |
130 | 130 |
131 MUTEX_LOCK(tcsp_lock); | 131 MUTEX_LOCK(tcsp_lock); |
132 | 132 |
133 result = TCSP_GetTestResult_Internal(hContext, &resultDataSize, &resultD
ata); | 133 result = TCSP_GetTestResult_Internal(hContext, &resultDataSize, &resultD
ata); |
134 | 134 |
135 MUTEX_UNLOCK(tcsp_lock); | 135 MUTEX_UNLOCK(tcsp_lock); |
136 | 136 |
137 if (result == TSS_SUCCESS) { | 137 if (result == TSS_SUCCESS) { |
138 initData(&data->comm, 2); | 138 initData(&data->comm, 2); |
139 if (setData(TCSD_PACKET_TYPE_UINT32, 0, &resultDataSize, 0, &dat
a->comm)) { | 139 if (setData(TCSD_PACKET_TYPE_UINT32, 0, &resultDataSize, 0, &dat
a->comm)) { |
140 free(resultData); | 140 free(resultData); |
141 return TCSERR(TSS_E_INTERNAL_ERROR); | 141 return TCSERR(TSS_E_INTERNAL_ERROR); |
142 } | 142 } |
143 if (setData(TCSD_PACKET_TYPE_PBYTE, 1, resultData, resultDataSiz
e, &data->comm)) { | 143 if (setData(TCSD_PACKET_TYPE_PBYTE, 1, resultData, resultDataSiz
e, &data->comm)) { |
144 free(resultData); | 144 free(resultData); |
145 return TCSERR(TSS_E_INTERNAL_ERROR); | 145 return TCSERR(TSS_E_INTERNAL_ERROR); |
146 } | 146 } |
147 free(resultData); | 147 free(resultData); |
148 } else | 148 } else |
149 initData(&data->comm, 0); | 149 initData(&data->comm, 0); |
150 | 150 |
151 | 151 |
152 data->comm.hdr.u.result = result; | 152 data->comm.hdr.u.result = result; |
153 return TSS_SUCCESS; | 153 return TSS_SUCCESS; |
154 } | 154 } |
OLD | NEW |