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 21 matching lines...) Expand all Loading... |
32 { | 32 { |
33 TCS_CONTEXT_HANDLE hContext; | 33 TCS_CONTEXT_HANDLE hContext; |
34 UINT32 pcrIndex; | 34 UINT32 pcrIndex; |
35 TCPA_DIGEST inDigest; | 35 TCPA_DIGEST inDigest; |
36 TSS_RESULT result; | 36 TSS_RESULT result; |
37 TCPA_DIGEST outDigest; | 37 TCPA_DIGEST outDigest; |
38 | 38 |
39 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) | 39 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) |
40 return TCSERR(TSS_E_INTERNAL_ERROR); | 40 return TCSERR(TSS_E_INTERNAL_ERROR); |
41 | 41 |
42 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); | 42 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext); |
43 | 43 |
44 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &pcrIndex, 0, &data->comm)) | 44 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &pcrIndex, 0, &data->comm)) |
45 return TCSERR(TSS_E_INTERNAL_ERROR); | 45 return TCSERR(TSS_E_INTERNAL_ERROR); |
46 if (getData(TCSD_PACKET_TYPE_DIGEST, 2, &inDigest, 0, &data->comm)) | 46 if (getData(TCSD_PACKET_TYPE_DIGEST, 2, &inDigest, 0, &data->comm)) |
47 return TCSERR(TSS_E_INTERNAL_ERROR); | 47 return TCSERR(TSS_E_INTERNAL_ERROR); |
48 | 48 |
49 MUTEX_LOCK(tcsp_lock); | 49 MUTEX_LOCK(tcsp_lock); |
50 | 50 |
51 result = TCSP_Extend_Internal(hContext, pcrIndex, inDigest, &outDigest); | 51 result = TCSP_Extend_Internal(hContext, pcrIndex, inDigest, &outDigest); |
52 | 52 |
(...skipping 15 matching lines...) Expand all Loading... |
68 tcs_wrap_PcrRead(struct tcsd_thread_data *data) | 68 tcs_wrap_PcrRead(struct tcsd_thread_data *data) |
69 { | 69 { |
70 TCS_CONTEXT_HANDLE hContext; | 70 TCS_CONTEXT_HANDLE hContext; |
71 UINT32 pcrIndex; | 71 UINT32 pcrIndex; |
72 TCPA_DIGEST digest; | 72 TCPA_DIGEST digest; |
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, &pcrIndex, 0, &data->comm)) | 80 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &pcrIndex, 0, &data->comm)) |
81 return TCSERR(TSS_E_INTERNAL_ERROR); | 81 return TCSERR(TSS_E_INTERNAL_ERROR); |
82 | 82 |
83 MUTEX_LOCK(tcsp_lock); | 83 MUTEX_LOCK(tcsp_lock); |
84 | 84 |
85 result = TCSP_PcrRead_Internal(hContext, pcrIndex, &digest); | 85 result = TCSP_PcrRead_Internal(hContext, pcrIndex, &digest); |
86 | 86 |
87 MUTEX_UNLOCK(tcsp_lock); | 87 MUTEX_UNLOCK(tcsp_lock); |
88 | 88 |
(...skipping 13 matching lines...) Expand all Loading... |
102 tcs_wrap_PcrReset(struct tcsd_thread_data *data) | 102 tcs_wrap_PcrReset(struct tcsd_thread_data *data) |
103 { | 103 { |
104 TCS_CONTEXT_HANDLE hContext; | 104 TCS_CONTEXT_HANDLE hContext; |
105 UINT32 pcrDataSizeIn; | 105 UINT32 pcrDataSizeIn; |
106 BYTE *pcrDataIn; | 106 BYTE *pcrDataIn; |
107 TSS_RESULT result; | 107 TSS_RESULT result; |
108 | 108 |
109 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) | 109 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) |
110 return TCSERR(TSS_E_INTERNAL_ERROR); | 110 return TCSERR(TSS_E_INTERNAL_ERROR); |
111 | 111 |
112 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); | 112 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext); |
113 | 113 |
114 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &pcrDataSizeIn, 0, &data->comm)) | 114 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &pcrDataSizeIn, 0, &data->comm)) |
115 return TCSERR(TSS_E_INTERNAL_ERROR); | 115 return TCSERR(TSS_E_INTERNAL_ERROR); |
116 | 116 |
117 pcrDataIn = (BYTE *)malloc(pcrDataSizeIn); | 117 pcrDataIn = (BYTE *)malloc(pcrDataSizeIn); |
118 if (pcrDataIn == NULL) { | 118 if (pcrDataIn == NULL) { |
119 LogError("malloc of %u bytes failed.", pcrDataSizeIn); | 119 LogError("malloc of %u bytes failed.", pcrDataSizeIn); |
120 return TCSERR(TSS_E_OUTOFMEMORY); | 120 return TCSERR(TSS_E_OUTOFMEMORY); |
121 } | 121 } |
122 if (getData(TCSD_PACKET_TYPE_PBYTE, 2, pcrDataIn, pcrDataSizeIn, &data->
comm)) { | 122 if (getData(TCSD_PACKET_TYPE_PBYTE, 2, pcrDataIn, pcrDataSizeIn, &data->
comm)) { |
123 free(pcrDataIn); | 123 free(pcrDataIn); |
124 return TCSERR(TSS_E_INTERNAL_ERROR); | 124 return TCSERR(TSS_E_INTERNAL_ERROR); |
125 } | 125 } |
126 | 126 |
127 MUTEX_LOCK(tcsp_lock); | 127 MUTEX_LOCK(tcsp_lock); |
128 | 128 |
129 result = TCSP_PcrReset_Internal(hContext, pcrDataSizeIn, pcrDataIn); | 129 result = TCSP_PcrReset_Internal(hContext, pcrDataSizeIn, pcrDataIn); |
130 | 130 |
131 MUTEX_UNLOCK(tcsp_lock); | 131 MUTEX_UNLOCK(tcsp_lock); |
132 free(pcrDataIn); | 132 free(pcrDataIn); |
133 | 133 |
134 initData(&data->comm, 0); | 134 initData(&data->comm, 0); |
135 data->comm.hdr.u.result = result; | 135 data->comm.hdr.u.result = result; |
136 | 136 |
137 return result; | 137 return result; |
138 } | 138 } |
139 | 139 |
OLD | NEW |