3
* Licensed Materials - Property of IBM
5
* trousers - An open source TCG Software Stack
7
* (C) Copyright International Business Machines Corp. 2004-2006
17
#include "trousers/tss.h"
18
#include "trousers_types.h"
20
#include "tcs_utils.h"
21
#include "tcs_int_literals.h"
22
#include "capabilities.h"
24
#include "tcsd_wrap.h"
26
#include "tcs_utils.h"
27
#include "rpc_tcstp_tcs.h"
31
tcs_wrap_DirWriteAuth(struct tcsd_thread_data *data)
34
TSS_HCONTEXT hContext;
35
TCPA_DIRINDEX dirIndex;
36
TCPA_DIGEST dirDigest;
39
if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm))
40
return TCSERR(TSS_E_INTERNAL_ERROR);
42
LogDebugFn("thread %zd context %x", THREAD_ID, hContext);
44
if (getData(TCSD_PACKET_TYPE_UINT32, 1, &dirIndex, 0, &data->comm))
45
return TCSERR(TSS_E_INTERNAL_ERROR);
46
if (getData(TCSD_PACKET_TYPE_DIGEST, 2, &dirDigest, 0, &data->comm))
47
return TCSERR(TSS_E_INTERNAL_ERROR);
48
if (getData(TCSD_PACKET_TYPE_AUTH, 3, &auth, 0, &data->comm))
49
return TCSERR(TSS_E_INTERNAL_ERROR);
51
MUTEX_LOCK(tcsp_lock);
53
result = TCSP_DirWriteAuth_Internal(hContext, dirIndex, dirDigest, &auth);
55
MUTEX_UNLOCK(tcsp_lock);
57
if (result == TSS_SUCCESS) {
58
initData(&data->comm, 1);
59
if (setData(TCSD_PACKET_TYPE_AUTH, 0, &auth, 0, &data->comm)) {
60
return TCSERR(TSS_E_INTERNAL_ERROR);
63
initData(&data->comm, 0);
65
data->comm.hdr.u.result = result;
71
tcs_wrap_DirRead(struct tcsd_thread_data *data)
74
TSS_HCONTEXT hContext;
75
TCPA_DIRINDEX dirIndex;
76
TCPA_DIRVALUE dirValue;
78
if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm))
79
return TCSERR(TSS_E_INTERNAL_ERROR);
81
LogDebugFn("thread %zd context %x", THREAD_ID, hContext);
83
if (getData(TCSD_PACKET_TYPE_UINT32, 1, &dirIndex, 0, &data->comm))
84
return TCSERR(TSS_E_INTERNAL_ERROR);
86
MUTEX_LOCK(tcsp_lock);
88
result = TCSP_DirRead_Internal(hContext, dirIndex, &dirValue);
90
MUTEX_UNLOCK(tcsp_lock);
92
if (result == TSS_SUCCESS) {
93
initData(&data->comm, 1);
94
if (setData(TCSD_PACKET_TYPE_DIGEST, 0, &dirValue, 0, &data->comm)) {
95
return TCSERR(TSS_E_INTERNAL_ERROR);
98
initData(&data->comm, 0);
100
data->comm.hdr.u.result = result;