~ubuntu-branches/ubuntu/jaunty/trousers/jaunty

« back to all changes in this revision

Viewing changes to src/tspi/rpc/tcstp/rpc_cmk.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2008-01-23 22:03:00 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080123220300-fhtqja3c0oq0gp6z
Tags: 0.3.1-4
* Added patch from Aaron M. Ucko <ucko@debian.org> to allow trousers to
  build successfully on amd64, and presumably also other 64-bit
  architectures (Closes: #457400).
* Including udev rule for /dev/tpm from William Lima
  <wlima.amadeus@gmail.com> as suggested by David Smith <dds@google.com>
  (Closes: #459682).
* Added lintian overrides.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/*
 
3
 * Licensed Materials - Property of IBM
 
4
 *
 
5
 * trousers - An open source TCG Software Stack
 
6
 *
 
7
 * (C) Copyright International Business Machines Corp. 2007
 
8
 *
 
9
 */
 
10
 
 
11
#include <stdlib.h>
 
12
#include <stdio.h>
 
13
#include <string.h>
 
14
#include <assert.h>
 
15
 
 
16
#include "trousers/tss.h"
 
17
#include "trousers/trousers.h"
 
18
#include "trousers_types.h"
 
19
#include "tsplog.h"
 
20
#include "hosttable.h"
 
21
#include "tcsd_wrap.h"
 
22
#include "rpc_tcstp_tsp.h"
 
23
 
 
24
 
 
25
TSS_RESULT
 
26
RPC_CMK_SetRestrictions_TP(struct host_table_entry *hte,
 
27
                           TSS_CMK_DELEGATE restriction,        /* in */
 
28
                           TPM_AUTH *ownerAuth)                 /* in, out */
 
29
{
 
30
        TSS_RESULT result;
 
31
 
 
32
        initData(&hte->comm, 3);
 
33
        hte->comm.hdr.u.ordinal = TCSD_ORD_CMK_SETRESTRICTIONS;
 
34
        LogDebugFn("TCS Context: 0x%x", hte->tcsContext);
 
35
 
 
36
        if (setData(TCSD_PACKET_TYPE_UINT32, 0, &hte->tcsContext, 0, &hte->comm))
 
37
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
38
        if (setData(TCSD_PACKET_TYPE_UINT32, 1, &restriction, 0, &hte->comm))
 
39
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
40
        if (setData(TCSD_PACKET_TYPE_AUTH, 2, ownerAuth, 0, &hte->comm))
 
41
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
42
 
 
43
        result = sendTCSDPacket(hte);
 
44
 
 
45
        if (result == TSS_SUCCESS)
 
46
                result = hte->comm.hdr.u.result;
 
47
 
 
48
        if (result == TSS_SUCCESS) {
 
49
                if (getData(TCSD_PACKET_TYPE_AUTH, 0, ownerAuth, 0, &hte->comm))
 
50
                        return TSPERR(TSS_E_INTERNAL_ERROR);
 
51
        }
 
52
 
 
53
        return result;
 
54
}
 
55
 
 
56
TSS_RESULT
 
57
RPC_CMK_ApproveMA_TP(struct host_table_entry *hte,
 
58
                     TPM_DIGEST migAuthorityDigest,     /* in */
 
59
                     TPM_AUTH *ownerAuth,               /* in, out */
 
60
                     TPM_HMAC *migAuthorityApproval)    /* out */
 
61
{
 
62
        TSS_RESULT result;
 
63
 
 
64
        initData(&hte->comm, 3);
 
65
        hte->comm.hdr.u.ordinal = TCSD_ORD_CMK_APPROVEMA;
 
66
        LogDebugFn("TCS Context: 0x%x", hte->tcsContext);
 
67
 
 
68
        if (setData(TCSD_PACKET_TYPE_UINT32, 0, &hte->tcsContext, 0, &hte->comm))
 
69
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
70
        if (setData(TCSD_PACKET_TYPE_DIGEST, 1, &migAuthorityDigest, 0, &hte->comm))
 
71
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
72
        if (setData(TCSD_PACKET_TYPE_AUTH, 2, ownerAuth, 0, &hte->comm))
 
73
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
74
 
 
75
        result = sendTCSDPacket(hte);
 
76
 
 
77
        if (result == TSS_SUCCESS)
 
78
                result = hte->comm.hdr.u.result;
 
79
 
 
80
        if (result == TSS_SUCCESS) {
 
81
                if (getData(TCSD_PACKET_TYPE_AUTH, 0, ownerAuth, 0, &hte->comm))
 
82
                        return TSPERR(TSS_E_INTERNAL_ERROR);
 
83
                if (getData(TCSD_PACKET_TYPE_DIGEST, 1, migAuthorityApproval, 0, &hte->comm))
 
84
                        return TSPERR(TSS_E_INTERNAL_ERROR);
 
85
        }
 
86
 
 
87
        return result;
 
88
}
 
89
 
 
90
TSS_RESULT
 
91
RPC_CMK_CreateKey_TP(struct host_table_entry *hte,
 
92
                     TCS_KEY_HANDLE hWrappingKey,       /* in */
 
93
                     TPM_ENCAUTH *keyUsageAuth,         /* in */
 
94
                     TPM_HMAC *migAuthorityApproval,    /* in */
 
95
                     TPM_DIGEST *migAuthorityDigest,    /* in */
 
96
                     UINT32 *keyDataSize,               /* in, out */
 
97
                     BYTE **keyData,                    /* in, out */
 
98
                     TPM_AUTH *pAuth)                   /* in, out */
 
99
{
 
100
        TSS_RESULT result;
 
101
 
 
102
        initData(&hte->comm, 8);
 
103
        hte->comm.hdr.u.ordinal = TCSD_ORD_CMK_CREATEKEY;
 
104
        LogDebugFn("TCS Context: 0x%x", hte->tcsContext);
 
105
 
 
106
        if (setData(TCSD_PACKET_TYPE_UINT32, 0, &hte->tcsContext, 0, &hte->comm))
 
107
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
108
        if (setData(TCSD_PACKET_TYPE_UINT32, 1, &hWrappingKey, 0, &hte->comm))
 
109
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
110
        if (setData(TCSD_PACKET_TYPE_ENCAUTH, 2, keyUsageAuth, 0, &hte->comm))
 
111
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
112
        if (setData(TCSD_PACKET_TYPE_DIGEST, 3, migAuthorityApproval, 0, &hte->comm))
 
113
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
114
        if (setData(TCSD_PACKET_TYPE_DIGEST, 4, migAuthorityDigest, 0, &hte->comm))
 
115
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
116
        if (setData(TCSD_PACKET_TYPE_UINT32, 5, keyDataSize, 0, &hte->comm))
 
117
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
118
        if (setData(TCSD_PACKET_TYPE_PBYTE, 6, *keyData, *keyDataSize, &hte->comm))
 
119
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
120
        if (pAuth) {
 
121
                if (setData(TCSD_PACKET_TYPE_AUTH, 7, pAuth, 0, &hte->comm))
 
122
                        return TSPERR(TSS_E_INTERNAL_ERROR);
 
123
        } else {
 
124
                TPM_AUTH nullAuth;
 
125
 
 
126
                memset(&nullAuth, 0, sizeof(TPM_AUTH));
 
127
                if (setData(TCSD_PACKET_TYPE_AUTH, 7, &nullAuth, 0, &hte->comm))
 
128
                        return TSPERR(TSS_E_INTERNAL_ERROR);
 
129
        }
 
130
        free(*keyData);
 
131
        *keyData = NULL;
 
132
 
 
133
        result = sendTCSDPacket(hte);
 
134
 
 
135
        if (result == TSS_SUCCESS)
 
136
                result = hte->comm.hdr.u.result;
 
137
 
 
138
        if (result == TSS_SUCCESS) {
 
139
                if (getData(TCSD_PACKET_TYPE_UINT32, 0, keyDataSize, 0, &hte->comm))
 
140
                        return TSPERR(TSS_E_INTERNAL_ERROR);
 
141
                *keyData = (BYTE *)malloc(*keyDataSize);
 
142
                if (*keyData == NULL) {
 
143
                        LogError("malloc of %u bytes failed.", *keyDataSize);
 
144
                        return TSPERR(TSS_E_OUTOFMEMORY);
 
145
                }
 
146
                if (getData(TCSD_PACKET_TYPE_PBYTE, 1, *keyData, *keyDataSize, &hte->comm)) {
 
147
                        free(*keyData);
 
148
                        return TSPERR(TSS_E_INTERNAL_ERROR);
 
149
                }
 
150
                if (pAuth) {
 
151
                        if (getData(TCSD_PACKET_TYPE_AUTH, 2, pAuth, 0, &hte->comm)) {
 
152
                                free(*keyData);
 
153
                                return TSPERR(TSS_E_INTERNAL_ERROR);
 
154
                        }
 
155
                }
 
156
        }
 
157
 
 
158
        return result;
 
159
}
 
160
 
 
161
TSS_RESULT
 
162
RPC_CMK_CreateTicket_TP(struct host_table_entry *hte,
 
163
                        UINT32 publicVerifyKeySize,     /* in */
 
164
                        BYTE *publicVerifyKey,          /* in */
 
165
                        TPM_DIGEST signedData,          /* in */
 
166
                        UINT32 sigValueSize,            /* in */
 
167
                        BYTE *sigValue,                 /* in */
 
168
                        TPM_AUTH *ownerAuth,            /* in, out */
 
169
                        TPM_HMAC *sigTicket)            /* out */
 
170
{
 
171
        TSS_RESULT result;
 
172
 
 
173
        initData(&hte->comm, 7);
 
174
        hte->comm.hdr.u.ordinal = TCSD_ORD_CMK_CREATETICKET;
 
175
        LogDebugFn("TCS Context: 0x%x", hte->tcsContext);
 
176
 
 
177
        if (setData(TCSD_PACKET_TYPE_UINT32, 0, &hte->tcsContext, 0, &hte->comm))
 
178
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
179
        if (setData(TCSD_PACKET_TYPE_UINT32, 1, &publicVerifyKeySize, 0, &hte->comm))
 
180
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
181
        if (setData(TCSD_PACKET_TYPE_PBYTE, 2, publicVerifyKey, publicVerifyKeySize, &hte->comm))
 
182
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
183
        if (setData(TCSD_PACKET_TYPE_DIGEST, 3, &signedData, 0, &hte->comm))
 
184
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
185
        if (setData(TCSD_PACKET_TYPE_UINT32, 4, &sigValueSize, 0, &hte->comm))
 
186
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
187
        if (setData(TCSD_PACKET_TYPE_PBYTE, 5, sigValue, sigValueSize, &hte->comm))
 
188
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
189
        if (setData(TCSD_PACKET_TYPE_AUTH, 6, ownerAuth, 0, &hte->comm))
 
190
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
191
 
 
192
        result = sendTCSDPacket(hte);
 
193
 
 
194
        if (result == TSS_SUCCESS)
 
195
                result = hte->comm.hdr.u.result;
 
196
 
 
197
        if (result == TSS_SUCCESS) {
 
198
                if (getData(TCSD_PACKET_TYPE_AUTH, 0, ownerAuth, 0, &hte->comm))
 
199
                        return TSPERR(TSS_E_INTERNAL_ERROR);
 
200
                if (getData(TCSD_PACKET_TYPE_DIGEST, 1, sigTicket, 0, &hte->comm))
 
201
                        return TSPERR(TSS_E_INTERNAL_ERROR);
 
202
        }
 
203
 
 
204
        return result;
 
205
}
 
206
 
 
207
TSS_RESULT
 
208
RPC_CMK_CreateBlob_TP(struct host_table_entry *hte,
 
209
                      TCS_KEY_HANDLE hParentKey,        /* in */
 
210
                      TSS_MIGRATE_SCHEME migrationType, /* in */
 
211
                      UINT32 migKeyAuthSize,            /* in */
 
212
                      BYTE *migKeyAuth,                 /* in */
 
213
                      TPM_DIGEST pubSourceKeyDigest,    /* in */
 
214
                      UINT32 msaListSize,               /* in */
 
215
                      BYTE *msaList,                    /* in */
 
216
                      UINT32 restrictTicketSize,        /* in */
 
217
                      BYTE *restrictTicket,             /* in */
 
218
                      UINT32 sigTicketSize,             /* in */
 
219
                      BYTE *sigTicket,                  /* in */
 
220
                      UINT32 encDataSize,               /* in */
 
221
                      BYTE *encData,                    /* in */
 
222
                      TPM_AUTH *pAuth,                  /* in, out */
 
223
                      UINT32 *randomSize,               /* out */
 
224
                      BYTE **random,                    /* out */
 
225
                      UINT32 *outDataSize,              /* out */
 
226
                      BYTE **outData)                   /* out */
 
227
{
 
228
        TSS_RESULT result;
 
229
        int i;
 
230
 
 
231
        initData(&hte->comm, 15);
 
232
        hte->comm.hdr.u.ordinal = TCSD_ORD_CMK_CREATEBLOB;
 
233
        LogDebugFn("TCS Context: 0x%x", hte->tcsContext);
 
234
 
 
235
        if (setData(TCSD_PACKET_TYPE_UINT32, 0, &hte->tcsContext, 0, &hte->comm))
 
236
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
237
        if (setData(TCSD_PACKET_TYPE_UINT32, 1, &hParentKey, 0, &hte->comm))
 
238
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
239
        if (setData(TCSD_PACKET_TYPE_UINT16, 2, &migrationType, 0, &hte->comm))
 
240
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
241
        if (setData(TCSD_PACKET_TYPE_UINT32, 3, &migKeyAuthSize, 0, &hte->comm))
 
242
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
243
        if (setData(TCSD_PACKET_TYPE_PBYTE, 4, migKeyAuth, migKeyAuthSize, &hte->comm))
 
244
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
245
        if (setData(TCSD_PACKET_TYPE_DIGEST, 5, &pubSourceKeyDigest, 0, &hte->comm))
 
246
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
247
        if (setData(TCSD_PACKET_TYPE_UINT32, 6, &msaListSize, 0, &hte->comm))
 
248
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
249
        if (setData(TCSD_PACKET_TYPE_PBYTE, 7, msaList, msaListSize, &hte->comm))
 
250
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
251
        if (setData(TCSD_PACKET_TYPE_UINT32, 8, &restrictTicketSize, 0, &hte->comm))
 
252
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
253
        if (setData(TCSD_PACKET_TYPE_PBYTE, 9, restrictTicket, restrictTicketSize, &hte->comm))
 
254
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
255
        if (setData(TCSD_PACKET_TYPE_UINT32, 10, &sigTicketSize, 0, &hte->comm))
 
256
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
257
        if (setData(TCSD_PACKET_TYPE_PBYTE, 11, sigTicket, sigTicketSize, &hte->comm))
 
258
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
259
        if (setData(TCSD_PACKET_TYPE_UINT32, 12, &encDataSize, 0, &hte->comm))
 
260
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
261
        if (setData(TCSD_PACKET_TYPE_PBYTE, 13, encData, encDataSize, &hte->comm))
 
262
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
263
        if (pAuth) {
 
264
                if (setData(TCSD_PACKET_TYPE_AUTH, 14, pAuth, 0, &hte->comm))
 
265
                        return TSPERR(TSS_E_INTERNAL_ERROR);
 
266
        } else {
 
267
                TPM_AUTH nullAuth;
 
268
 
 
269
                memset(&nullAuth, 0, sizeof(TPM_AUTH));
 
270
                if (setData(TCSD_PACKET_TYPE_AUTH, 14, &nullAuth, 0, &hte->comm))
 
271
                        return TSPERR(TSS_E_INTERNAL_ERROR);
 
272
        }
 
273
 
 
274
        result = sendTCSDPacket(hte);
 
275
 
 
276
        if (result == TSS_SUCCESS)
 
277
                result = hte->comm.hdr.u.result;
 
278
 
 
279
        if (result == TSS_SUCCESS) {
 
280
                i = 0;
 
281
                if (pAuth) {
 
282
                        if (getData(TCSD_PACKET_TYPE_AUTH, i++, pAuth, 0, &hte->comm))
 
283
                                return TSPERR(TSS_E_INTERNAL_ERROR);
 
284
                }
 
285
                if (getData(TCSD_PACKET_TYPE_UINT32, i++, randomSize, 0, &hte->comm))
 
286
                        return TSPERR(TSS_E_INTERNAL_ERROR);
 
287
                *random = (BYTE *)malloc(*randomSize);
 
288
                if (*random == NULL) {
 
289
                        LogError("malloc of %u bytes failed.", *randomSize);
 
290
                        return TSPERR(TSS_E_OUTOFMEMORY);
 
291
                }
 
292
                if (getData(TCSD_PACKET_TYPE_PBYTE, i++, *random, *randomSize, &hte->comm)) {
 
293
                        free(*random);
 
294
                        return TSPERR(TSS_E_INTERNAL_ERROR);
 
295
                }
 
296
                if (getData(TCSD_PACKET_TYPE_UINT32, i++, outDataSize, 0, &hte->comm))
 
297
                        return TSPERR(TSS_E_INTERNAL_ERROR);
 
298
                *outData = (BYTE *)malloc(*outDataSize);
 
299
                if (*outData == NULL) {
 
300
                        LogError("malloc of %u bytes failed.", *outDataSize);
 
301
                        free(*random);
 
302
                        return TSPERR(TSS_E_OUTOFMEMORY);
 
303
                }
 
304
                if (getData(TCSD_PACKET_TYPE_PBYTE, i++, *outData, *outDataSize, &hte->comm)) {
 
305
                        free(*random);
 
306
                        free(*outData);
 
307
                        return TSPERR(TSS_E_INTERNAL_ERROR);
 
308
                }
 
309
        }
 
310
 
 
311
        return result;
 
312
}
 
313
 
 
314
TSS_RESULT
 
315
RPC_CMK_ConvertMigration_TP(struct host_table_entry *hte,
 
316
                            TCS_KEY_HANDLE hParentHandle,       /* in */
 
317
                            TPM_CMK_AUTH restrictTicket,        /* in */
 
318
                            TPM_HMAC sigTicket,                 /* in */
 
319
                            UINT32 keyDataSize,                 /* in */
 
320
                            BYTE *keyData,                      /* in */
 
321
                            UINT32 msaListSize,                 /* in */
 
322
                            BYTE *msaList,                      /* in */        
 
323
                            UINT32 randomSize,                  /* in */
 
324
                            BYTE *random,                       /* in */
 
325
                            TPM_AUTH *pAuth,                    /* in, out */
 
326
                            UINT32 *outDataSize,                /* out */
 
327
                            BYTE **outData)                     /* out */
 
328
{
 
329
        TSS_RESULT result;
 
330
        int i;
 
331
 
 
332
        initData(&hte->comm, 11);
 
333
        hte->comm.hdr.u.ordinal = TCSD_ORD_CMK_CONVERTMIGRATION;
 
334
        LogDebugFn("TCS Context: 0x%x", hte->tcsContext);
 
335
 
 
336
        if (setData(TCSD_PACKET_TYPE_UINT32, 0, &hte->tcsContext, 0, &hte->comm))
 
337
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
338
        if (setData(TCSD_PACKET_TYPE_UINT32, 1, &hParentHandle, 0, &hte->comm))
 
339
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
340
        if (setData(TCSD_PACKET_TYPE_PBYTE, 2, &restrictTicket, sizeof(restrictTicket), &hte->comm))
 
341
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
342
        if (setData(TCSD_PACKET_TYPE_DIGEST, 3, &sigTicket, 0, &hte->comm))
 
343
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
344
        if (setData(TCSD_PACKET_TYPE_UINT32, 4, &keyDataSize, 0, &hte->comm))
 
345
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
346
        if (setData(TCSD_PACKET_TYPE_PBYTE, 5, keyData, keyDataSize, &hte->comm))
 
347
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
348
        if (setData(TCSD_PACKET_TYPE_UINT32, 6, &msaListSize, 0, &hte->comm))
 
349
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
350
        if (setData(TCSD_PACKET_TYPE_PBYTE, 7, msaList, msaListSize, &hte->comm))
 
351
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
352
        if (setData(TCSD_PACKET_TYPE_UINT32, 8, &randomSize, 0, &hte->comm))
 
353
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
354
        if (setData(TCSD_PACKET_TYPE_PBYTE, 9, random, randomSize, &hte->comm))
 
355
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
356
        if (pAuth) {
 
357
                if (setData(TCSD_PACKET_TYPE_AUTH, 10, pAuth, 0, &hte->comm))
 
358
                        return TSPERR(TSS_E_INTERNAL_ERROR);
 
359
        } else {
 
360
                TPM_AUTH nullAuth;
 
361
 
 
362
                memset(&nullAuth, 0, sizeof(TPM_AUTH));
 
363
                if (setData(TCSD_PACKET_TYPE_AUTH, 10, &nullAuth, 0, &hte->comm))
 
364
                        return TSPERR(TSS_E_INTERNAL_ERROR);
 
365
        }
 
366
 
 
367
        result = sendTCSDPacket(hte);
 
368
 
 
369
        if (result == TSS_SUCCESS)
 
370
                result = hte->comm.hdr.u.result;
 
371
 
 
372
        if (result == TSS_SUCCESS) {
 
373
                i = 0;
 
374
                if (pAuth) {
 
375
                        if (getData(TCSD_PACKET_TYPE_AUTH, i++, pAuth, 0, &hte->comm))
 
376
                                return TSPERR(TSS_E_INTERNAL_ERROR);
 
377
                }
 
378
                if (getData(TCSD_PACKET_TYPE_UINT32, i++, outDataSize, 0, &hte->comm))
 
379
                        return TSPERR(TSS_E_INTERNAL_ERROR);
 
380
                *outData = (BYTE *)malloc(*outDataSize);
 
381
                if (*outData == NULL) {
 
382
                        LogError("malloc of %u bytes failed.", *outDataSize);
 
383
                        return TSPERR(TSS_E_OUTOFMEMORY);
 
384
                }
 
385
                if (getData(TCSD_PACKET_TYPE_PBYTE, i++, *outData, *outDataSize, &hte->comm)) {
 
386
                        free(*outData);
 
387
                        return TSPERR(TSS_E_INTERNAL_ERROR);
 
388
                }
 
389
        }
 
390
 
 
391
        return result;
 
392
}
 
393