3
* Licensed Materials - Property of IBM
5
* trousers - An open source TCG Software Stack
7
* (C) Copyright International Business Machines Corp. 2004-2006
16
#include "trousers/tss.h"
17
#include "trousers/trousers.h"
18
#include "trousers_types.h"
19
#include "spi_utils.h"
20
#include "capabilities.h"
22
#include "hosttable.h"
23
#include "tcsd_wrap.h"
25
#include "rpc_tcstp_tsp.h"
29
RPC_OIAP_TP(struct host_table_entry *hte,
30
TCS_AUTHHANDLE * authHandle, /* out */
31
TCPA_NONCE * nonce0 /* out */
35
initData(&hte->comm, 1);
36
hte->comm.hdr.u.ordinal = TCSD_ORD_OIAP;
37
LogDebugFn("TCS Context: 0x%x", hte->tcsContext);
39
if (setData(TCSD_PACKET_TYPE_UINT32, 0, &hte->tcsContext, 0, &hte->comm))
40
return TSPERR(TSS_E_INTERNAL_ERROR);
42
result = sendTCSDPacket(hte);
44
if (result == TSS_SUCCESS)
45
result = hte->comm.hdr.u.result;
47
if (result == TSS_SUCCESS) {
48
if (getData(TCSD_PACKET_TYPE_UINT32, 0, authHandle, 0, &hte->comm))
49
result = TSPERR(TSS_E_INTERNAL_ERROR);
50
if (getData(TCSD_PACKET_TYPE_NONCE, 1, nonce0, 0, &hte->comm))
51
result = TSPERR(TSS_E_INTERNAL_ERROR);
58
RPC_OSAP_TP(struct host_table_entry *hte,
59
TCPA_ENTITY_TYPE entityType, /* in */
60
UINT32 entityValue, /* in */
61
TCPA_NONCE * nonceOddOSAP, /* in */
62
TCS_AUTHHANDLE * authHandle, /* out */
63
TCPA_NONCE * nonceEven, /* out */
64
TCPA_NONCE * nonceEvenOSAP /* out */
68
initData(&hte->comm, 4);
69
hte->comm.hdr.u.ordinal = TCSD_ORD_OSAP;
70
LogDebugFn("TCS Context: 0x%x", hte->tcsContext);
72
if (setData(TCSD_PACKET_TYPE_UINT32, 0, &hte->tcsContext, 0, &hte->comm))
73
return TSPERR(TSS_E_INTERNAL_ERROR);
74
if (setData(TCSD_PACKET_TYPE_UINT16, 1, &entityType, 0, &hte->comm))
75
return TSPERR(TSS_E_INTERNAL_ERROR);
76
if (setData(TCSD_PACKET_TYPE_UINT32, 2, &entityValue, 0, &hte->comm))
77
return TSPERR(TSS_E_INTERNAL_ERROR);
78
if (setData(TCSD_PACKET_TYPE_NONCE, 3, nonceOddOSAP, 0, &hte->comm))
79
return TSPERR(TSS_E_INTERNAL_ERROR);
81
result = sendTCSDPacket(hte);
83
if (result == TSS_SUCCESS)
84
result = hte->comm.hdr.u.result;
86
if (result == TSS_SUCCESS) {
87
if (getData(TCSD_PACKET_TYPE_UINT32, 0, authHandle, 0, &hte->comm))
88
result = TSPERR(TSS_E_INTERNAL_ERROR);
89
if (getData(TCSD_PACKET_TYPE_NONCE, 1, nonceEven, 0, &hte->comm))
90
result = TSPERR(TSS_E_INTERNAL_ERROR);
91
if (getData(TCSD_PACKET_TYPE_NONCE, 2, nonceEvenOSAP, 0, &hte->comm))
92
result = TSPERR(TSS_E_INTERNAL_ERROR);