Lines Matching defs:?

3  * Licensed Materials - Property of IBM
5 * trousers - An open source TCG Software Stack
7 * (C) Copyright International Business Machines Corp. 2004-2006
11 #include <stdlib.h>
12 #include <stdio.h>
13 #include <string.h>
14 #include <assert.h>
16 #include "trousers/tss.h"
17 #include "trousers/trousers.h"
18 #include "trousers_types.h"
19 #include "spi_utils.h"
20 #include "capabilities.h"
21 #include "tsplog.h"
22 #include "hosttable.h"
23 #include "tcsd_wrap.h"
24 #include "obj.h"
25 #include "rpc_tcstp_tsp.h"
35 initData(&hte->comm, 2);
36 hte->comm.hdr.u.ordinal = TCSD_ORD_LOGPCREVENT;
37 LogDebugFn("TCS Context: 0x%x", hte->tcsContext);
39 if (setData(TCSD_PACKET_TYPE_UINT32, 0, &hte->tcsContext, 0, &hte->comm))
42 if (setData(TCSD_PACKET_TYPE_PCR_EVENT, 1, &Event, 0, &hte->comm))
45 result = sendTCSDPacket(hte);
47 if (result == TSS_SUCCESS)
48 result = hte->comm.hdr.u.result;
50 if (result == TSS_SUCCESS) {
51 if (getData(TCSD_PACKET_TYPE_UINT32, 0, pNumber, 0, &hte->comm))
52 result = TSPERR(TSS_E_INTERNAL_ERROR);
65 BYTE lengthOnly = (ppEvent == NULL) ? TRUE : FALSE;
67 initData(&hte->comm, 4);
68 hte->comm.hdr.u.ordinal = TCSD_ORD_GETPCREVENT;
69 LogDebugFn("TCS Context: 0x%x", hte->tcsContext);
71 if (setData(TCSD_PACKET_TYPE_UINT32, 0, &hte->tcsContext, 0, &hte->comm))
74 if (setData(TCSD_PACKET_TYPE_UINT32, 1, &PcrIndex, 0, &hte->comm))
77 if (setData(TCSD_PACKET_TYPE_UINT32, 2, pNumber, 0, &hte->comm))
80 if (setData(TCSD_PACKET_TYPE_BYTE, 3, &lengthOnly, 0, &hte->comm))
83 result = sendTCSDPacket(hte);
85 if (result == TSS_SUCCESS)
86 result = hte->comm.hdr.u.result;
88 if (result == TSS_SUCCESS) {
89 if (getData(TCSD_PACKET_TYPE_UINT32, 0, pNumber, 0, &hte->comm)) {
90 result = TSPERR(TSS_E_INTERNAL_ERROR);
95 *ppEvent = malloc(sizeof(TSS_PCR_EVENT));
96 if (*ppEvent == NULL) {
97 LogError("malloc of %zd bytes failed.",
99 result = TSPERR(TSS_E_OUTOFMEMORY);
103 if (getData(TCSD_PACKET_TYPE_PCR_EVENT, 1, *ppEvent, 0, &hte->comm)) {
105 *ppEvent = NULL;
106 result = TSPERR(TSS_E_INTERNAL_ERROR);
111 done:
123 UINT32 i, j;
125 initData(&hte->comm, 4);
126 hte->comm.hdr.u.ordinal = TCSD_ORD_GETPCREVENTBYPCR;
127 LogDebugFn("TCS Context: 0x%x", hte->tcsContext);
129 if (setData(TCSD_PACKET_TYPE_UINT32, 0, &hte->tcsContext, 0, &hte->comm))
132 if (setData(TCSD_PACKET_TYPE_UINT32, 1, &PcrIndex, 0, &hte->comm))
135 if (setData(TCSD_PACKET_TYPE_UINT32, 2, &FirstEvent, 0, &hte->comm))
138 if (setData(TCSD_PACKET_TYPE_UINT32, 3, pEventCount, 0, &hte->comm))
141 result = sendTCSDPacket(hte);
143 if (result == TSS_SUCCESS)
144 result = hte->comm.hdr.u.result;
146 if (result == TSS_SUCCESS) {
147 if (getData(TCSD_PACKET_TYPE_UINT32, 0, pEventCount, 0, &hte->comm)) {
148 result = TSPERR(TSS_E_INTERNAL_ERROR);
152 if (*pEventCount > 0) {
153 *ppEvents = calloc_tspi(hte->tspContext,
155 if (*ppEvents == NULL) {
156 LogError("malloc of %zd bytes failed.", sizeof(TSS_PCR_EVENT) * (*pEventCount));
157 result = TSPERR(TSS_E_OUTOFMEMORY);
161 i = 1;
162 for (j = 0; j < (*pEventCount); j++) {
163 if (getData(TCSD_PACKET_TYPE_PCR_EVENT, i++, &((*ppEvents)[j]), 0, &hte->comm)) {
165 *ppEvents = NULL;
166 result = TSPERR(TSS_E_INTERNAL_ERROR);
171 *ppEvents = NULL;
175 done:
185 int i, j;
187 initData(&hte->comm, 1);
188 hte->comm.hdr.u.ordinal = TCSD_ORD_GETPCREVENTLOG;
189 LogDebugFn("TCS Context: 0x%x", hte->tcsContext);
191 if (setData(TCSD_PACKET_TYPE_UINT32, 0, &hte->tcsContext, 0, &hte->comm))
194 result = sendTCSDPacket(hte);
196 if (result == TSS_SUCCESS)
197 result = hte->comm.hdr.u.result;
199 if (result == TSS_SUCCESS) {
200 if (getData(TCSD_PACKET_TYPE_UINT32, 0, pEventCount, 0, &hte->comm)) {
201 result = TSPERR(TSS_E_INTERNAL_ERROR);
205 if (*pEventCount > 0) {
206 *ppEvents = calloc_tspi(hte->tspContext,
208 if (*ppEvents == NULL) {
209 LogError("malloc of %zd bytes failed.",
211 result = TSPERR(TSS_E_OUTOFMEMORY);
215 i = 1;
216 for (j = 0; (UINT32)j < (*pEventCount); j++) {
217 if (getData(TCSD_PACKET_TYPE_PCR_EVENT, i++, &((*ppEvents)[j]), 0, &hte->comm)) {
219 *ppEvents = NULL;
220 result = TSPERR(TSS_E_INTERNAL_ERROR);
225 *ppEvents = NULL;
229 done: