1 --- src/tcs/rpc/tcstp/rpc.c.orig Fri Jun 5 12:45:50 2009 |
|
2 +++ src/tcs/rpc/tcstp/rpc.c Thu Sep 10 13:05:33 2009 |
|
3 @@ -385,134 +385,134 @@ |
|
4 typedef struct tdDispatchTable { |
|
5 TSS_RESULT (*Func) (struct tcsd_thread_data *); |
|
6 const char *name; |
|
7 + UINT32 ordinal; |
|
8 } DispatchTable; |
|
9 |
|
10 DispatchTable tcs_func_table[TCSD_MAX_NUM_ORDS] = { |
|
11 - {tcs_wrap_Error,"Error"}, /* 0 */ |
|
12 - {tcs_wrap_OpenContext,"OpenContext"}, |
|
13 - {tcs_wrap_CloseContext,"CloseContext"}, |
|
14 - {tcs_wrap_Error,"Error"}, |
|
15 - {tcs_wrap_TCSGetCapability,"TCSGetCapability"}, |
|
16 - {tcs_wrap_RegisterKey,"RegisterKey"}, /* 5 */ |
|
17 - {tcs_wrap_UnregisterKey,"UnregisterKey"}, |
|
18 - {tcs_wrap_EnumRegisteredKeys,"EnumRegisteredKeys"}, |
|
19 - {tcs_wrap_Error,"Error"}, |
|
20 - {tcs_wrap_GetRegisteredKeyBlob,"GetRegisteredKeyBlob"}, |
|
21 - {tcs_wrap_GetRegisteredKeyByPublicInfo,"GetRegisteredKeyByPublicInfo"}, /* 10 */ |
|
22 - {tcs_wrap_LoadKeyByBlob,"LoadKeyByBlob"}, |
|
23 - {tcs_wrap_LoadKeyByUUID,"LoadKeyByUUID"}, |
|
24 - {tcs_wrap_EvictKey,"EvictKey"}, |
|
25 - {tcs_wrap_CreateWrapKey,"CreateWrapKey"}, |
|
26 - {tcs_wrap_GetPubkey,"GetPubkey"}, /* 15 */ |
|
27 - {tcs_wrap_MakeIdentity,"MakeIdentity"}, |
|
28 - {tcs_wrap_LogPcrEvent,"LogPcrEvent"}, |
|
29 - {tcs_wrap_GetPcrEvent,"GetPcrEvent"}, |
|
30 - {tcs_wrap_GetPcrEventsByPcr,"GetPcrEventsByPcr"}, |
|
31 - {tcs_wrap_GetPcrEventLog,"GetPcrEventLog"}, /* 20 */ |
|
32 - {tcs_wrap_SetOwnerInstall,"SetOwnerInstall"}, |
|
33 - {tcs_wrap_TakeOwnership,"TakeOwnership"}, |
|
34 - {tcs_wrap_OIAP,"OIAP"}, |
|
35 - {tcs_wrap_OSAP,"OSAP"}, |
|
36 - {tcs_wrap_ChangeAuth,"ChangeAuth"}, /* 25 */ |
|
37 - {tcs_wrap_ChangeAuthOwner,"ChangeAuthOwner"}, |
|
38 - {tcs_wrap_Error,"Error"}, |
|
39 - {tcs_wrap_Error,"Error"}, |
|
40 - {tcs_wrap_TerminateHandle,"TerminateHandle"}, |
|
41 - {tcs_wrap_ActivateIdentity,"ActivateIdentity"}, /* 30 */ |
|
42 - {tcs_wrap_Extend,"Extend"}, |
|
43 - {tcs_wrap_PcrRead,"PcrRead"}, |
|
44 - {tcs_wrap_Quote,"Quote"}, |
|
45 - {tcs_wrap_DirWriteAuth,"DirWriteAuth"}, |
|
46 - {tcs_wrap_DirRead,"DirRead"}, /* 35 */ |
|
47 - {tcs_wrap_Seal,"Seal"}, |
|
48 - {tcs_wrap_UnSeal,"UnSeal"}, |
|
49 - {tcs_wrap_UnBind,"UnBind"}, |
|
50 - {tcs_wrap_CreateMigrationBlob,"CreateMigrationBlob"}, |
|
51 - {tcs_wrap_ConvertMigrationBlob,"ConvertMigrationBlob"}, /* 40 */ |
|
52 - {tcs_wrap_AuthorizeMigrationKey,"AuthorizeMigrationKey"}, |
|
53 - {tcs_wrap_CertifyKey,"CertifyKey"}, |
|
54 - {tcs_wrap_Sign,"Sign"}, |
|
55 - {tcs_wrap_GetRandom,"GetRandom"}, |
|
56 - {tcs_wrap_StirRandom,"StirRandom"}, /* 45 */ |
|
57 - {tcs_wrap_GetCapability,"GetCapability"}, |
|
58 - {tcs_wrap_Error,"Error"}, |
|
59 - {tcs_wrap_GetCapabilityOwner,"GetCapabilityOwner"}, |
|
60 - {tcs_wrap_CreateEndorsementKeyPair,"CreateEndorsementKeyPair"}, |
|
61 - {tcs_wrap_ReadPubek,"ReadPubek"}, /* 50 */ |
|
62 - {tcs_wrap_DisablePubekRead,"DisablePubekRead"}, |
|
63 - {tcs_wrap_OwnerReadPubek,"OwnerReadPubek"}, |
|
64 - {tcs_wrap_SelfTestFull,"SelfTestFull"}, |
|
65 - {tcs_wrap_CertifySelfTest,"CertifySelfTest"}, |
|
66 - {tcs_wrap_Error,"Error"}, /* 55 */ |
|
67 - {tcs_wrap_GetTestResult,"GetTestResult"}, |
|
68 - {tcs_wrap_OwnerSetDisable,"OwnerSetDisable"}, |
|
69 - {tcs_wrap_OwnerClear,"OwnerClear"}, |
|
70 - {tcs_wrap_DisableOwnerClear,"DisableOwnerClear"}, |
|
71 - {tcs_wrap_ForceClear,"ForceClear"}, /* 60 */ |
|
72 - {tcs_wrap_DisableForceClear,"DisableForceClear"}, |
|
73 - {tcs_wrap_PhysicalDisable,"PhysicalDisable"}, |
|
74 - {tcs_wrap_PhysicalEnable,"PhysicalEnable"}, |
|
75 - {tcs_wrap_PhysicalSetDeactivated,"PhysicalSetDeactivated"}, |
|
76 - {tcs_wrap_SetTempDeactivated,"SetTempDeactivated"}, /* 65 */ |
|
77 - {tcs_wrap_PhysicalPresence,"PhysicalPresence"}, |
|
78 - {tcs_wrap_Error,"Error"}, |
|
79 - {tcs_wrap_Error,"Error"}, |
|
80 - {tcs_wrap_CreateMaintenanceArchive,"CreateMaintenanceArchive"}, |
|
81 - {tcs_wrap_LoadMaintenanceArchive,"LoadMaintenanceArchive"}, /* 70 */ |
|
82 - {tcs_wrap_KillMaintenanceFeature,"KillMaintenanceFeature"}, |
|
83 - {tcs_wrap_LoadManuMaintPub,"LoadManuMaintPub"}, |
|
84 - {tcs_wrap_ReadManuMaintPub,"ReadManuMaintPub"}, |
|
85 - {tcs_wrap_DaaJoin,"DaaJoin"}, |
|
86 - {tcs_wrap_DaaSign,"DaaSign"}, /* 75 */ |
|
87 - {tcs_wrap_SetCapability,"SetCapability"}, |
|
88 - {tcs_wrap_ResetLockValue,"ResetLockValue"}, |
|
89 - {tcs_wrap_PcrReset,"PcrReset"}, |
|
90 - {tcs_wrap_ReadCounter,"ReadCounter"}, |
|
91 - {tcs_wrap_CreateCounter,"CreateCounter"}, /* 80 */ |
|
92 - {tcs_wrap_IncrementCounter,"IncrementCounter"}, |
|
93 - {tcs_wrap_ReleaseCounter,"ReleaseCounter"}, |
|
94 - {tcs_wrap_ReleaseCounterOwner,"ReleaseCounterOwner"}, |
|
95 - {tcs_wrap_ReadCurrentTicks,"ReadCurrentTicks"}, |
|
96 - {tcs_wrap_TickStampBlob,"TicksStampBlob"}, /* 85 */ |
|
97 - {tcs_wrap_GetCredential,"GetCredential"}, |
|
98 - {tcs_wrap_NV_DefineOrReleaseSpace,"NVDefineOrReleaseSpace"}, |
|
99 - {tcs_wrap_NV_WriteValue,"NVWriteValue"}, |
|
100 - {tcs_wrap_NV_WriteValueAuth,"NVWriteValueAuth"}, |
|
101 - {tcs_wrap_NV_ReadValue,"NVReadValue"}, /* 90 */ |
|
102 - {tcs_wrap_NV_ReadValueAuth,"NVReadValueAuth"}, |
|
103 - {tcs_wrap_EstablishTransport,"EstablishTransport"}, |
|
104 - {tcs_wrap_ExecuteTransport,"ExecuteTransport"}, |
|
105 - {tcs_wrap_ReleaseTransportSigned,"ReleaseTransportSigned"}, |
|
106 - {tcs_wrap_SetOrdinalAuditStatus,"SetOrdinalAuditStatus"}, /* 95 */ |
|
107 - {tcs_wrap_GetAuditDigest,"GetAuditDigest"}, |
|
108 - {tcs_wrap_GetAuditDigestSigned,"GetAuditDigestSigned"}, |
|
109 - {tcs_wrap_Sealx,"Sealx"}, |
|
110 - {tcs_wrap_SetOperatorAuth,"SetOperatorAuth"}, |
|
111 - {tcs_wrap_OwnerReadInternalPub,"OwnerReadInternalPub"}, /* 100 */ |
|
112 - {tcs_wrap_EnumRegisteredKeys2,"EnumRegisteredKeys2"}, |
|
113 - {tcs_wrap_SetTempDeactivated2,"SetTempDeactivated2"}, |
|
114 - {tcs_wrap_Delegate_Manage,"Delegate_Manage"}, |
|
115 - {tcs_wrap_Delegate_CreateKeyDelegation,"Delegate_CreateKeyDelegation"}, |
|
116 - {tcs_wrap_Delegate_CreateOwnerDelegation,"Delegate_CreateOwnerDelegation"}, /* 105 */ |
|
117 - {tcs_wrap_Delegate_LoadOwnerDelegation,"Delegate_LoadOwnerDelegation"}, |
|
118 - {tcs_wrap_Delegate_ReadTable,"Delegate_ReadTable"}, |
|
119 - {tcs_wrap_Delegate_UpdateVerificationCount,"Delegate_UpdateVerificationCount"}, |
|
120 - {tcs_wrap_Delegate_VerifyDelegation,"Delegate_VerifyDelegation"}, |
|
121 - {tcs_wrap_CreateRevocableEndorsementKeyPair,"CreateRevocableEndorsementKeyPair"}, /* 110 */ |
|
122 - {tcs_wrap_RevokeEndorsementKeyPair,"RevokeEndorsementKeyPair"}, |
|
123 - {tcs_wrap_Error,"Error - was MakeIdentity2"}, |
|
124 - {tcs_wrap_Quote2,"Quote2"}, |
|
125 - {tcs_wrap_CMK_SetRestrictions,"CMK_SetRestrictions"}, |
|
126 - {tcs_wrap_CMK_ApproveMA,"CMK_ApproveMA"}, /* 115 */ |
|
127 - {tcs_wrap_CMK_CreateKey,"CMK_CreateKey"}, |
|
128 - {tcs_wrap_CMK_CreateTicket,"CMK_CreateTicket"}, |
|
129 - {tcs_wrap_CMK_CreateBlob,"CMK_CreateBlob"}, |
|
130 - {tcs_wrap_CMK_ConvertMigration,"CMK_ConvertMigration"}, |
|
131 - {tcs_wrap_FlushSpecific,"FlushSpecific"}, /* 120 */ |
|
132 - {tcs_wrap_KeyControlOwner, "KeyControlOwner"}, |
|
133 - {tcs_wrap_DSAP, "DSAP"} |
|
134 -}; |
|
135 - |
|
136 + {tcs_wrap_Error,"Error", 0}, /* 0 */ |
|
137 + {tcs_wrap_OpenContext,"OpenContext", 0}, |
|
138 + {tcs_wrap_CloseContext,"CloseContext", 0}, |
|
139 + {tcs_wrap_Error,"Error", 0}, |
|
140 + {tcs_wrap_TCSGetCapability,"TCSGetCapability", 0}, |
|
141 + {tcs_wrap_RegisterKey,"RegisterKey", 0}, /* 5 */ |
|
142 + {tcs_wrap_UnregisterKey,"UnregisterKey", 0}, |
|
143 + {tcs_wrap_EnumRegisteredKeys,"EnumRegisteredKeys", 0}, |
|
144 + {tcs_wrap_Error,"Error", 0}, |
|
145 + {tcs_wrap_GetRegisteredKeyBlob,"GetRegisteredKeyBlob", 0}, |
|
146 + {tcs_wrap_GetRegisteredKeyByPublicInfo,"GetRegisteredKeyByPublicInfo", 0}, /* 10 */ |
|
147 + {tcs_wrap_LoadKeyByBlob,"LoadKeyByBlob", 0}, |
|
148 + {tcs_wrap_LoadKeyByUUID,"LoadKeyByUUID", 0}, |
|
149 + {tcs_wrap_EvictKey,"EvictKey", 0}, |
|
150 + {tcs_wrap_CreateWrapKey,"CreateWrapKey", 0}, |
|
151 + {tcs_wrap_GetPubkey,"GetPubkey", 0}, /* 15 */ |
|
152 + {tcs_wrap_MakeIdentity,"MakeIdentity", 0}, |
|
153 + {tcs_wrap_LogPcrEvent,"LogPcrEvent", 0}, |
|
154 + {tcs_wrap_GetPcrEvent,"GetPcrEvent", 0}, |
|
155 + {tcs_wrap_GetPcrEventsByPcr,"GetPcrEventsByPcr", 0}, |
|
156 + {tcs_wrap_GetPcrEventLog,"GetPcrEventLog", 0}, /* 20 */ |
|
157 + {tcs_wrap_SetOwnerInstall,"SetOwnerInstall", TPM_ORD_SetOwnerInstall}, |
|
158 + {tcs_wrap_TakeOwnership,"TakeOwnership", TPM_ORD_TakeOwnership}, |
|
159 + {tcs_wrap_OIAP,"OIAP", 0}, |
|
160 + {tcs_wrap_OSAP,"OSAP", 0}, |
|
161 + {tcs_wrap_ChangeAuth,"ChangeAuth", 0}, /* 25 */ |
|
162 + {tcs_wrap_ChangeAuthOwner,"ChangeAuthOwner", 0}, |
|
163 + {tcs_wrap_Error,"Error", 0}, |
|
164 + {tcs_wrap_Error,"Error", 0}, |
|
165 + {tcs_wrap_TerminateHandle,"TerminateHandle", 0}, |
|
166 + {tcs_wrap_ActivateIdentity,"ActivateIdentity", 0}, /* 30 */ |
|
167 + {tcs_wrap_Extend,"Extend", 0}, |
|
168 + {tcs_wrap_PcrRead,"PcrRead", 0}, |
|
169 + {tcs_wrap_Quote,"Quote", 0}, |
|
170 + {tcs_wrap_DirWriteAuth,"DirWriteAuth", 0}, |
|
171 + {tcs_wrap_DirRead,"DirRead", 0}, /* 35 */ |
|
172 + {tcs_wrap_Seal,"Seal", 0}, |
|
173 + {tcs_wrap_UnSeal,"UnSeal", 0}, |
|
174 + {tcs_wrap_UnBind,"UnBind", 0}, |
|
175 + {tcs_wrap_CreateMigrationBlob,"CreateMigrationBlob", 0}, |
|
176 + {tcs_wrap_ConvertMigrationBlob,"ConvertMigrationBlob", 0}, /* 40 */ |
|
177 + {tcs_wrap_AuthorizeMigrationKey,"AuthorizeMigrationKey", 0}, |
|
178 + {tcs_wrap_CertifyKey,"CertifyKey", 0}, |
|
179 + {tcs_wrap_Sign,"Sign", 0}, |
|
180 + {tcs_wrap_GetRandom,"GetRandom", 0}, |
|
181 + {tcs_wrap_StirRandom,"StirRandom", 0}, /* 45 */ |
|
182 + {tcs_wrap_GetCapability,"GetCapability", 0}, |
|
183 + {tcs_wrap_Error,"Error", 0}, |
|
184 + {tcs_wrap_GetCapabilityOwner,"GetCapabilityOwner", 0}, |
|
185 + {tcs_wrap_CreateEndorsementKeyPair,"CreateEndorsementKeyPair", 0}, |
|
186 + {tcs_wrap_ReadPubek,"ReadPubek", 0}, /* 50 */ |
|
187 + {tcs_wrap_DisablePubekRead,"DisablePubekRead", 0}, |
|
188 + {tcs_wrap_OwnerReadPubek,"OwnerReadPubek", 0}, |
|
189 + {tcs_wrap_SelfTestFull,"SelfTestFull", TPM_ORD_SelfTestFull}, |
|
190 + {tcs_wrap_CertifySelfTest,"CertifySelfTest", TPM_ORD_CertifySelfTest}, |
|
191 + {tcs_wrap_Error,"Error", 0}, /* 55 */ |
|
192 + {tcs_wrap_GetTestResult,"GetTestResult", 0}, |
|
193 + {tcs_wrap_OwnerSetDisable,"OwnerSetDisable", TPM_ORD_OwnerSetDisable}, |
|
194 + {tcs_wrap_OwnerClear,"OwnerClear", TPM_ORD_OwnerClear}, |
|
195 + {tcs_wrap_DisableOwnerClear,"DisableOwnerClear", TPM_ORD_DisableOwnerClear}, |
|
196 + {tcs_wrap_ForceClear,"ForceClear", TPM_ORD_ForceClear}, /* 60 */ |
|
197 + {tcs_wrap_DisableForceClear,"DisableForceClear", TPM_ORD_DisableForceClear}, |
|
198 + {tcs_wrap_PhysicalDisable,"PhysicalDisable", TPM_ORD_PhysicalDisable}, |
|
199 + {tcs_wrap_PhysicalEnable,"PhysicalEnable", TPM_ORD_PhysicalEnable}, |
|
200 + {tcs_wrap_PhysicalSetDeactivated,"PhysicalSetDeactivated", TPM_ORD_PhysicalSetDeactivated}, |
|
201 + {tcs_wrap_SetTempDeactivated,"SetTempDeactivated", TPM_ORD_SetTempDeactivated}, /* 65 */ |
|
202 + {tcs_wrap_PhysicalPresence,"PhysicalPresence", TSC_ORD_PhysicalPresence}, |
|
203 + {tcs_wrap_Error,"Error", 0}, |
|
204 + {tcs_wrap_Error,"Error", 0}, |
|
205 + {tcs_wrap_CreateMaintenanceArchive,"CreateMaintenanceArchive", 0}, |
|
206 + {tcs_wrap_LoadMaintenanceArchive,"LoadMaintenanceArchive", 0}, /* 70 */ |
|
207 + {tcs_wrap_KillMaintenanceFeature,"KillMaintenanceFeature", 0}, |
|
208 + {tcs_wrap_LoadManuMaintPub,"LoadManuMaintPub", 0}, |
|
209 + {tcs_wrap_ReadManuMaintPub,"ReadManuMaintPub", 0}, |
|
210 + {tcs_wrap_DaaJoin,"DaaJoin", 0}, |
|
211 + {tcs_wrap_DaaSign,"DaaSign", 0}, /* 75 */ |
|
212 + {tcs_wrap_SetCapability,"SetCapability", 0}, |
|
213 + {tcs_wrap_ResetLockValue,"ResetLockValue", TPM_ORD_ResetLockValue}, |
|
214 + {tcs_wrap_PcrReset,"PcrReset", 0}, |
|
215 + {tcs_wrap_ReadCounter,"ReadCounter", 0}, |
|
216 + {tcs_wrap_CreateCounter,"CreateCounter", 0}, /* 80 */ |
|
217 + {tcs_wrap_IncrementCounter,"IncrementCounter", 0}, |
|
218 + {tcs_wrap_ReleaseCounter,"ReleaseCounter", 0}, |
|
219 + {tcs_wrap_ReleaseCounterOwner,"ReleaseCounterOwner", 0}, |
|
220 + {tcs_wrap_ReadCurrentTicks,"ReadCurrentTicks", 0}, |
|
221 + {tcs_wrap_TickStampBlob,"TicksStampBlob", 0}, /* 85 */ |
|
222 + {tcs_wrap_GetCredential,"GetCredential", 0}, |
|
223 + {tcs_wrap_NV_DefineOrReleaseSpace,"NVDefineOrReleaseSpace", 0}, |
|
224 + {tcs_wrap_NV_WriteValue,"NVWriteValue", 0}, |
|
225 + {tcs_wrap_NV_WriteValueAuth,"NVWriteValueAuth", 0}, |
|
226 + {tcs_wrap_NV_ReadValue,"NVReadValue", 0}, /* 90 */ |
|
227 + {tcs_wrap_NV_ReadValueAuth,"NVReadValueAuth", 0}, |
|
228 + {tcs_wrap_EstablishTransport,"EstablishTransport", 0}, |
|
229 + {tcs_wrap_ExecuteTransport,"ExecuteTransport", 0}, |
|
230 + {tcs_wrap_ReleaseTransportSigned,"ReleaseTransportSigned", 0}, |
|
231 + {tcs_wrap_SetOrdinalAuditStatus,"SetOrdinalAuditStatus", 0}, /* 95 */ |
|
232 + {tcs_wrap_GetAuditDigest,"GetAuditDigest", 0}, |
|
233 + {tcs_wrap_GetAuditDigestSigned,"GetAuditDigestSigned", 0}, |
|
234 + {tcs_wrap_Sealx,"Sealx", 0}, |
|
235 + {tcs_wrap_SetOperatorAuth,"SetOperatorAuth", TPM_ORD_SetOperatorAuth}, |
|
236 + {tcs_wrap_OwnerReadInternalPub,"OwnerReadInternalPub", 0}, /* 100 */ |
|
237 + {tcs_wrap_EnumRegisteredKeys2,"EnumRegisteredKeys2", 0}, |
|
238 + {tcs_wrap_SetTempDeactivated2,"SetTempDeactivated2", 0}, |
|
239 + {tcs_wrap_Delegate_Manage,"Delegate_Manage", 0}, |
|
240 + {tcs_wrap_Delegate_CreateKeyDelegation,"Delegate_CreateKeyDelegation", 0}, |
|
241 + {tcs_wrap_Delegate_CreateOwnerDelegation,"Delegate_CreateOwnerDelegation", 0}, /* 105 */ |
|
242 + {tcs_wrap_Delegate_LoadOwnerDelegation,"Delegate_LoadOwnerDelegation", 0}, |
|
243 + {tcs_wrap_Delegate_ReadTable,"Delegate_ReadTable", 0}, |
|
244 + {tcs_wrap_Delegate_UpdateVerificationCount,"Delegate_UpdateVerificationCount", 0}, |
|
245 + {tcs_wrap_Delegate_VerifyDelegation,"Delegate_VerifyDelegation", 0}, |
|
246 + {tcs_wrap_CreateRevocableEndorsementKeyPair,"CreateRevocableEndorsementKeyPair", 0}, /* 110 */ |
|
247 + {tcs_wrap_RevokeEndorsementKeyPair,"RevokeEndorsementKeyPair", 0}, |
|
248 + {tcs_wrap_Error,"Error - was MakeIdentity2", 0}, |
|
249 + {tcs_wrap_Quote2,"Quote2", 0}, |
|
250 + {tcs_wrap_CMK_SetRestrictions,"CMK_SetRestrictions", 0}, |
|
251 + {tcs_wrap_CMK_ApproveMA,"CMK_ApproveMA", 0}, /* 115 */ |
|
252 + {tcs_wrap_CMK_CreateKey,"CMK_CreateKey", 0}, |
|
253 + {tcs_wrap_CMK_CreateTicket,"CMK_CreateTicket", 0}, |
|
254 + {tcs_wrap_CMK_CreateBlob,"CMK_CreateBlob", 0}, |
|
255 + {tcs_wrap_CMK_ConvertMigration,"CMK_ConvertMigration", 0}, |
|
256 + {tcs_wrap_FlushSpecific,"FlushSpecific", 0}, /* 120 */ |
|
257 + {tcs_wrap_KeyControlOwner, "KeyControlOwner", 0}, |
|
258 + {tcs_wrap_DSAP, "DSAP", 0} |
|
259 + }; |
|
260 int |
|
261 access_control(struct tcsd_thread_data *thread_data) |
|
262 { |
|
263 @@ -562,11 +562,190 @@ |
|
264 return 1; |
|
265 } |
|
266 |
|
267 +#if defined (SOLARIS) |
|
268 + |
|
269 +#include <ucred.h> |
|
270 +#include <bsm/adt.h> |
|
271 +#include <bsm/adt_event.h> |
|
272 + |
|
273 +static void |
|
274 +audit_tpm(UINT32 cmd, struct tcsd_thread_data *data) |
|
275 +{ |
|
276 + adt_session_data_t *ah = NULL; |
|
277 + adt_event_data_t *event = NULL; |
|
278 + ucred_t *uc = NULL; |
|
279 + int adterr, msgid; |
|
280 + int adtstatus = ADT_FAILURE; |
|
281 + |
|
282 + if (getpeerucred(data->sock, &uc)) { |
|
283 + LogError("Audit Failed - getpeerucred failed (%s)", |
|
284 + strerror(errno)); |
|
285 + return; |
|
286 + } |
|
287 + if (adt_start_session(&ah, NULL, ADT_USE_PROC_DATA) != 0) { |
|
288 + LogError("Audit Failed - adt_start_session failed (%s)", |
|
289 + strerror(errno)); |
|
290 + goto end; |
|
291 + } |
|
292 + |
|
293 + if (adt_set_from_ucred(ah, uc, ADT_NEW) != 0) { |
|
294 + LogError("Audit Failed - adt_set_from_ucred failed (%s)", |
|
295 + strerror(errno)); |
|
296 + goto end; |
|
297 + } |
|
298 + |
|
299 + /* |
|
300 + * NOTE: It is important that the ordering of the |
|
301 + * error message definitions in the adt.xml IDL from the |
|
302 + * libbsm library source matches the numerical ordering of |
|
303 + * the TPM_E_* error codes in /usr/include/tss/tpm_error.h |
|
304 + */ |
|
305 + if (data->comm.hdr.u.result == TSS_SUCCESS) { |
|
306 + adtstatus = ADT_SUCCESS; |
|
307 + adterr = ADT_SUCCESS; |
|
308 + /* |
|
309 + * Use literal value here until the |
|
310 + * build system is updated with latest adt_event.h |
|
311 + * 4102 = ADT_TPM_E_NO_MSG (build 123). |
|
312 + * Change this later. |
|
313 + */ |
|
314 + msgid = 4102; |
|
315 + } else if (data->comm.hdr.u.result & TPM_E_NON_FATAL) { |
|
316 + /* |
|
317 + * NON_FATAL TPM errors are masked (0x800) so they are not in numerical |
|
318 + * sequence with the rest of the TPM errors. |
|
319 + */ |
|
320 + msgid = ADT_TPM_E_RETRY + |
|
321 + (data->comm.hdr.u.result - TPM_E_RETRY); |
|
322 + adterr = ADT_FAIL_VALUE_PROGRAM; |
|
323 + } else { |
|
324 + msgid = ADT_TPM_E_AUTHFAIL + |
|
325 + (data->comm.hdr.u.result - TPM_E_AUTHFAIL); |
|
326 + adterr = ADT_FAIL_VALUE_PROGRAM; |
|
327 + } |
|
328 + switch(cmd) { |
|
329 + case TPM_ORD_CertifySelfTest: |
|
330 + event = adt_alloc_event(ah, ADT_tpm_certifyselftest); |
|
331 + if (event != NULL) |
|
332 + event->adt_tpm_certifyselftest.message = msgid; |
|
333 + break; |
|
334 + case TPM_ORD_OwnerClear: |
|
335 + event = adt_alloc_event(ah, ADT_tpm_ownerclear); |
|
336 + if (event != NULL) |
|
337 + event->adt_tpm_ownerclear.message = msgid; |
|
338 + break; |
|
339 + case TPM_ORD_ContinueSelfTest: |
|
340 + event = adt_alloc_event(ah, ADT_tpm_continueselftest); |
|
341 + if (event != NULL) |
|
342 + event->adt_tpm_continueselftest.message = msgid; |
|
343 + break; |
|
344 + case TPM_ORD_DisableForceClear: |
|
345 + event = adt_alloc_event(ah, ADT_tpm_disableforceclear); |
|
346 + if (event != NULL) |
|
347 + event->adt_tpm_disableforceclear.message = msgid; |
|
348 + break; |
|
349 + case TPM_ORD_DisableOwnerClear: |
|
350 + event = adt_alloc_event(ah, ADT_tpm_disableownerclear); |
|
351 + if (event != NULL) |
|
352 + event->adt_tpm_disableownerclear.message = msgid; |
|
353 + break; |
|
354 + case TPM_ORD_FieldUpgrade: |
|
355 + event = adt_alloc_event(ah, ADT_tpm_fieldupgrade); |
|
356 + if (event != NULL) |
|
357 + event->adt_tpm_fieldupgrade.message = msgid; |
|
358 + break; |
|
359 + case TPM_ORD_ForceClear: |
|
360 + event = adt_alloc_event(ah, ADT_tpm_forceclear); |
|
361 + if (event != NULL) |
|
362 + event->adt_tpm_forceclear.message = msgid; |
|
363 + break; |
|
364 + case TPM_ORD_OwnerSetDisable: |
|
365 + event = adt_alloc_event(ah, ADT_tpm_ownersetdisable); |
|
366 + if (event != NULL) |
|
367 + event->adt_tpm_ownersetdisable.message = msgid; |
|
368 + break; |
|
369 + case TPM_ORD_PhysicalEnable: |
|
370 + event = adt_alloc_event(ah, ADT_tpm_physicalenable); |
|
371 + if (event != NULL) |
|
372 + event->adt_tpm_physicalenable.message = msgid; |
|
373 + break; |
|
374 + case TPM_ORD_PhysicalDisable: |
|
375 + event = adt_alloc_event(ah, ADT_tpm_physicaldisable); |
|
376 + if (event != NULL) |
|
377 + event->adt_tpm_physicaldisable.message = msgid; |
|
378 + break; |
|
379 + case TPM_ORD_PhysicalSetDeactivated: |
|
380 + event = adt_alloc_event(ah, ADT_tpm_physicaldeactivate); |
|
381 + if (event != NULL) |
|
382 + event->adt_tpm_physicaldeactivate.message = msgid; |
|
383 + break; |
|
384 + case TSC_ORD_PhysicalPresence: |
|
385 + event = adt_alloc_event(ah, ADT_tpm_physicalpresence); |
|
386 + if (event != NULL) |
|
387 + event->adt_tpm_physicalpresence.message = msgid; |
|
388 + break; |
|
389 + case TPM_ORD_ResetLockValue: |
|
390 + event = adt_alloc_event(ah, ADT_tpm_resetlockvalue); |
|
391 + if (event != NULL) |
|
392 + event->adt_tpm_resetlockvalue.message = msgid; |
|
393 + break; |
|
394 + case TPM_ORD_SelfTestFull: |
|
395 + event = adt_alloc_event(ah, ADT_tpm_selftestfull); |
|
396 + if (event != NULL) |
|
397 + event->adt_tpm_selftestfull.message = msgid; |
|
398 + break; |
|
399 + case TPM_ORD_SetOperatorAuth: |
|
400 + event = adt_alloc_event(ah, ADT_tpm_setoperatorauth); |
|
401 + if (event != NULL) |
|
402 + event->adt_tpm_setoperatorauth.message = msgid; |
|
403 + break; |
|
404 + case TPM_ORD_SetOwnerInstall: |
|
405 + event = adt_alloc_event(ah, ADT_tpm_setownerinstall); |
|
406 + if (event != NULL) |
|
407 + event->adt_tpm_setownerinstall.message = msgid; |
|
408 + break; |
|
409 + case TPM_ORD_SetTempDeactivated: |
|
410 + event = adt_alloc_event(ah, ADT_tpm_settempdeactivated); |
|
411 + if (event != NULL) |
|
412 + event->adt_tpm_settempdeactivated.message = msgid; |
|
413 + break; |
|
414 + case TPM_ORD_TakeOwnership: |
|
415 + event = adt_alloc_event(ah, ADT_tpm_takeownership); |
|
416 + if (event != NULL) |
|
417 + event->adt_tpm_takeownership.message = msgid; |
|
418 + break; |
|
419 + default: |
|
420 + /* command not audited */ |
|
421 + goto end; |
|
422 + } |
|
423 + if (event == NULL) { |
|
424 + LogError("Audit Failed - Failed to allocate event (%s)", |
|
425 + strerror(errno)); |
|
426 + goto end; |
|
427 + } |
|
428 + |
|
429 + if (adt_put_event(event, adtstatus, adterr)) { |
|
430 + LogError("Audit Failed - Failed to put audit event (%s)", |
|
431 + strerror(errno)); |
|
432 + } |
|
433 + |
|
434 +end: |
|
435 + ucred_free(uc); |
|
436 + adt_free_event(event); |
|
437 + (void) adt_end_session(ah); |
|
438 + |
|
439 + return; |
|
440 +} |
|
441 +#endif /* SOLARIS */ |
|
442 + |
|
443 TSS_RESULT |
|
444 dispatchCommand(struct tcsd_thread_data *data) |
|
445 { |
|
446 UINT64 offset; |
|
447 TSS_RESULT result; |
|
448 +#if defined (SOLARIS) |
|
449 + UINT32 cmd; |
|
450 +#endif |
|
451 |
|
452 /* First, check the ordinal bounds */ |
|
453 if (data->comm.hdr.u.ordinal >= TCSD_MAX_NUM_ORDS) { |
|
454 @@ -596,6 +775,9 @@ |
|
455 } |
|
456 |
|
457 /* Now, dispatch */ |
|
458 +#if defined (SOLARIS) |
|
459 + cmd = tcs_func_table[data->comm.hdr.u.ordinal].ordinal; |
|
460 +#endif |
|
461 if ((result = tcs_func_table[data->comm.hdr.u.ordinal].Func(data)) == TSS_SUCCESS) { |
|
462 /* set the comm buffer */ |
|
463 offset = 0; |
|
464 @@ -607,6 +789,9 @@ |
|
465 LoadBlob_UINT32(&offset, data->comm.hdr.parm_size, data->comm.buf); |
|
466 LoadBlob_UINT32(&offset, data->comm.hdr.parm_offset, data->comm.buf); |
|
467 } |
|
468 +#if defined (SOLARIS) |
|
469 + audit_tpm(cmd, data); |
|
470 +#endif |
|
471 |
|
472 return result; |
|
473 |
|