1 // Copyright 2015 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // THIS CODE IS GENERATED - DO NOT MODIFY!
6 
7 #include "tpm_generated.h"
8 #include "HandleProcess_fp.h"
9 #include "Implementation.h"
10 #include "TPM_Types.h"
11 
ParseHandleBuffer(TPM_CC command_code,BYTE ** request_handle_buffer_start,INT32 * request_buffer_remaining_size,TPM_HANDLE request_handles[],UINT32 * num_request_handles)12 TPM_RC ParseHandleBuffer(TPM_CC command_code,
13                          BYTE** request_handle_buffer_start,
14                          INT32* request_buffer_remaining_size,
15                          TPM_HANDLE request_handles[],
16                          UINT32* num_request_handles) {
17   TPM_RC result = TPM_RC_SUCCESS;
18   *num_request_handles = 0;
19   switch (command_code) {
20 #ifdef TPM_CC_ActivateCredential
21     case TPM_CC_ActivateCredential:
22       result = TPMI_DH_OBJECT_Unmarshal(
23           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
24           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
25       if (result != TPM_RC_SUCCESS) {
26         return result;
27       }
28       ++(*num_request_handles);
29       result = TPMI_DH_OBJECT_Unmarshal(
30           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
31           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
32       if (result != TPM_RC_SUCCESS) {
33         return result;
34       }
35       ++(*num_request_handles);
36       return TPM_RC_SUCCESS;
37 #endif
38 #ifdef TPM_CC_Certify
39     case TPM_CC_Certify:
40       result = TPMI_DH_OBJECT_Unmarshal(
41           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
42           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
43       if (result != TPM_RC_SUCCESS) {
44         return result;
45       }
46       ++(*num_request_handles);
47       result = TPMI_DH_OBJECT_Unmarshal(
48           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
49           request_handle_buffer_start, request_buffer_remaining_size, TRUE);
50       if (result != TPM_RC_SUCCESS) {
51         return result;
52       }
53       ++(*num_request_handles);
54       return TPM_RC_SUCCESS;
55 #endif
56 #ifdef TPM_CC_CertifyCreation
57     case TPM_CC_CertifyCreation:
58       result = TPMI_DH_OBJECT_Unmarshal(
59           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
60           request_handle_buffer_start, request_buffer_remaining_size, TRUE);
61       if (result != TPM_RC_SUCCESS) {
62         return result;
63       }
64       ++(*num_request_handles);
65       result = TPMI_DH_OBJECT_Unmarshal(
66           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
67           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
68       if (result != TPM_RC_SUCCESS) {
69         return result;
70       }
71       ++(*num_request_handles);
72       return TPM_RC_SUCCESS;
73 #endif
74 #ifdef TPM_CC_ChangeEPS
75     case TPM_CC_ChangeEPS:
76       result = TPMI_RH_PLATFORM_Unmarshal(
77           (TPMI_RH_PLATFORM*)&request_handles[*num_request_handles],
78           request_handle_buffer_start, request_buffer_remaining_size);
79       if (result != TPM_RC_SUCCESS) {
80         return result;
81       }
82       ++(*num_request_handles);
83       return TPM_RC_SUCCESS;
84 #endif
85 #ifdef TPM_CC_ChangePPS
86     case TPM_CC_ChangePPS:
87       result = TPMI_RH_PLATFORM_Unmarshal(
88           (TPMI_RH_PLATFORM*)&request_handles[*num_request_handles],
89           request_handle_buffer_start, request_buffer_remaining_size);
90       if (result != TPM_RC_SUCCESS) {
91         return result;
92       }
93       ++(*num_request_handles);
94       return TPM_RC_SUCCESS;
95 #endif
96 #ifdef TPM_CC_Clear
97     case TPM_CC_Clear:
98       result = TPMI_RH_CLEAR_Unmarshal(
99           (TPMI_RH_CLEAR*)&request_handles[*num_request_handles],
100           request_handle_buffer_start, request_buffer_remaining_size);
101       if (result != TPM_RC_SUCCESS) {
102         return result;
103       }
104       ++(*num_request_handles);
105       return TPM_RC_SUCCESS;
106 #endif
107 #ifdef TPM_CC_ClearControl
108     case TPM_CC_ClearControl:
109       result = TPMI_RH_CLEAR_Unmarshal(
110           (TPMI_RH_CLEAR*)&request_handles[*num_request_handles],
111           request_handle_buffer_start, request_buffer_remaining_size);
112       if (result != TPM_RC_SUCCESS) {
113         return result;
114       }
115       ++(*num_request_handles);
116       return TPM_RC_SUCCESS;
117 #endif
118 #ifdef TPM_CC_ClockRateAdjust
119     case TPM_CC_ClockRateAdjust:
120       result = TPMI_RH_PROVISION_Unmarshal(
121           (TPMI_RH_PROVISION*)&request_handles[*num_request_handles],
122           request_handle_buffer_start, request_buffer_remaining_size);
123       if (result != TPM_RC_SUCCESS) {
124         return result;
125       }
126       ++(*num_request_handles);
127       return TPM_RC_SUCCESS;
128 #endif
129 #ifdef TPM_CC_ClockSet
130     case TPM_CC_ClockSet:
131       result = TPMI_RH_PROVISION_Unmarshal(
132           (TPMI_RH_PROVISION*)&request_handles[*num_request_handles],
133           request_handle_buffer_start, request_buffer_remaining_size);
134       if (result != TPM_RC_SUCCESS) {
135         return result;
136       }
137       ++(*num_request_handles);
138       return TPM_RC_SUCCESS;
139 #endif
140 #ifdef TPM_CC_Commit
141     case TPM_CC_Commit:
142       result = TPMI_DH_OBJECT_Unmarshal(
143           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
144           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
145       if (result != TPM_RC_SUCCESS) {
146         return result;
147       }
148       ++(*num_request_handles);
149       return TPM_RC_SUCCESS;
150 #endif
151 #ifdef TPM_CC_ContextLoad
152     case TPM_CC_ContextLoad:
153       return TPM_RC_SUCCESS;
154 #endif
155 #ifdef TPM_CC_ContextSave
156     case TPM_CC_ContextSave:
157       result = TPMI_DH_CONTEXT_Unmarshal(
158           (TPMI_DH_CONTEXT*)&request_handles[*num_request_handles],
159           request_handle_buffer_start, request_buffer_remaining_size);
160       if (result != TPM_RC_SUCCESS) {
161         return result;
162       }
163       ++(*num_request_handles);
164       return TPM_RC_SUCCESS;
165 #endif
166 #ifdef TPM_CC_Create
167     case TPM_CC_Create:
168       result = TPMI_DH_OBJECT_Unmarshal(
169           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
170           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
171       if (result != TPM_RC_SUCCESS) {
172         return result;
173       }
174       ++(*num_request_handles);
175       return TPM_RC_SUCCESS;
176 #endif
177 #ifdef TPM_CC_CreatePrimary
178     case TPM_CC_CreatePrimary:
179       result = TPMI_RH_HIERARCHY_Unmarshal(
180           (TPMI_RH_HIERARCHY*)&request_handles[*num_request_handles],
181           request_handle_buffer_start, request_buffer_remaining_size, TRUE);
182       if (result != TPM_RC_SUCCESS) {
183         return result;
184       }
185       ++(*num_request_handles);
186       return TPM_RC_SUCCESS;
187 #endif
188 #ifdef TPM_CC_DictionaryAttackLockReset
189     case TPM_CC_DictionaryAttackLockReset:
190       result = TPMI_RH_LOCKOUT_Unmarshal(
191           (TPMI_RH_LOCKOUT*)&request_handles[*num_request_handles],
192           request_handle_buffer_start, request_buffer_remaining_size);
193       if (result != TPM_RC_SUCCESS) {
194         return result;
195       }
196       ++(*num_request_handles);
197       return TPM_RC_SUCCESS;
198 #endif
199 #ifdef TPM_CC_DictionaryAttackParameters
200     case TPM_CC_DictionaryAttackParameters:
201       result = TPMI_RH_LOCKOUT_Unmarshal(
202           (TPMI_RH_LOCKOUT*)&request_handles[*num_request_handles],
203           request_handle_buffer_start, request_buffer_remaining_size);
204       if (result != TPM_RC_SUCCESS) {
205         return result;
206       }
207       ++(*num_request_handles);
208       return TPM_RC_SUCCESS;
209 #endif
210 #ifdef TPM_CC_Duplicate
211     case TPM_CC_Duplicate:
212       result = TPMI_DH_OBJECT_Unmarshal(
213           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
214           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
215       if (result != TPM_RC_SUCCESS) {
216         return result;
217       }
218       ++(*num_request_handles);
219       result = TPMI_DH_OBJECT_Unmarshal(
220           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
221           request_handle_buffer_start, request_buffer_remaining_size, TRUE);
222       if (result != TPM_RC_SUCCESS) {
223         return result;
224       }
225       ++(*num_request_handles);
226       return TPM_RC_SUCCESS;
227 #endif
228 #ifdef TPM_CC_ECC_Parameters
229     case TPM_CC_ECC_Parameters:
230       return TPM_RC_SUCCESS;
231 #endif
232 #ifdef TPM_CC_ECDH_KeyGen
233     case TPM_CC_ECDH_KeyGen:
234       result = TPMI_DH_OBJECT_Unmarshal(
235           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
236           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
237       if (result != TPM_RC_SUCCESS) {
238         return result;
239       }
240       ++(*num_request_handles);
241       return TPM_RC_SUCCESS;
242 #endif
243 #ifdef TPM_CC_ECDH_ZGen
244     case TPM_CC_ECDH_ZGen:
245       result = TPMI_DH_OBJECT_Unmarshal(
246           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
247           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
248       if (result != TPM_RC_SUCCESS) {
249         return result;
250       }
251       ++(*num_request_handles);
252       return TPM_RC_SUCCESS;
253 #endif
254 #ifdef TPM_CC_EC_Ephemeral
255     case TPM_CC_EC_Ephemeral:
256       return TPM_RC_SUCCESS;
257 #endif
258 #ifdef TPM_CC_EncryptDecrypt
259     case TPM_CC_EncryptDecrypt:
260       result = TPMI_DH_OBJECT_Unmarshal(
261           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
262           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
263       if (result != TPM_RC_SUCCESS) {
264         return result;
265       }
266       ++(*num_request_handles);
267       return TPM_RC_SUCCESS;
268 #endif
269 #ifdef TPM_CC_EventSequenceComplete
270     case TPM_CC_EventSequenceComplete:
271       result = TPMI_DH_PCR_Unmarshal(
272           (TPMI_DH_PCR*)&request_handles[*num_request_handles],
273           request_handle_buffer_start, request_buffer_remaining_size, TRUE);
274       if (result != TPM_RC_SUCCESS) {
275         return result;
276       }
277       ++(*num_request_handles);
278       result = TPMI_DH_OBJECT_Unmarshal(
279           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
280           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
281       if (result != TPM_RC_SUCCESS) {
282         return result;
283       }
284       ++(*num_request_handles);
285       return TPM_RC_SUCCESS;
286 #endif
287 #ifdef TPM_CC_EvictControl
288     case TPM_CC_EvictControl:
289       result = TPMI_RH_PROVISION_Unmarshal(
290           (TPMI_RH_PROVISION*)&request_handles[*num_request_handles],
291           request_handle_buffer_start, request_buffer_remaining_size);
292       if (result != TPM_RC_SUCCESS) {
293         return result;
294       }
295       ++(*num_request_handles);
296       result = TPMI_DH_OBJECT_Unmarshal(
297           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
298           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
299       if (result != TPM_RC_SUCCESS) {
300         return result;
301       }
302       ++(*num_request_handles);
303       return TPM_RC_SUCCESS;
304 #endif
305 #ifdef TPM_CC_FieldUpgradeData
306     case TPM_CC_FieldUpgradeData:
307       return TPM_RC_SUCCESS;
308 #endif
309 #ifdef TPM_CC_FieldUpgradeStart
310     case TPM_CC_FieldUpgradeStart:
311       result = TPMI_RH_PLATFORM_Unmarshal(
312           (TPMI_RH_PLATFORM*)&request_handles[*num_request_handles],
313           request_handle_buffer_start, request_buffer_remaining_size);
314       if (result != TPM_RC_SUCCESS) {
315         return result;
316       }
317       ++(*num_request_handles);
318       result = TPMI_DH_OBJECT_Unmarshal(
319           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
320           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
321       if (result != TPM_RC_SUCCESS) {
322         return result;
323       }
324       ++(*num_request_handles);
325       return TPM_RC_SUCCESS;
326 #endif
327 #ifdef TPM_CC_FirmwareRead
328     case TPM_CC_FirmwareRead:
329       return TPM_RC_SUCCESS;
330 #endif
331 #ifdef TPM_CC_FlushContext
332     case TPM_CC_FlushContext:
333       return TPM_RC_SUCCESS;
334 #endif
335 #ifdef TPM_CC_GetCapability
336     case TPM_CC_GetCapability:
337       return TPM_RC_SUCCESS;
338 #endif
339 #ifdef TPM_CC_GetCommandAuditDigest
340     case TPM_CC_GetCommandAuditDigest:
341       result = TPMI_RH_ENDORSEMENT_Unmarshal(
342           (TPMI_RH_ENDORSEMENT*)&request_handles[*num_request_handles],
343           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
344       if (result != TPM_RC_SUCCESS) {
345         return result;
346       }
347       ++(*num_request_handles);
348       result = TPMI_DH_OBJECT_Unmarshal(
349           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
350           request_handle_buffer_start, request_buffer_remaining_size, TRUE);
351       if (result != TPM_RC_SUCCESS) {
352         return result;
353       }
354       ++(*num_request_handles);
355       return TPM_RC_SUCCESS;
356 #endif
357 #ifdef TPM_CC_GetRandom
358     case TPM_CC_GetRandom:
359       return TPM_RC_SUCCESS;
360 #endif
361 #ifdef TPM_CC_GetSessionAuditDigest
362     case TPM_CC_GetSessionAuditDigest:
363       result = TPMI_RH_ENDORSEMENT_Unmarshal(
364           (TPMI_RH_ENDORSEMENT*)&request_handles[*num_request_handles],
365           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
366       if (result != TPM_RC_SUCCESS) {
367         return result;
368       }
369       ++(*num_request_handles);
370       result = TPMI_DH_OBJECT_Unmarshal(
371           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
372           request_handle_buffer_start, request_buffer_remaining_size, TRUE);
373       if (result != TPM_RC_SUCCESS) {
374         return result;
375       }
376       ++(*num_request_handles);
377       result = TPMI_SH_HMAC_Unmarshal(
378           (TPMI_SH_HMAC*)&request_handles[*num_request_handles],
379           request_handle_buffer_start, request_buffer_remaining_size);
380       if (result != TPM_RC_SUCCESS) {
381         return result;
382       }
383       ++(*num_request_handles);
384       return TPM_RC_SUCCESS;
385 #endif
386 #ifdef TPM_CC_GetTestResult
387     case TPM_CC_GetTestResult:
388       return TPM_RC_SUCCESS;
389 #endif
390 #ifdef TPM_CC_GetTime
391     case TPM_CC_GetTime:
392       result = TPMI_RH_ENDORSEMENT_Unmarshal(
393           (TPMI_RH_ENDORSEMENT*)&request_handles[*num_request_handles],
394           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
395       if (result != TPM_RC_SUCCESS) {
396         return result;
397       }
398       ++(*num_request_handles);
399       result = TPMI_DH_OBJECT_Unmarshal(
400           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
401           request_handle_buffer_start, request_buffer_remaining_size, TRUE);
402       if (result != TPM_RC_SUCCESS) {
403         return result;
404       }
405       ++(*num_request_handles);
406       return TPM_RC_SUCCESS;
407 #endif
408 #ifdef TPM_CC_HMAC
409     case TPM_CC_HMAC:
410       result = TPMI_DH_OBJECT_Unmarshal(
411           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
412           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
413       if (result != TPM_RC_SUCCESS) {
414         return result;
415       }
416       ++(*num_request_handles);
417       return TPM_RC_SUCCESS;
418 #endif
419 #ifdef TPM_CC_HMAC_Start
420     case TPM_CC_HMAC_Start:
421       result = TPMI_DH_OBJECT_Unmarshal(
422           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
423           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
424       if (result != TPM_RC_SUCCESS) {
425         return result;
426       }
427       ++(*num_request_handles);
428       return TPM_RC_SUCCESS;
429 #endif
430 #ifdef TPM_CC_Hash
431     case TPM_CC_Hash:
432       return TPM_RC_SUCCESS;
433 #endif
434 #ifdef TPM_CC_HashSequenceStart
435     case TPM_CC_HashSequenceStart:
436       return TPM_RC_SUCCESS;
437 #endif
438 #ifdef TPM_CC_HierarchyChangeAuth
439     case TPM_CC_HierarchyChangeAuth:
440       result = TPMI_RH_HIERARCHY_AUTH_Unmarshal(
441           (TPMI_RH_HIERARCHY_AUTH*)&request_handles[*num_request_handles],
442           request_handle_buffer_start, request_buffer_remaining_size);
443       if (result != TPM_RC_SUCCESS) {
444         return result;
445       }
446       ++(*num_request_handles);
447       return TPM_RC_SUCCESS;
448 #endif
449 #ifdef TPM_CC_HierarchyControl
450     case TPM_CC_HierarchyControl:
451       result = TPMI_RH_HIERARCHY_Unmarshal(
452           (TPMI_RH_HIERARCHY*)&request_handles[*num_request_handles],
453           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
454       if (result != TPM_RC_SUCCESS) {
455         return result;
456       }
457       ++(*num_request_handles);
458       return TPM_RC_SUCCESS;
459 #endif
460 #ifdef TPM_CC_Import
461     case TPM_CC_Import:
462       result = TPMI_DH_OBJECT_Unmarshal(
463           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
464           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
465       if (result != TPM_RC_SUCCESS) {
466         return result;
467       }
468       ++(*num_request_handles);
469       return TPM_RC_SUCCESS;
470 #endif
471 #ifdef TPM_CC_IncrementalSelfTest
472     case TPM_CC_IncrementalSelfTest:
473       return TPM_RC_SUCCESS;
474 #endif
475 #ifdef TPM_CC_Load
476     case TPM_CC_Load:
477       result = TPMI_DH_OBJECT_Unmarshal(
478           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
479           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
480       if (result != TPM_RC_SUCCESS) {
481         return result;
482       }
483       ++(*num_request_handles);
484       return TPM_RC_SUCCESS;
485 #endif
486 #ifdef TPM_CC_LoadExternal
487     case TPM_CC_LoadExternal:
488       return TPM_RC_SUCCESS;
489 #endif
490 #ifdef TPM_CC_MakeCredential
491     case TPM_CC_MakeCredential:
492       result = TPMI_DH_OBJECT_Unmarshal(
493           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
494           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
495       if (result != TPM_RC_SUCCESS) {
496         return result;
497       }
498       ++(*num_request_handles);
499       return TPM_RC_SUCCESS;
500 #endif
501 #ifdef TPM_CC_NV_Certify
502     case TPM_CC_NV_Certify:
503       result = TPMI_DH_OBJECT_Unmarshal(
504           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
505           request_handle_buffer_start, request_buffer_remaining_size, TRUE);
506       if (result != TPM_RC_SUCCESS) {
507         return result;
508       }
509       ++(*num_request_handles);
510       result = TPMI_RH_NV_AUTH_Unmarshal(
511           (TPMI_RH_NV_AUTH*)&request_handles[*num_request_handles],
512           request_handle_buffer_start, request_buffer_remaining_size);
513       if (result != TPM_RC_SUCCESS) {
514         return result;
515       }
516       ++(*num_request_handles);
517       result = TPMI_RH_NV_INDEX_Unmarshal(
518           (TPMI_RH_NV_INDEX*)&request_handles[*num_request_handles],
519           request_handle_buffer_start, request_buffer_remaining_size);
520       if (result != TPM_RC_SUCCESS) {
521         return result;
522       }
523       ++(*num_request_handles);
524       return TPM_RC_SUCCESS;
525 #endif
526 #ifdef TPM_CC_NV_ChangeAuth
527     case TPM_CC_NV_ChangeAuth:
528       result = TPMI_RH_NV_INDEX_Unmarshal(
529           (TPMI_RH_NV_INDEX*)&request_handles[*num_request_handles],
530           request_handle_buffer_start, request_buffer_remaining_size);
531       if (result != TPM_RC_SUCCESS) {
532         return result;
533       }
534       ++(*num_request_handles);
535       return TPM_RC_SUCCESS;
536 #endif
537 #ifdef TPM_CC_NV_DefineSpace
538     case TPM_CC_NV_DefineSpace:
539       result = TPMI_RH_PROVISION_Unmarshal(
540           (TPMI_RH_PROVISION*)&request_handles[*num_request_handles],
541           request_handle_buffer_start, request_buffer_remaining_size);
542       if (result != TPM_RC_SUCCESS) {
543         return result;
544       }
545       ++(*num_request_handles);
546       return TPM_RC_SUCCESS;
547 #endif
548 #ifdef TPM_CC_NV_Extend
549     case TPM_CC_NV_Extend:
550       result = TPMI_RH_NV_AUTH_Unmarshal(
551           (TPMI_RH_NV_AUTH*)&request_handles[*num_request_handles],
552           request_handle_buffer_start, request_buffer_remaining_size);
553       if (result != TPM_RC_SUCCESS) {
554         return result;
555       }
556       ++(*num_request_handles);
557       result = TPMI_RH_NV_INDEX_Unmarshal(
558           (TPMI_RH_NV_INDEX*)&request_handles[*num_request_handles],
559           request_handle_buffer_start, request_buffer_remaining_size);
560       if (result != TPM_RC_SUCCESS) {
561         return result;
562       }
563       ++(*num_request_handles);
564       return TPM_RC_SUCCESS;
565 #endif
566 #ifdef TPM_CC_NV_GlobalWriteLock
567     case TPM_CC_NV_GlobalWriteLock:
568       result = TPMI_RH_PROVISION_Unmarshal(
569           (TPMI_RH_PROVISION*)&request_handles[*num_request_handles],
570           request_handle_buffer_start, request_buffer_remaining_size);
571       if (result != TPM_RC_SUCCESS) {
572         return result;
573       }
574       ++(*num_request_handles);
575       return TPM_RC_SUCCESS;
576 #endif
577 #ifdef TPM_CC_NV_Increment
578     case TPM_CC_NV_Increment:
579       result = TPMI_RH_NV_AUTH_Unmarshal(
580           (TPMI_RH_NV_AUTH*)&request_handles[*num_request_handles],
581           request_handle_buffer_start, request_buffer_remaining_size);
582       if (result != TPM_RC_SUCCESS) {
583         return result;
584       }
585       ++(*num_request_handles);
586       result = TPMI_RH_NV_INDEX_Unmarshal(
587           (TPMI_RH_NV_INDEX*)&request_handles[*num_request_handles],
588           request_handle_buffer_start, request_buffer_remaining_size);
589       if (result != TPM_RC_SUCCESS) {
590         return result;
591       }
592       ++(*num_request_handles);
593       return TPM_RC_SUCCESS;
594 #endif
595 #ifdef TPM_CC_NV_Read
596     case TPM_CC_NV_Read:
597       result = TPMI_RH_NV_AUTH_Unmarshal(
598           (TPMI_RH_NV_AUTH*)&request_handles[*num_request_handles],
599           request_handle_buffer_start, request_buffer_remaining_size);
600       if (result != TPM_RC_SUCCESS) {
601         return result;
602       }
603       ++(*num_request_handles);
604       result = TPMI_RH_NV_INDEX_Unmarshal(
605           (TPMI_RH_NV_INDEX*)&request_handles[*num_request_handles],
606           request_handle_buffer_start, request_buffer_remaining_size);
607       if (result != TPM_RC_SUCCESS) {
608         return result;
609       }
610       ++(*num_request_handles);
611       return TPM_RC_SUCCESS;
612 #endif
613 #ifdef TPM_CC_NV_ReadLock
614     case TPM_CC_NV_ReadLock:
615       result = TPMI_RH_NV_AUTH_Unmarshal(
616           (TPMI_RH_NV_AUTH*)&request_handles[*num_request_handles],
617           request_handle_buffer_start, request_buffer_remaining_size);
618       if (result != TPM_RC_SUCCESS) {
619         return result;
620       }
621       ++(*num_request_handles);
622       result = TPMI_RH_NV_INDEX_Unmarshal(
623           (TPMI_RH_NV_INDEX*)&request_handles[*num_request_handles],
624           request_handle_buffer_start, request_buffer_remaining_size);
625       if (result != TPM_RC_SUCCESS) {
626         return result;
627       }
628       ++(*num_request_handles);
629       return TPM_RC_SUCCESS;
630 #endif
631 #ifdef TPM_CC_NV_ReadPublic
632     case TPM_CC_NV_ReadPublic:
633       result = TPMI_RH_NV_INDEX_Unmarshal(
634           (TPMI_RH_NV_INDEX*)&request_handles[*num_request_handles],
635           request_handle_buffer_start, request_buffer_remaining_size);
636       if (result != TPM_RC_SUCCESS) {
637         return result;
638       }
639       ++(*num_request_handles);
640       return TPM_RC_SUCCESS;
641 #endif
642 #ifdef TPM_CC_NV_SetBits
643     case TPM_CC_NV_SetBits:
644       result = TPMI_RH_NV_AUTH_Unmarshal(
645           (TPMI_RH_NV_AUTH*)&request_handles[*num_request_handles],
646           request_handle_buffer_start, request_buffer_remaining_size);
647       if (result != TPM_RC_SUCCESS) {
648         return result;
649       }
650       ++(*num_request_handles);
651       result = TPMI_RH_NV_INDEX_Unmarshal(
652           (TPMI_RH_NV_INDEX*)&request_handles[*num_request_handles],
653           request_handle_buffer_start, request_buffer_remaining_size);
654       if (result != TPM_RC_SUCCESS) {
655         return result;
656       }
657       ++(*num_request_handles);
658       return TPM_RC_SUCCESS;
659 #endif
660 #ifdef TPM_CC_NV_UndefineSpace
661     case TPM_CC_NV_UndefineSpace:
662       result = TPMI_RH_PROVISION_Unmarshal(
663           (TPMI_RH_PROVISION*)&request_handles[*num_request_handles],
664           request_handle_buffer_start, request_buffer_remaining_size);
665       if (result != TPM_RC_SUCCESS) {
666         return result;
667       }
668       ++(*num_request_handles);
669       result = TPMI_RH_NV_INDEX_Unmarshal(
670           (TPMI_RH_NV_INDEX*)&request_handles[*num_request_handles],
671           request_handle_buffer_start, request_buffer_remaining_size);
672       if (result != TPM_RC_SUCCESS) {
673         return result;
674       }
675       ++(*num_request_handles);
676       return TPM_RC_SUCCESS;
677 #endif
678 #ifdef TPM_CC_NV_UndefineSpaceSpecial
679     case TPM_CC_NV_UndefineSpaceSpecial:
680       result = TPMI_RH_NV_INDEX_Unmarshal(
681           (TPMI_RH_NV_INDEX*)&request_handles[*num_request_handles],
682           request_handle_buffer_start, request_buffer_remaining_size);
683       if (result != TPM_RC_SUCCESS) {
684         return result;
685       }
686       ++(*num_request_handles);
687       result = TPMI_RH_PLATFORM_Unmarshal(
688           (TPMI_RH_PLATFORM*)&request_handles[*num_request_handles],
689           request_handle_buffer_start, request_buffer_remaining_size);
690       if (result != TPM_RC_SUCCESS) {
691         return result;
692       }
693       ++(*num_request_handles);
694       return TPM_RC_SUCCESS;
695 #endif
696 #ifdef TPM_CC_NV_Write
697     case TPM_CC_NV_Write:
698       result = TPMI_RH_NV_AUTH_Unmarshal(
699           (TPMI_RH_NV_AUTH*)&request_handles[*num_request_handles],
700           request_handle_buffer_start, request_buffer_remaining_size);
701       if (result != TPM_RC_SUCCESS) {
702         return result;
703       }
704       ++(*num_request_handles);
705       result = TPMI_RH_NV_INDEX_Unmarshal(
706           (TPMI_RH_NV_INDEX*)&request_handles[*num_request_handles],
707           request_handle_buffer_start, request_buffer_remaining_size);
708       if (result != TPM_RC_SUCCESS) {
709         return result;
710       }
711       ++(*num_request_handles);
712       return TPM_RC_SUCCESS;
713 #endif
714 #ifdef TPM_CC_NV_WriteLock
715     case TPM_CC_NV_WriteLock:
716       result = TPMI_RH_NV_AUTH_Unmarshal(
717           (TPMI_RH_NV_AUTH*)&request_handles[*num_request_handles],
718           request_handle_buffer_start, request_buffer_remaining_size);
719       if (result != TPM_RC_SUCCESS) {
720         return result;
721       }
722       ++(*num_request_handles);
723       result = TPMI_RH_NV_INDEX_Unmarshal(
724           (TPMI_RH_NV_INDEX*)&request_handles[*num_request_handles],
725           request_handle_buffer_start, request_buffer_remaining_size);
726       if (result != TPM_RC_SUCCESS) {
727         return result;
728       }
729       ++(*num_request_handles);
730       return TPM_RC_SUCCESS;
731 #endif
732 #ifdef TPM_CC_ObjectChangeAuth
733     case TPM_CC_ObjectChangeAuth:
734       result = TPMI_DH_OBJECT_Unmarshal(
735           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
736           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
737       if (result != TPM_RC_SUCCESS) {
738         return result;
739       }
740       ++(*num_request_handles);
741       result = TPMI_DH_OBJECT_Unmarshal(
742           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
743           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
744       if (result != TPM_RC_SUCCESS) {
745         return result;
746       }
747       ++(*num_request_handles);
748       return TPM_RC_SUCCESS;
749 #endif
750 #ifdef TPM_CC_PCR_Allocate
751     case TPM_CC_PCR_Allocate:
752       result = TPMI_RH_PLATFORM_Unmarshal(
753           (TPMI_RH_PLATFORM*)&request_handles[*num_request_handles],
754           request_handle_buffer_start, request_buffer_remaining_size);
755       if (result != TPM_RC_SUCCESS) {
756         return result;
757       }
758       ++(*num_request_handles);
759       return TPM_RC_SUCCESS;
760 #endif
761 #ifdef TPM_CC_PCR_Event
762     case TPM_CC_PCR_Event:
763       result = TPMI_DH_PCR_Unmarshal(
764           (TPMI_DH_PCR*)&request_handles[*num_request_handles],
765           request_handle_buffer_start, request_buffer_remaining_size, TRUE);
766       if (result != TPM_RC_SUCCESS) {
767         return result;
768       }
769       ++(*num_request_handles);
770       return TPM_RC_SUCCESS;
771 #endif
772 #ifdef TPM_CC_PCR_Extend
773     case TPM_CC_PCR_Extend:
774       result = TPMI_DH_PCR_Unmarshal(
775           (TPMI_DH_PCR*)&request_handles[*num_request_handles],
776           request_handle_buffer_start, request_buffer_remaining_size, TRUE);
777       if (result != TPM_RC_SUCCESS) {
778         return result;
779       }
780       ++(*num_request_handles);
781       return TPM_RC_SUCCESS;
782 #endif
783 #ifdef TPM_CC_PCR_Read
784     case TPM_CC_PCR_Read:
785       return TPM_RC_SUCCESS;
786 #endif
787 #ifdef TPM_CC_PCR_Reset
788     case TPM_CC_PCR_Reset:
789       result = TPMI_DH_PCR_Unmarshal(
790           (TPMI_DH_PCR*)&request_handles[*num_request_handles],
791           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
792       if (result != TPM_RC_SUCCESS) {
793         return result;
794       }
795       ++(*num_request_handles);
796       return TPM_RC_SUCCESS;
797 #endif
798 #ifdef TPM_CC_PCR_SetAuthPolicy
799     case TPM_CC_PCR_SetAuthPolicy:
800       result = TPMI_RH_PLATFORM_Unmarshal(
801           (TPMI_RH_PLATFORM*)&request_handles[*num_request_handles],
802           request_handle_buffer_start, request_buffer_remaining_size);
803       if (result != TPM_RC_SUCCESS) {
804         return result;
805       }
806       ++(*num_request_handles);
807       result = TPMI_DH_PCR_Unmarshal(
808           (TPMI_DH_PCR*)&request_handles[*num_request_handles],
809           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
810       if (result != TPM_RC_SUCCESS) {
811         return result;
812       }
813       ++(*num_request_handles);
814       return TPM_RC_SUCCESS;
815 #endif
816 #ifdef TPM_CC_PCR_SetAuthValue
817     case TPM_CC_PCR_SetAuthValue:
818       result = TPMI_DH_PCR_Unmarshal(
819           (TPMI_DH_PCR*)&request_handles[*num_request_handles],
820           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
821       if (result != TPM_RC_SUCCESS) {
822         return result;
823       }
824       ++(*num_request_handles);
825       return TPM_RC_SUCCESS;
826 #endif
827 #ifdef TPM_CC_PP_Commands
828     case TPM_CC_PP_Commands:
829       result = TPMI_RH_PLATFORM_Unmarshal(
830           (TPMI_RH_PLATFORM*)&request_handles[*num_request_handles],
831           request_handle_buffer_start, request_buffer_remaining_size);
832       if (result != TPM_RC_SUCCESS) {
833         return result;
834       }
835       ++(*num_request_handles);
836       return TPM_RC_SUCCESS;
837 #endif
838 #ifdef TPM_CC_PolicyAuthValue
839     case TPM_CC_PolicyAuthValue:
840       result = TPMI_SH_POLICY_Unmarshal(
841           (TPMI_SH_POLICY*)&request_handles[*num_request_handles],
842           request_handle_buffer_start, request_buffer_remaining_size);
843       if (result != TPM_RC_SUCCESS) {
844         return result;
845       }
846       ++(*num_request_handles);
847       return TPM_RC_SUCCESS;
848 #endif
849 #ifdef TPM_CC_PolicyAuthorize
850     case TPM_CC_PolicyAuthorize:
851       result = TPMI_SH_POLICY_Unmarshal(
852           (TPMI_SH_POLICY*)&request_handles[*num_request_handles],
853           request_handle_buffer_start, request_buffer_remaining_size);
854       if (result != TPM_RC_SUCCESS) {
855         return result;
856       }
857       ++(*num_request_handles);
858       return TPM_RC_SUCCESS;
859 #endif
860 #ifdef TPM_CC_PolicyCommandCode
861     case TPM_CC_PolicyCommandCode:
862       result = TPMI_SH_POLICY_Unmarshal(
863           (TPMI_SH_POLICY*)&request_handles[*num_request_handles],
864           request_handle_buffer_start, request_buffer_remaining_size);
865       if (result != TPM_RC_SUCCESS) {
866         return result;
867       }
868       ++(*num_request_handles);
869       return TPM_RC_SUCCESS;
870 #endif
871 #ifdef TPM_CC_PolicyCounterTimer
872     case TPM_CC_PolicyCounterTimer:
873       result = TPMI_SH_POLICY_Unmarshal(
874           (TPMI_SH_POLICY*)&request_handles[*num_request_handles],
875           request_handle_buffer_start, request_buffer_remaining_size);
876       if (result != TPM_RC_SUCCESS) {
877         return result;
878       }
879       ++(*num_request_handles);
880       return TPM_RC_SUCCESS;
881 #endif
882 #ifdef TPM_CC_PolicyCpHash
883     case TPM_CC_PolicyCpHash:
884       result = TPMI_SH_POLICY_Unmarshal(
885           (TPMI_SH_POLICY*)&request_handles[*num_request_handles],
886           request_handle_buffer_start, request_buffer_remaining_size);
887       if (result != TPM_RC_SUCCESS) {
888         return result;
889       }
890       ++(*num_request_handles);
891       return TPM_RC_SUCCESS;
892 #endif
893 #ifdef TPM_CC_PolicyDuplicationSelect
894     case TPM_CC_PolicyDuplicationSelect:
895       result = TPMI_SH_POLICY_Unmarshal(
896           (TPMI_SH_POLICY*)&request_handles[*num_request_handles],
897           request_handle_buffer_start, request_buffer_remaining_size);
898       if (result != TPM_RC_SUCCESS) {
899         return result;
900       }
901       ++(*num_request_handles);
902       return TPM_RC_SUCCESS;
903 #endif
904 #ifdef TPM_CC_PolicyGetDigest
905     case TPM_CC_PolicyGetDigest:
906       result = TPMI_SH_POLICY_Unmarshal(
907           (TPMI_SH_POLICY*)&request_handles[*num_request_handles],
908           request_handle_buffer_start, request_buffer_remaining_size);
909       if (result != TPM_RC_SUCCESS) {
910         return result;
911       }
912       ++(*num_request_handles);
913       return TPM_RC_SUCCESS;
914 #endif
915 #ifdef TPM_CC_PolicyLocality
916     case TPM_CC_PolicyLocality:
917       result = TPMI_SH_POLICY_Unmarshal(
918           (TPMI_SH_POLICY*)&request_handles[*num_request_handles],
919           request_handle_buffer_start, request_buffer_remaining_size);
920       if (result != TPM_RC_SUCCESS) {
921         return result;
922       }
923       ++(*num_request_handles);
924       return TPM_RC_SUCCESS;
925 #endif
926 #ifdef TPM_CC_PolicyNV
927     case TPM_CC_PolicyNV:
928       result = TPMI_RH_NV_AUTH_Unmarshal(
929           (TPMI_RH_NV_AUTH*)&request_handles[*num_request_handles],
930           request_handle_buffer_start, request_buffer_remaining_size);
931       if (result != TPM_RC_SUCCESS) {
932         return result;
933       }
934       ++(*num_request_handles);
935       result = TPMI_RH_NV_INDEX_Unmarshal(
936           (TPMI_RH_NV_INDEX*)&request_handles[*num_request_handles],
937           request_handle_buffer_start, request_buffer_remaining_size);
938       if (result != TPM_RC_SUCCESS) {
939         return result;
940       }
941       ++(*num_request_handles);
942       result = TPMI_SH_POLICY_Unmarshal(
943           (TPMI_SH_POLICY*)&request_handles[*num_request_handles],
944           request_handle_buffer_start, request_buffer_remaining_size);
945       if (result != TPM_RC_SUCCESS) {
946         return result;
947       }
948       ++(*num_request_handles);
949       return TPM_RC_SUCCESS;
950 #endif
951 #ifdef TPM_CC_PolicyNameHash
952     case TPM_CC_PolicyNameHash:
953       result = TPMI_SH_POLICY_Unmarshal(
954           (TPMI_SH_POLICY*)&request_handles[*num_request_handles],
955           request_handle_buffer_start, request_buffer_remaining_size);
956       if (result != TPM_RC_SUCCESS) {
957         return result;
958       }
959       ++(*num_request_handles);
960       return TPM_RC_SUCCESS;
961 #endif
962 #ifdef TPM_CC_PolicyNvWritten
963     case TPM_CC_PolicyNvWritten:
964       result = TPMI_SH_POLICY_Unmarshal(
965           (TPMI_SH_POLICY*)&request_handles[*num_request_handles],
966           request_handle_buffer_start, request_buffer_remaining_size);
967       if (result != TPM_RC_SUCCESS) {
968         return result;
969       }
970       ++(*num_request_handles);
971       return TPM_RC_SUCCESS;
972 #endif
973 #ifdef TPM_CC_PolicyOR
974     case TPM_CC_PolicyOR:
975       result = TPMI_SH_POLICY_Unmarshal(
976           (TPMI_SH_POLICY*)&request_handles[*num_request_handles],
977           request_handle_buffer_start, request_buffer_remaining_size);
978       if (result != TPM_RC_SUCCESS) {
979         return result;
980       }
981       ++(*num_request_handles);
982       return TPM_RC_SUCCESS;
983 #endif
984 #ifdef TPM_CC_PolicyPCR
985     case TPM_CC_PolicyPCR:
986       result = TPMI_SH_POLICY_Unmarshal(
987           (TPMI_SH_POLICY*)&request_handles[*num_request_handles],
988           request_handle_buffer_start, request_buffer_remaining_size);
989       if (result != TPM_RC_SUCCESS) {
990         return result;
991       }
992       ++(*num_request_handles);
993       return TPM_RC_SUCCESS;
994 #endif
995 #ifdef TPM_CC_PolicyPassword
996     case TPM_CC_PolicyPassword:
997       result = TPMI_SH_POLICY_Unmarshal(
998           (TPMI_SH_POLICY*)&request_handles[*num_request_handles],
999           request_handle_buffer_start, request_buffer_remaining_size);
1000       if (result != TPM_RC_SUCCESS) {
1001         return result;
1002       }
1003       ++(*num_request_handles);
1004       return TPM_RC_SUCCESS;
1005 #endif
1006 #ifdef TPM_CC_PolicyPhysicalPresence
1007     case TPM_CC_PolicyPhysicalPresence:
1008       result = TPMI_SH_POLICY_Unmarshal(
1009           (TPMI_SH_POLICY*)&request_handles[*num_request_handles],
1010           request_handle_buffer_start, request_buffer_remaining_size);
1011       if (result != TPM_RC_SUCCESS) {
1012         return result;
1013       }
1014       ++(*num_request_handles);
1015       return TPM_RC_SUCCESS;
1016 #endif
1017 #ifdef TPM_CC_PolicyRestart
1018     case TPM_CC_PolicyRestart:
1019       result = TPMI_SH_POLICY_Unmarshal(
1020           (TPMI_SH_POLICY*)&request_handles[*num_request_handles],
1021           request_handle_buffer_start, request_buffer_remaining_size);
1022       if (result != TPM_RC_SUCCESS) {
1023         return result;
1024       }
1025       ++(*num_request_handles);
1026       return TPM_RC_SUCCESS;
1027 #endif
1028 #ifdef TPM_CC_PolicySecret
1029     case TPM_CC_PolicySecret:
1030       result = TPMI_DH_ENTITY_Unmarshal(
1031           (TPMI_DH_ENTITY*)&request_handles[*num_request_handles],
1032           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
1033       if (result != TPM_RC_SUCCESS) {
1034         return result;
1035       }
1036       ++(*num_request_handles);
1037       result = TPMI_SH_POLICY_Unmarshal(
1038           (TPMI_SH_POLICY*)&request_handles[*num_request_handles],
1039           request_handle_buffer_start, request_buffer_remaining_size);
1040       if (result != TPM_RC_SUCCESS) {
1041         return result;
1042       }
1043       ++(*num_request_handles);
1044       return TPM_RC_SUCCESS;
1045 #endif
1046 #ifdef TPM_CC_PolicySigned
1047     case TPM_CC_PolicySigned:
1048       result = TPMI_DH_OBJECT_Unmarshal(
1049           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
1050           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
1051       if (result != TPM_RC_SUCCESS) {
1052         return result;
1053       }
1054       ++(*num_request_handles);
1055       result = TPMI_SH_POLICY_Unmarshal(
1056           (TPMI_SH_POLICY*)&request_handles[*num_request_handles],
1057           request_handle_buffer_start, request_buffer_remaining_size);
1058       if (result != TPM_RC_SUCCESS) {
1059         return result;
1060       }
1061       ++(*num_request_handles);
1062       return TPM_RC_SUCCESS;
1063 #endif
1064 #ifdef TPM_CC_PolicyTicket
1065     case TPM_CC_PolicyTicket:
1066       result = TPMI_SH_POLICY_Unmarshal(
1067           (TPMI_SH_POLICY*)&request_handles[*num_request_handles],
1068           request_handle_buffer_start, request_buffer_remaining_size);
1069       if (result != TPM_RC_SUCCESS) {
1070         return result;
1071       }
1072       ++(*num_request_handles);
1073       return TPM_RC_SUCCESS;
1074 #endif
1075 #ifdef TPM_CC_Quote
1076     case TPM_CC_Quote:
1077       result = TPMI_DH_OBJECT_Unmarshal(
1078           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
1079           request_handle_buffer_start, request_buffer_remaining_size, TRUE);
1080       if (result != TPM_RC_SUCCESS) {
1081         return result;
1082       }
1083       ++(*num_request_handles);
1084       return TPM_RC_SUCCESS;
1085 #endif
1086 #ifdef TPM_CC_RSA_Decrypt
1087     case TPM_CC_RSA_Decrypt:
1088       result = TPMI_DH_OBJECT_Unmarshal(
1089           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
1090           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
1091       if (result != TPM_RC_SUCCESS) {
1092         return result;
1093       }
1094       ++(*num_request_handles);
1095       return TPM_RC_SUCCESS;
1096 #endif
1097 #ifdef TPM_CC_RSA_Encrypt
1098     case TPM_CC_RSA_Encrypt:
1099       result = TPMI_DH_OBJECT_Unmarshal(
1100           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
1101           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
1102       if (result != TPM_RC_SUCCESS) {
1103         return result;
1104       }
1105       ++(*num_request_handles);
1106       return TPM_RC_SUCCESS;
1107 #endif
1108 #ifdef TPM_CC_ReadClock
1109     case TPM_CC_ReadClock:
1110       return TPM_RC_SUCCESS;
1111 #endif
1112 #ifdef TPM_CC_ReadPublic
1113     case TPM_CC_ReadPublic:
1114       result = TPMI_DH_OBJECT_Unmarshal(
1115           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
1116           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
1117       if (result != TPM_RC_SUCCESS) {
1118         return result;
1119       }
1120       ++(*num_request_handles);
1121       return TPM_RC_SUCCESS;
1122 #endif
1123 #ifdef TPM_CC_Rewrap
1124     case TPM_CC_Rewrap:
1125       result = TPMI_DH_OBJECT_Unmarshal(
1126           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
1127           request_handle_buffer_start, request_buffer_remaining_size, TRUE);
1128       if (result != TPM_RC_SUCCESS) {
1129         return result;
1130       }
1131       ++(*num_request_handles);
1132       result = TPMI_DH_OBJECT_Unmarshal(
1133           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
1134           request_handle_buffer_start, request_buffer_remaining_size, TRUE);
1135       if (result != TPM_RC_SUCCESS) {
1136         return result;
1137       }
1138       ++(*num_request_handles);
1139       return TPM_RC_SUCCESS;
1140 #endif
1141 #ifdef TPM_CC_SelfTest
1142     case TPM_CC_SelfTest:
1143       return TPM_RC_SUCCESS;
1144 #endif
1145 #ifdef TPM_CC_SequenceComplete
1146     case TPM_CC_SequenceComplete:
1147       result = TPMI_DH_OBJECT_Unmarshal(
1148           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
1149           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
1150       if (result != TPM_RC_SUCCESS) {
1151         return result;
1152       }
1153       ++(*num_request_handles);
1154       return TPM_RC_SUCCESS;
1155 #endif
1156 #ifdef TPM_CC_SequenceUpdate
1157     case TPM_CC_SequenceUpdate:
1158       result = TPMI_DH_OBJECT_Unmarshal(
1159           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
1160           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
1161       if (result != TPM_RC_SUCCESS) {
1162         return result;
1163       }
1164       ++(*num_request_handles);
1165       return TPM_RC_SUCCESS;
1166 #endif
1167 #ifdef TPM_CC_SetAlgorithmSet
1168     case TPM_CC_SetAlgorithmSet:
1169       result = TPMI_RH_PLATFORM_Unmarshal(
1170           (TPMI_RH_PLATFORM*)&request_handles[*num_request_handles],
1171           request_handle_buffer_start, request_buffer_remaining_size);
1172       if (result != TPM_RC_SUCCESS) {
1173         return result;
1174       }
1175       ++(*num_request_handles);
1176       return TPM_RC_SUCCESS;
1177 #endif
1178 #ifdef TPM_CC_SetCommandCodeAuditStatus
1179     case TPM_CC_SetCommandCodeAuditStatus:
1180       result = TPMI_RH_PROVISION_Unmarshal(
1181           (TPMI_RH_PROVISION*)&request_handles[*num_request_handles],
1182           request_handle_buffer_start, request_buffer_remaining_size);
1183       if (result != TPM_RC_SUCCESS) {
1184         return result;
1185       }
1186       ++(*num_request_handles);
1187       return TPM_RC_SUCCESS;
1188 #endif
1189 #ifdef TPM_CC_SetPrimaryPolicy
1190     case TPM_CC_SetPrimaryPolicy:
1191       result = TPMI_RH_HIERARCHY_AUTH_Unmarshal(
1192           (TPMI_RH_HIERARCHY_AUTH*)&request_handles[*num_request_handles],
1193           request_handle_buffer_start, request_buffer_remaining_size);
1194       if (result != TPM_RC_SUCCESS) {
1195         return result;
1196       }
1197       ++(*num_request_handles);
1198       return TPM_RC_SUCCESS;
1199 #endif
1200 #ifdef TPM_CC_Shutdown
1201     case TPM_CC_Shutdown:
1202       return TPM_RC_SUCCESS;
1203 #endif
1204 #ifdef TPM_CC_Sign
1205     case TPM_CC_Sign:
1206       result = TPMI_DH_OBJECT_Unmarshal(
1207           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
1208           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
1209       if (result != TPM_RC_SUCCESS) {
1210         return result;
1211       }
1212       ++(*num_request_handles);
1213       return TPM_RC_SUCCESS;
1214 #endif
1215 #ifdef TPM_CC_StartAuthSession
1216     case TPM_CC_StartAuthSession:
1217       result = TPMI_DH_OBJECT_Unmarshal(
1218           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
1219           request_handle_buffer_start, request_buffer_remaining_size, TRUE);
1220       if (result != TPM_RC_SUCCESS) {
1221         return result;
1222       }
1223       ++(*num_request_handles);
1224       result = TPMI_DH_ENTITY_Unmarshal(
1225           (TPMI_DH_ENTITY*)&request_handles[*num_request_handles],
1226           request_handle_buffer_start, request_buffer_remaining_size, TRUE);
1227       if (result != TPM_RC_SUCCESS) {
1228         return result;
1229       }
1230       ++(*num_request_handles);
1231       return TPM_RC_SUCCESS;
1232 #endif
1233 #ifdef TPM_CC_Startup
1234     case TPM_CC_Startup:
1235       return TPM_RC_SUCCESS;
1236 #endif
1237 #ifdef TPM_CC_StirRandom
1238     case TPM_CC_StirRandom:
1239       return TPM_RC_SUCCESS;
1240 #endif
1241 #ifdef TPM_CC_TestParms
1242     case TPM_CC_TestParms:
1243       return TPM_RC_SUCCESS;
1244 #endif
1245 #ifdef TPM_CC_Unseal
1246     case TPM_CC_Unseal:
1247       result = TPMI_DH_OBJECT_Unmarshal(
1248           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
1249           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
1250       if (result != TPM_RC_SUCCESS) {
1251         return result;
1252       }
1253       ++(*num_request_handles);
1254       return TPM_RC_SUCCESS;
1255 #endif
1256 #ifdef TPM_CC_VerifySignature
1257     case TPM_CC_VerifySignature:
1258       result = TPMI_DH_OBJECT_Unmarshal(
1259           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
1260           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
1261       if (result != TPM_RC_SUCCESS) {
1262         return result;
1263       }
1264       ++(*num_request_handles);
1265       return TPM_RC_SUCCESS;
1266 #endif
1267 #ifdef TPM_CC_ZGen_2Phase
1268     case TPM_CC_ZGen_2Phase:
1269       result = TPMI_DH_OBJECT_Unmarshal(
1270           (TPMI_DH_OBJECT*)&request_handles[*num_request_handles],
1271           request_handle_buffer_start, request_buffer_remaining_size, FALSE);
1272       if (result != TPM_RC_SUCCESS) {
1273         return result;
1274       }
1275       ++(*num_request_handles);
1276       return TPM_RC_SUCCESS;
1277 #endif
1278     default:
1279       return TPM_RC_COMMAND_CODE;
1280   }
1281 }