1 /* Microsoft Reference Implementation for TPM 2.0
2  *
3  *  The copyright in this software is being made available under the BSD License,
4  *  included below. This software may be subject to other third party and
5  *  contributor rights, including patent rights, and no such rights are granted
6  *  under this license.
7  *
8  *  Copyright (c) Microsoft Corporation
9  *
10  *  All rights reserved.
11  *
12  *  BSD License
13  *
14  *  Redistribution and use in source and binary forms, with or without modification,
15  *  are permitted provided that the following conditions are met:
16  *
17  *  Redistributions of source code must retain the above copyright notice, this list
18  *  of conditions and the following disclaimer.
19  *
20  *  Redistributions in binary form must reproduce the above copyright notice, this
21  *  list of conditions and the following disclaimer in the documentation and/or
22  *  other materials provided with the distribution.
23  *
24  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS""
25  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27  *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
28  *  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29  *  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
31  *  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33  *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35 /*(Auto-generated)
36  *  Created by NewMarshal; Version 1.4 Apr 7, 2019
37  *  Date: Mar  6, 2020  Time: 01:50:10PM
38  */
39 
40 #ifndef _TABLE_MARSHAL_DEFINES_H_
41 #define _TABLE_MARSHAL_DEFINES_H_
42 
43 
44 #define NULL_SHIFT  15
45 #define NULL_FLAG   (1 << NULL_SHIFT)
46 
47 // The range macro processes a min, max value and produces a values that is used in
48 // the computation to see if something is within a range. The max value is (max-min).
49 // This lets the check for something ('val') within a range become:
50 //   if((val - min) <= max) // passes if in range
51 //   if((val - min) > max) // passes if not in range
52 // This works because all values are converted to UINT32 values before the compare.
53 // For (val - min), all values greater than or equal to val will become positive
54 // values with a value equal to 'min' being zero. This means that in an unsigned
55 // compare against 'max,' any value that is outside the range will appear to be a
56 // number greater than max. The benefit of this operation is that this will work even
57 // if the input value is a signed number as long as the input is sign extended.
58 
59 #define RANGE(_min_, _max_, _base_)                                                  \
60     (UINT32)_min_, (UINT32)((_base_)(_max_ - _min_))
61 
62 // This macro is like the offsetof macro but, instead of computing the offset of
63 // a structure element, it computes the stride between elements that are in a
64 // structure array. This is used instead of sizeof() because the sizeof() operator on
65 // a structure can return an implementation dependent value.
66 #define STRIDE(s)   ((UINT16)(size_t)&(((s *)0)[1]))
67 
68 #define MARSHAL_REF(TYPE)   ((UINT16)(offsetof(MARSHAL_DATA, TYPE)))
69 
70 
71 // This macro creates the entry in the array lookup table
72 #define ARRAY_MARSHAL_ENTRY(TYPE)                                                   \
73         {(marshalIndex_t)TYPE##_MARSHAL_REF, (UINT16)STRIDE(TYPE)}
74 
75 // Defines for array lookup
76 #define UINT8_ARRAY_MARSHAL_INDEX                   0   // 0x00
77 #define TPM_CC_ARRAY_MARSHAL_INDEX                  1   // 0x01
78 #define TPMA_CC_ARRAY_MARSHAL_INDEX                 2   // 0x02
79 #define TPM_ALG_ID_ARRAY_MARSHAL_INDEX              3   // 0x03
80 #define TPM_HANDLE_ARRAY_MARSHAL_INDEX              4   // 0x04
81 #define TPM2B_DIGEST_ARRAY_MARSHAL_INDEX            5   // 0x05
82 #define TPMT_HA_ARRAY_MARSHAL_INDEX                 6   // 0x06
83 #define TPMS_PCR_SELECTION_ARRAY_MARSHAL_INDEX      7   // 0x07
84 #define TPMS_ALG_PROPERTY_ARRAY_MARSHAL_INDEX       8   // 0x08
85 #define TPMS_TAGGED_PROPERTY_ARRAY_MARSHAL_INDEX    9   // 0x09
86 #define TPMS_TAGGED_PCR_SELECT_ARRAY_MARSHAL_INDEX  10  // 0x0A
87 #define TPM_ECC_CURVE_ARRAY_MARSHAL_INDEX           11  // 0x0B
88 #define TPMS_TAGGED_POLICY_ARRAY_MARSHAL_INDEX      12  // 0x0C
89 #define TPMS_ACT_DATA_ARRAY_MARSHAL_INDEX           13  // 0x0D
90 #define TPMS_AC_OUTPUT_ARRAY_MARSHAL_INDEX          14  // 0x0E
91 
92 
93 // Defines for referencing a type by offset
94 #define UINT8_MARSHAL_REF                           \
95             ((UINT16)(offsetof(MarshalData_st, UINT8_DATA)))
96 #define BYTE_MARSHAL_REF                            UINT8_MARSHAL_REF
97 #define TPM_HT_MARSHAL_REF                          UINT8_MARSHAL_REF
98 #define TPMA_LOCALITY_MARSHAL_REF                   UINT8_MARSHAL_REF
99 #define UINT16_MARSHAL_REF                          \
100             ((UINT16)(offsetof(MarshalData_st, UINT16_DATA)))
101 #define TPM_KEY_SIZE_MARSHAL_REF                    UINT16_MARSHAL_REF
102 #define TPM_KEY_BITS_MARSHAL_REF                    UINT16_MARSHAL_REF
103 #define TPM_ALG_ID_MARSHAL_REF                      UINT16_MARSHAL_REF
104 #define TPM_ST_MARSHAL_REF                          UINT16_MARSHAL_REF
105 #define UINT32_MARSHAL_REF                          \
106             ((UINT16)(offsetof(MarshalData_st, UINT32_DATA)))
107 #define TPM_ALGORITHM_ID_MARSHAL_REF                UINT32_MARSHAL_REF
108 #define TPM_MODIFIER_INDICATOR_MARSHAL_REF          UINT32_MARSHAL_REF
109 #define TPM_AUTHORIZATION_SIZE_MARSHAL_REF          UINT32_MARSHAL_REF
110 #define TPM_PARAMETER_SIZE_MARSHAL_REF              UINT32_MARSHAL_REF
111 #define TPM_SPEC_MARSHAL_REF                        UINT32_MARSHAL_REF
112 #define TPM_CONSTANTS32_MARSHAL_REF                 UINT32_MARSHAL_REF
113 #define TPM_CC_MARSHAL_REF                          UINT32_MARSHAL_REF
114 #define TPM_RC_MARSHAL_REF                          UINT32_MARSHAL_REF
115 #define TPM_PT_MARSHAL_REF                          UINT32_MARSHAL_REF
116 #define TPM_PT_PCR_MARSHAL_REF                      UINT32_MARSHAL_REF
117 #define TPM_PS_MARSHAL_REF                          UINT32_MARSHAL_REF
118 #define TPM_HANDLE_MARSHAL_REF                      UINT32_MARSHAL_REF
119 #define TPM_RH_MARSHAL_REF                          UINT32_MARSHAL_REF
120 #define TPM_HC_MARSHAL_REF                          UINT32_MARSHAL_REF
121 #define TPMA_PERMANENT_MARSHAL_REF                  UINT32_MARSHAL_REF
122 #define TPMA_STARTUP_CLEAR_MARSHAL_REF              UINT32_MARSHAL_REF
123 #define TPMA_MEMORY_MARSHAL_REF                     UINT32_MARSHAL_REF
124 #define TPMA_CC_MARSHAL_REF                         UINT32_MARSHAL_REF
125 #define TPMA_MODES_MARSHAL_REF                      UINT32_MARSHAL_REF
126 #define TPMA_X509_KEY_USAGE_MARSHAL_REF             UINT32_MARSHAL_REF
127 #define TPM_NV_INDEX_MARSHAL_REF                    UINT32_MARSHAL_REF
128 #define TPM_AE_MARSHAL_REF                          UINT32_MARSHAL_REF
129 #define UINT64_MARSHAL_REF                          \
130             ((UINT16)(offsetof(MarshalData_st, UINT64_DATA)))
131 #define INT8_MARSHAL_REF                            \
132             ((UINT16)(offsetof(MarshalData_st, INT8_DATA)))
133 #define INT16_MARSHAL_REF                           \
134             ((UINT16)(offsetof(MarshalData_st, INT16_DATA)))
135 #define INT32_MARSHAL_REF                           \
136             ((UINT16)(offsetof(MarshalData_st, INT32_DATA)))
137 #define INT64_MARSHAL_REF                           \
138             ((UINT16)(offsetof(MarshalData_st, INT64_DATA)))
139 #define UINT0_MARSHAL_REF                           \
140             ((UINT16)(offsetof(MarshalData_st, UINT0_DATA)))
141 #define TPM_ECC_CURVE_MARSHAL_REF                   \
142             ((UINT16)(offsetof(MarshalData_st, TPM_ECC_CURVE_DATA)))
143 #define TPM_CLOCK_ADJUST_MARSHAL_REF                \
144             ((UINT16)(offsetof(MarshalData_st, TPM_CLOCK_ADJUST_DATA)))
145 #define TPM_EO_MARSHAL_REF                          \
146             ((UINT16)(offsetof(MarshalData_st, TPM_EO_DATA)))
147 #define TPM_SU_MARSHAL_REF                          \
148             ((UINT16)(offsetof(MarshalData_st, TPM_SU_DATA)))
149 #define TPM_SE_MARSHAL_REF                          \
150             ((UINT16)(offsetof(MarshalData_st, TPM_SE_DATA)))
151 #define TPM_CAP_MARSHAL_REF                         \
152             ((UINT16)(offsetof(MarshalData_st, TPM_CAP_DATA)))
153 #define TPMA_ALGORITHM_MARSHAL_REF                  \
154             ((UINT16)(offsetof(MarshalData_st, TPMA_ALGORITHM_DATA)))
155 #define TPMA_OBJECT_MARSHAL_REF                     \
156             ((UINT16)(offsetof(MarshalData_st, TPMA_OBJECT_DATA)))
157 #define TPMA_SESSION_MARSHAL_REF                    \
158             ((UINT16)(offsetof(MarshalData_st, TPMA_SESSION_DATA)))
159 #define TPMA_ACT_MARSHAL_REF                        \
160             ((UINT16)(offsetof(MarshalData_st, TPMA_ACT_DATA)))
161 #define TPMI_YES_NO_MARSHAL_REF                     \
162             ((UINT16)(offsetof(MarshalData_st, TPMI_YES_NO_DATA)))
163 #define TPMI_DH_OBJECT_MARSHAL_REF                  \
164             ((UINT16)(offsetof(MarshalData_st, TPMI_DH_OBJECT_DATA)))
165 #define TPMI_DH_PARENT_MARSHAL_REF                  \
166             ((UINT16)(offsetof(MarshalData_st, TPMI_DH_PARENT_DATA)))
167 #define TPMI_DH_PERSISTENT_MARSHAL_REF              \
168             ((UINT16)(offsetof(MarshalData_st, TPMI_DH_PERSISTENT_DATA)))
169 #define TPMI_DH_ENTITY_MARSHAL_REF                  \
170             ((UINT16)(offsetof(MarshalData_st, TPMI_DH_ENTITY_DATA)))
171 #define TPMI_DH_PCR_MARSHAL_REF                     \
172             ((UINT16)(offsetof(MarshalData_st, TPMI_DH_PCR_DATA)))
173 #define TPMI_SH_AUTH_SESSION_MARSHAL_REF            \
174             ((UINT16)(offsetof(MarshalData_st, TPMI_SH_AUTH_SESSION_DATA)))
175 #define TPMI_SH_HMAC_MARSHAL_REF                    \
176             ((UINT16)(offsetof(MarshalData_st, TPMI_SH_HMAC_DATA)))
177 #define TPMI_SH_POLICY_MARSHAL_REF                  \
178             ((UINT16)(offsetof(MarshalData_st, TPMI_SH_POLICY_DATA)))
179 #define TPMI_DH_CONTEXT_MARSHAL_REF                 \
180             ((UINT16)(offsetof(MarshalData_st, TPMI_DH_CONTEXT_DATA)))
181 #define TPMI_DH_SAVED_MARSHAL_REF                   \
182             ((UINT16)(offsetof(MarshalData_st, TPMI_DH_SAVED_DATA)))
183 #define TPMI_RH_HIERARCHY_MARSHAL_REF               \
184             ((UINT16)(offsetof(MarshalData_st, TPMI_RH_HIERARCHY_DATA)))
185 #define TPMI_RH_ENABLES_MARSHAL_REF                 \
186             ((UINT16)(offsetof(MarshalData_st, TPMI_RH_ENABLES_DATA)))
187 #define TPMI_RH_HIERARCHY_AUTH_MARSHAL_REF          \
188             ((UINT16)(offsetof(MarshalData_st, TPMI_RH_HIERARCHY_AUTH_DATA)))
189 #define TPMI_RH_HIERARCHY_POLICY_MARSHAL_REF        \
190             ((UINT16)(offsetof(MarshalData_st, TPMI_RH_HIERARCHY_POLICY_DATA)))
191 #define TPMI_RH_PLATFORM_MARSHAL_REF                \
192             ((UINT16)(offsetof(MarshalData_st, TPMI_RH_PLATFORM_DATA)))
193 #define TPMI_RH_OWNER_MARSHAL_REF                   \
194             ((UINT16)(offsetof(MarshalData_st, TPMI_RH_OWNER_DATA)))
195 #define TPMI_RH_ENDORSEMENT_MARSHAL_REF             \
196             ((UINT16)(offsetof(MarshalData_st, TPMI_RH_ENDORSEMENT_DATA)))
197 #define TPMI_RH_PROVISION_MARSHAL_REF               \
198             ((UINT16)(offsetof(MarshalData_st, TPMI_RH_PROVISION_DATA)))
199 #define TPMI_RH_CLEAR_MARSHAL_REF                   \
200             ((UINT16)(offsetof(MarshalData_st, TPMI_RH_CLEAR_DATA)))
201 #define TPMI_RH_NV_AUTH_MARSHAL_REF                 \
202             ((UINT16)(offsetof(MarshalData_st, TPMI_RH_NV_AUTH_DATA)))
203 #define TPMI_RH_LOCKOUT_MARSHAL_REF                 \
204             ((UINT16)(offsetof(MarshalData_st, TPMI_RH_LOCKOUT_DATA)))
205 #define TPMI_RH_NV_INDEX_MARSHAL_REF                \
206             ((UINT16)(offsetof(MarshalData_st, TPMI_RH_NV_INDEX_DATA)))
207 #define TPMI_RH_AC_MARSHAL_REF                      \
208             ((UINT16)(offsetof(MarshalData_st, TPMI_RH_AC_DATA)))
209 #define TPMI_RH_ACT_MARSHAL_REF                     \
210             ((UINT16)(offsetof(MarshalData_st, TPMI_RH_ACT_DATA)))
211 #define TPMI_ALG_HASH_MARSHAL_REF                   \
212             ((UINT16)(offsetof(MarshalData_st, TPMI_ALG_HASH_DATA)))
213 #define TPMI_ALG_ASYM_MARSHAL_REF                   \
214             ((UINT16)(offsetof(MarshalData_st, TPMI_ALG_ASYM_DATA)))
215 #define TPMI_ALG_SYM_MARSHAL_REF                    \
216             ((UINT16)(offsetof(MarshalData_st, TPMI_ALG_SYM_DATA)))
217 #define TPMI_ALG_SYM_OBJECT_MARSHAL_REF             \
218             ((UINT16)(offsetof(MarshalData_st, TPMI_ALG_SYM_OBJECT_DATA)))
219 #define TPMI_ALG_SYM_MODE_MARSHAL_REF               \
220             ((UINT16)(offsetof(MarshalData_st, TPMI_ALG_SYM_MODE_DATA)))
221 #define TPMI_ALG_KDF_MARSHAL_REF                    \
222             ((UINT16)(offsetof(MarshalData_st, TPMI_ALG_KDF_DATA)))
223 #define TPMI_ALG_SIG_SCHEME_MARSHAL_REF             \
224             ((UINT16)(offsetof(MarshalData_st, TPMI_ALG_SIG_SCHEME_DATA)))
225 #define TPMI_ECC_KEY_EXCHANGE_MARSHAL_REF           \
226             ((UINT16)(offsetof(MarshalData_st, TPMI_ECC_KEY_EXCHANGE_DATA)))
227 #define TPMI_ST_COMMAND_TAG_MARSHAL_REF             \
228             ((UINT16)(offsetof(MarshalData_st, TPMI_ST_COMMAND_TAG_DATA)))
229 #define TPMI_ALG_MAC_SCHEME_MARSHAL_REF             \
230             ((UINT16)(offsetof(MarshalData_st, TPMI_ALG_MAC_SCHEME_DATA)))
231 #define TPMI_ALG_CIPHER_MODE_MARSHAL_REF            \
232             ((UINT16)(offsetof(MarshalData_st, TPMI_ALG_CIPHER_MODE_DATA)))
233 #define TPMS_EMPTY_MARSHAL_REF                      \
234             ((UINT16)(offsetof(MarshalData_st, TPMS_EMPTY_DATA)))
235 #define TPMS_ENC_SCHEME_RSAES_MARSHAL_REF           TPMS_EMPTY_MARSHAL_REF
236 #define TPMS_ALGORITHM_DESCRIPTION_MARSHAL_REF      \
237             ((UINT16)(offsetof(MarshalData_st, TPMS_ALGORITHM_DESCRIPTION_DATA)))
238 #define TPMU_HA_MARSHAL_REF                         \
239             ((UINT16)(offsetof(MarshalData_st, TPMU_HA_DATA)))
240 #define TPMT_HA_MARSHAL_REF                         \
241             ((UINT16)(offsetof(MarshalData_st, TPMT_HA_DATA)))
242 #define TPM2B_DIGEST_MARSHAL_REF                    \
243             ((UINT16)(offsetof(MarshalData_st, TPM2B_DIGEST_DATA)))
244 #define TPM2B_NONCE_MARSHAL_REF                     TPM2B_DIGEST_MARSHAL_REF
245 #define TPM2B_AUTH_MARSHAL_REF                      TPM2B_DIGEST_MARSHAL_REF
246 #define TPM2B_OPERAND_MARSHAL_REF                   TPM2B_DIGEST_MARSHAL_REF
247 #define TPM2B_DATA_MARSHAL_REF                      \
248             ((UINT16)(offsetof(MarshalData_st, TPM2B_DATA_DATA)))
249 #define TPM2B_EVENT_MARSHAL_REF                     \
250             ((UINT16)(offsetof(MarshalData_st, TPM2B_EVENT_DATA)))
251 #define TPM2B_MAX_BUFFER_MARSHAL_REF                \
252             ((UINT16)(offsetof(MarshalData_st, TPM2B_MAX_BUFFER_DATA)))
253 #define TPM2B_MAX_NV_BUFFER_MARSHAL_REF             \
254             ((UINT16)(offsetof(MarshalData_st, TPM2B_MAX_NV_BUFFER_DATA)))
255 #define TPM2B_TIMEOUT_MARSHAL_REF                   \
256             ((UINT16)(offsetof(MarshalData_st, TPM2B_TIMEOUT_DATA)))
257 #define TPM2B_IV_MARSHAL_REF                        \
258             ((UINT16)(offsetof(MarshalData_st, TPM2B_IV_DATA)))
259 #define NULL_UNION_MARSHAL_REF                      \
260             ((UINT16)(offsetof(MarshalData_st, NULL_UNION_DATA)))
261 #define TPMU_NAME_MARSHAL_REF                       NULL_UNION_MARSHAL_REF
262 #define TPMU_SENSITIVE_CREATE_MARSHAL_REF           NULL_UNION_MARSHAL_REF
263 #define TPM2B_NAME_MARSHAL_REF                      \
264             ((UINT16)(offsetof(MarshalData_st, TPM2B_NAME_DATA)))
265 #define TPMS_PCR_SELECT_MARSHAL_REF                 \
266             ((UINT16)(offsetof(MarshalData_st, TPMS_PCR_SELECT_DATA)))
267 #define TPMS_PCR_SELECTION_MARSHAL_REF              \
268             ((UINT16)(offsetof(MarshalData_st, TPMS_PCR_SELECTION_DATA)))
269 #define TPMT_TK_CREATION_MARSHAL_REF                \
270             ((UINT16)(offsetof(MarshalData_st, TPMT_TK_CREATION_DATA)))
271 #define TPMT_TK_VERIFIED_MARSHAL_REF                \
272             ((UINT16)(offsetof(MarshalData_st, TPMT_TK_VERIFIED_DATA)))
273 #define TPMT_TK_AUTH_MARSHAL_REF                    \
274             ((UINT16)(offsetof(MarshalData_st, TPMT_TK_AUTH_DATA)))
275 #define TPMT_TK_HASHCHECK_MARSHAL_REF               \
276             ((UINT16)(offsetof(MarshalData_st, TPMT_TK_HASHCHECK_DATA)))
277 #define TPMS_ALG_PROPERTY_MARSHAL_REF               \
278             ((UINT16)(offsetof(MarshalData_st, TPMS_ALG_PROPERTY_DATA)))
279 #define TPMS_TAGGED_PROPERTY_MARSHAL_REF            \
280             ((UINT16)(offsetof(MarshalData_st, TPMS_TAGGED_PROPERTY_DATA)))
281 #define TPMS_TAGGED_PCR_SELECT_MARSHAL_REF          \
282             ((UINT16)(offsetof(MarshalData_st, TPMS_TAGGED_PCR_SELECT_DATA)))
283 #define TPMS_TAGGED_POLICY_MARSHAL_REF              \
284             ((UINT16)(offsetof(MarshalData_st, TPMS_TAGGED_POLICY_DATA)))
285 #define TPMS_ACT_DATA_MARSHAL_REF                   \
286             ((UINT16)(offsetof(MarshalData_st, TPMS_ACT_DATA_DATA)))
287 #define TPML_CC_MARSHAL_REF                         \
288             ((UINT16)(offsetof(MarshalData_st, TPML_CC_DATA)))
289 #define TPML_CCA_MARSHAL_REF                        \
290             ((UINT16)(offsetof(MarshalData_st, TPML_CCA_DATA)))
291 #define TPML_ALG_MARSHAL_REF                        \
292             ((UINT16)(offsetof(MarshalData_st, TPML_ALG_DATA)))
293 #define TPML_HANDLE_MARSHAL_REF                     \
294             ((UINT16)(offsetof(MarshalData_st, TPML_HANDLE_DATA)))
295 #define TPML_DIGEST_MARSHAL_REF                     \
296             ((UINT16)(offsetof(MarshalData_st, TPML_DIGEST_DATA)))
297 #define TPML_DIGEST_VALUES_MARSHAL_REF              \
298             ((UINT16)(offsetof(MarshalData_st, TPML_DIGEST_VALUES_DATA)))
299 #define TPML_PCR_SELECTION_MARSHAL_REF              \
300             ((UINT16)(offsetof(MarshalData_st, TPML_PCR_SELECTION_DATA)))
301 #define TPML_ALG_PROPERTY_MARSHAL_REF               \
302             ((UINT16)(offsetof(MarshalData_st, TPML_ALG_PROPERTY_DATA)))
303 #define TPML_TAGGED_TPM_PROPERTY_MARSHAL_REF        \
304             ((UINT16)(offsetof(MarshalData_st, TPML_TAGGED_TPM_PROPERTY_DATA)))
305 #define TPML_TAGGED_PCR_PROPERTY_MARSHAL_REF        \
306             ((UINT16)(offsetof(MarshalData_st, TPML_TAGGED_PCR_PROPERTY_DATA)))
307 #define TPML_ECC_CURVE_MARSHAL_REF                  \
308             ((UINT16)(offsetof(MarshalData_st, TPML_ECC_CURVE_DATA)))
309 #define TPML_TAGGED_POLICY_MARSHAL_REF              \
310             ((UINT16)(offsetof(MarshalData_st, TPML_TAGGED_POLICY_DATA)))
311 #define TPML_ACT_DATA_MARSHAL_REF                   \
312             ((UINT16)(offsetof(MarshalData_st, TPML_ACT_DATA_DATA)))
313 #define TPMU_CAPABILITIES_MARSHAL_REF               \
314             ((UINT16)(offsetof(MarshalData_st, TPMU_CAPABILITIES_DATA)))
315 #define TPMS_CAPABILITY_DATA_MARSHAL_REF            \
316             ((UINT16)(offsetof(MarshalData_st, TPMS_CAPABILITY_DATA_DATA)))
317 #define TPMS_CLOCK_INFO_MARSHAL_REF                 \
318             ((UINT16)(offsetof(MarshalData_st, TPMS_CLOCK_INFO_DATA)))
319 #define TPMS_TIME_INFO_MARSHAL_REF                  \
320             ((UINT16)(offsetof(MarshalData_st, TPMS_TIME_INFO_DATA)))
321 #define TPMS_TIME_ATTEST_INFO_MARSHAL_REF           \
322             ((UINT16)(offsetof(MarshalData_st, TPMS_TIME_ATTEST_INFO_DATA)))
323 #define TPMS_CERTIFY_INFO_MARSHAL_REF               \
324             ((UINT16)(offsetof(MarshalData_st, TPMS_CERTIFY_INFO_DATA)))
325 #define TPMS_QUOTE_INFO_MARSHAL_REF                 \
326             ((UINT16)(offsetof(MarshalData_st, TPMS_QUOTE_INFO_DATA)))
327 #define TPMS_COMMAND_AUDIT_INFO_MARSHAL_REF         \
328             ((UINT16)(offsetof(MarshalData_st, TPMS_COMMAND_AUDIT_INFO_DATA)))
329 #define TPMS_SESSION_AUDIT_INFO_MARSHAL_REF         \
330             ((UINT16)(offsetof(MarshalData_st, TPMS_SESSION_AUDIT_INFO_DATA)))
331 #define TPMS_CREATION_INFO_MARSHAL_REF              \
332             ((UINT16)(offsetof(MarshalData_st, TPMS_CREATION_INFO_DATA)))
333 #define TPMS_NV_CERTIFY_INFO_MARSHAL_REF            \
334             ((UINT16)(offsetof(MarshalData_st, TPMS_NV_CERTIFY_INFO_DATA)))
335 #define TPMS_NV_DIGEST_CERTIFY_INFO_MARSHAL_REF     \
336             ((UINT16)(offsetof(MarshalData_st, TPMS_NV_DIGEST_CERTIFY_INFO_DATA)))
337 #define TPMI_ST_ATTEST_MARSHAL_REF                  \
338             ((UINT16)(offsetof(MarshalData_st, TPMI_ST_ATTEST_DATA)))
339 #define TPMU_ATTEST_MARSHAL_REF                     \
340             ((UINT16)(offsetof(MarshalData_st, TPMU_ATTEST_DATA)))
341 #define TPMS_ATTEST_MARSHAL_REF                     \
342             ((UINT16)(offsetof(MarshalData_st, TPMS_ATTEST_DATA)))
343 #define TPM2B_ATTEST_MARSHAL_REF                    \
344             ((UINT16)(offsetof(MarshalData_st, TPM2B_ATTEST_DATA)))
345 #define TPMS_AUTH_COMMAND_MARSHAL_REF               \
346             ((UINT16)(offsetof(MarshalData_st, TPMS_AUTH_COMMAND_DATA)))
347 #define TPMS_AUTH_RESPONSE_MARSHAL_REF              \
348             ((UINT16)(offsetof(MarshalData_st, TPMS_AUTH_RESPONSE_DATA)))
349 #define TPMI_TDES_KEY_BITS_MARSHAL_REF              \
350             ((UINT16)(offsetof(MarshalData_st, TPMI_TDES_KEY_BITS_DATA)))
351 #define TPMI_AES_KEY_BITS_MARSHAL_REF               \
352             ((UINT16)(offsetof(MarshalData_st, TPMI_AES_KEY_BITS_DATA)))
353 #define TPMI_SM4_KEY_BITS_MARSHAL_REF               \
354             ((UINT16)(offsetof(MarshalData_st, TPMI_SM4_KEY_BITS_DATA)))
355 #define TPMI_CAMELLIA_KEY_BITS_MARSHAL_REF          \
356             ((UINT16)(offsetof(MarshalData_st, TPMI_CAMELLIA_KEY_BITS_DATA)))
357 #define TPMU_SYM_KEY_BITS_MARSHAL_REF               \
358             ((UINT16)(offsetof(MarshalData_st, TPMU_SYM_KEY_BITS_DATA)))
359 #define TPMU_SYM_MODE_MARSHAL_REF                   \
360             ((UINT16)(offsetof(MarshalData_st, TPMU_SYM_MODE_DATA)))
361 #define TPMT_SYM_DEF_MARSHAL_REF                    \
362             ((UINT16)(offsetof(MarshalData_st, TPMT_SYM_DEF_DATA)))
363 #define TPMT_SYM_DEF_OBJECT_MARSHAL_REF             \
364             ((UINT16)(offsetof(MarshalData_st, TPMT_SYM_DEF_OBJECT_DATA)))
365 #define TPM2B_SYM_KEY_MARSHAL_REF                   \
366             ((UINT16)(offsetof(MarshalData_st, TPM2B_SYM_KEY_DATA)))
367 #define TPMS_SYMCIPHER_PARMS_MARSHAL_REF            \
368             ((UINT16)(offsetof(MarshalData_st, TPMS_SYMCIPHER_PARMS_DATA)))
369 #define TPM2B_LABEL_MARSHAL_REF                     \
370             ((UINT16)(offsetof(MarshalData_st, TPM2B_LABEL_DATA)))
371 #define TPMS_DERIVE_MARSHAL_REF                     \
372             ((UINT16)(offsetof(MarshalData_st, TPMS_DERIVE_DATA)))
373 #define TPM2B_DERIVE_MARSHAL_REF                    \
374             ((UINT16)(offsetof(MarshalData_st, TPM2B_DERIVE_DATA)))
375 #define TPM2B_SENSITIVE_DATA_MARSHAL_REF            \
376             ((UINT16)(offsetof(MarshalData_st, TPM2B_SENSITIVE_DATA_DATA)))
377 #define TPMS_SENSITIVE_CREATE_MARSHAL_REF           \
378             ((UINT16)(offsetof(MarshalData_st, TPMS_SENSITIVE_CREATE_DATA)))
379 #define TPM2B_SENSITIVE_CREATE_MARSHAL_REF          \
380             ((UINT16)(offsetof(MarshalData_st, TPM2B_SENSITIVE_CREATE_DATA)))
381 #define TPMS_SCHEME_HASH_MARSHAL_REF                \
382             ((UINT16)(offsetof(MarshalData_st, TPMS_SCHEME_HASH_DATA)))
383 #define TPMS_SCHEME_HMAC_MARSHAL_REF                TPMS_SCHEME_HASH_MARSHAL_REF
384 #define TPMS_SIG_SCHEME_RSASSA_MARSHAL_REF          TPMS_SCHEME_HASH_MARSHAL_REF
385 #define TPMS_SIG_SCHEME_RSAPSS_MARSHAL_REF          TPMS_SCHEME_HASH_MARSHAL_REF
386 #define TPMS_SIG_SCHEME_ECDSA_MARSHAL_REF           TPMS_SCHEME_HASH_MARSHAL_REF
387 #define TPMS_SIG_SCHEME_SM2_MARSHAL_REF             TPMS_SCHEME_HASH_MARSHAL_REF
388 #define TPMS_SIG_SCHEME_ECSCHNORR_MARSHAL_REF       TPMS_SCHEME_HASH_MARSHAL_REF
389 #define TPMS_ENC_SCHEME_OAEP_MARSHAL_REF            TPMS_SCHEME_HASH_MARSHAL_REF
390 #define TPMS_KEY_SCHEME_ECDH_MARSHAL_REF            TPMS_SCHEME_HASH_MARSHAL_REF
391 #define TPMS_KEY_SCHEME_ECMQV_MARSHAL_REF           TPMS_SCHEME_HASH_MARSHAL_REF
392 #define TPMS_KDF_SCHEME_MGF1_MARSHAL_REF            TPMS_SCHEME_HASH_MARSHAL_REF
393 #define TPMS_KDF_SCHEME_KDF1_SP800_56A_MARSHAL_REF  TPMS_SCHEME_HASH_MARSHAL_REF
394 #define TPMS_KDF_SCHEME_KDF2_MARSHAL_REF            TPMS_SCHEME_HASH_MARSHAL_REF
395 #define TPMS_KDF_SCHEME_KDF1_SP800_108_MARSHAL_REF  TPMS_SCHEME_HASH_MARSHAL_REF
396 #define TPMS_SCHEME_ECDAA_MARSHAL_REF               \
397             ((UINT16)(offsetof(MarshalData_st, TPMS_SCHEME_ECDAA_DATA)))
398 #define TPMS_SIG_SCHEME_ECDAA_MARSHAL_REF           TPMS_SCHEME_ECDAA_MARSHAL_REF
399 #define TPMI_ALG_KEYEDHASH_SCHEME_MARSHAL_REF       \
400             ((UINT16)(offsetof(MarshalData_st, TPMI_ALG_KEYEDHASH_SCHEME_DATA)))
401 #define TPMS_SCHEME_XOR_MARSHAL_REF                 \
402             ((UINT16)(offsetof(MarshalData_st, TPMS_SCHEME_XOR_DATA)))
403 #define TPMU_SCHEME_KEYEDHASH_MARSHAL_REF           \
404             ((UINT16)(offsetof(MarshalData_st, TPMU_SCHEME_KEYEDHASH_DATA)))
405 #define TPMT_KEYEDHASH_SCHEME_MARSHAL_REF           \
406             ((UINT16)(offsetof(MarshalData_st, TPMT_KEYEDHASH_SCHEME_DATA)))
407 #define TPMU_SIG_SCHEME_MARSHAL_REF                 \
408             ((UINT16)(offsetof(MarshalData_st, TPMU_SIG_SCHEME_DATA)))
409 #define TPMT_SIG_SCHEME_MARSHAL_REF                 \
410             ((UINT16)(offsetof(MarshalData_st, TPMT_SIG_SCHEME_DATA)))
411 #define TPMU_KDF_SCHEME_MARSHAL_REF                 \
412             ((UINT16)(offsetof(MarshalData_st, TPMU_KDF_SCHEME_DATA)))
413 #define TPMT_KDF_SCHEME_MARSHAL_REF                 \
414             ((UINT16)(offsetof(MarshalData_st, TPMT_KDF_SCHEME_DATA)))
415 #define TPMI_ALG_ASYM_SCHEME_MARSHAL_REF            \
416             ((UINT16)(offsetof(MarshalData_st, TPMI_ALG_ASYM_SCHEME_DATA)))
417 #define TPMU_ASYM_SCHEME_MARSHAL_REF                \
418             ((UINT16)(offsetof(MarshalData_st, TPMU_ASYM_SCHEME_DATA)))
419 #define TPMI_ALG_RSA_SCHEME_MARSHAL_REF             \
420             ((UINT16)(offsetof(MarshalData_st, TPMI_ALG_RSA_SCHEME_DATA)))
421 #define TPMT_RSA_SCHEME_MARSHAL_REF                 \
422             ((UINT16)(offsetof(MarshalData_st, TPMT_RSA_SCHEME_DATA)))
423 #define TPMI_ALG_RSA_DECRYPT_MARSHAL_REF            \
424             ((UINT16)(offsetof(MarshalData_st, TPMI_ALG_RSA_DECRYPT_DATA)))
425 #define TPMT_RSA_DECRYPT_MARSHAL_REF                \
426             ((UINT16)(offsetof(MarshalData_st, TPMT_RSA_DECRYPT_DATA)))
427 #define TPM2B_PUBLIC_KEY_RSA_MARSHAL_REF            \
428             ((UINT16)(offsetof(MarshalData_st, TPM2B_PUBLIC_KEY_RSA_DATA)))
429 #define TPMI_RSA_KEY_BITS_MARSHAL_REF               \
430             ((UINT16)(offsetof(MarshalData_st, TPMI_RSA_KEY_BITS_DATA)))
431 #define TPM2B_PRIVATE_KEY_RSA_MARSHAL_REF           \
432             ((UINT16)(offsetof(MarshalData_st, TPM2B_PRIVATE_KEY_RSA_DATA)))
433 #define TPM2B_ECC_PARAMETER_MARSHAL_REF             \
434             ((UINT16)(offsetof(MarshalData_st, TPM2B_ECC_PARAMETER_DATA)))
435 #define TPMS_ECC_POINT_MARSHAL_REF                  \
436             ((UINT16)(offsetof(MarshalData_st, TPMS_ECC_POINT_DATA)))
437 #define TPM2B_ECC_POINT_MARSHAL_REF                 \
438             ((UINT16)(offsetof(MarshalData_st, TPM2B_ECC_POINT_DATA)))
439 #define TPMI_ALG_ECC_SCHEME_MARSHAL_REF             \
440             ((UINT16)(offsetof(MarshalData_st, TPMI_ALG_ECC_SCHEME_DATA)))
441 #define TPMI_ECC_CURVE_MARSHAL_REF                  \
442             ((UINT16)(offsetof(MarshalData_st, TPMI_ECC_CURVE_DATA)))
443 #define TPMT_ECC_SCHEME_MARSHAL_REF                 \
444             ((UINT16)(offsetof(MarshalData_st, TPMT_ECC_SCHEME_DATA)))
445 #define TPMS_ALGORITHM_DETAIL_ECC_MARSHAL_REF       \
446             ((UINT16)(offsetof(MarshalData_st, TPMS_ALGORITHM_DETAIL_ECC_DATA)))
447 #define TPMS_SIGNATURE_RSA_MARSHAL_REF              \
448             ((UINT16)(offsetof(MarshalData_st, TPMS_SIGNATURE_RSA_DATA)))
449 #define TPMS_SIGNATURE_RSASSA_MARSHAL_REF           TPMS_SIGNATURE_RSA_MARSHAL_REF
450 #define TPMS_SIGNATURE_RSAPSS_MARSHAL_REF           TPMS_SIGNATURE_RSA_MARSHAL_REF
451 #define TPMS_SIGNATURE_ECC_MARSHAL_REF              \
452             ((UINT16)(offsetof(MarshalData_st, TPMS_SIGNATURE_ECC_DATA)))
453 #define TPMS_SIGNATURE_ECDAA_MARSHAL_REF            TPMS_SIGNATURE_ECC_MARSHAL_REF
454 #define TPMS_SIGNATURE_ECDSA_MARSHAL_REF            TPMS_SIGNATURE_ECC_MARSHAL_REF
455 #define TPMS_SIGNATURE_SM2_MARSHAL_REF              TPMS_SIGNATURE_ECC_MARSHAL_REF
456 #define TPMS_SIGNATURE_ECSCHNORR_MARSHAL_REF        TPMS_SIGNATURE_ECC_MARSHAL_REF
457 #define TPMU_SIGNATURE_MARSHAL_REF                  \
458             ((UINT16)(offsetof(MarshalData_st, TPMU_SIGNATURE_DATA)))
459 #define TPMT_SIGNATURE_MARSHAL_REF                  \
460             ((UINT16)(offsetof(MarshalData_st, TPMT_SIGNATURE_DATA)))
461 #define TPMU_ENCRYPTED_SECRET_MARSHAL_REF           \
462             ((UINT16)(offsetof(MarshalData_st, TPMU_ENCRYPTED_SECRET_DATA)))
463 #define TPM2B_ENCRYPTED_SECRET_MARSHAL_REF          \
464             ((UINT16)(offsetof(MarshalData_st, TPM2B_ENCRYPTED_SECRET_DATA)))
465 #define TPMI_ALG_PUBLIC_MARSHAL_REF                 \
466             ((UINT16)(offsetof(MarshalData_st, TPMI_ALG_PUBLIC_DATA)))
467 #define TPMU_PUBLIC_ID_MARSHAL_REF                  \
468             ((UINT16)(offsetof(MarshalData_st, TPMU_PUBLIC_ID_DATA)))
469 #define TPMS_KEYEDHASH_PARMS_MARSHAL_REF            \
470             ((UINT16)(offsetof(MarshalData_st, TPMS_KEYEDHASH_PARMS_DATA)))
471 #define TPMS_RSA_PARMS_MARSHAL_REF                  \
472             ((UINT16)(offsetof(MarshalData_st, TPMS_RSA_PARMS_DATA)))
473 #define TPMS_ECC_PARMS_MARSHAL_REF                  \
474             ((UINT16)(offsetof(MarshalData_st, TPMS_ECC_PARMS_DATA)))
475 #define TPMU_PUBLIC_PARMS_MARSHAL_REF               \
476             ((UINT16)(offsetof(MarshalData_st, TPMU_PUBLIC_PARMS_DATA)))
477 #define TPMT_PUBLIC_PARMS_MARSHAL_REF               \
478             ((UINT16)(offsetof(MarshalData_st, TPMT_PUBLIC_PARMS_DATA)))
479 #define TPMT_PUBLIC_MARSHAL_REF                     \
480             ((UINT16)(offsetof(MarshalData_st, TPMT_PUBLIC_DATA)))
481 #define TPM2B_PUBLIC_MARSHAL_REF                    \
482             ((UINT16)(offsetof(MarshalData_st, TPM2B_PUBLIC_DATA)))
483 #define TPM2B_TEMPLATE_MARSHAL_REF                  \
484             ((UINT16)(offsetof(MarshalData_st, TPM2B_TEMPLATE_DATA)))
485 #define TPM2B_PRIVATE_VENDOR_SPECIFIC_MARSHAL_REF   \
486             ((UINT16)(offsetof(MarshalData_st, TPM2B_PRIVATE_VENDOR_SPECIFIC_DATA)))
487 #define TPMU_SENSITIVE_COMPOSITE_MARSHAL_REF        \
488             ((UINT16)(offsetof(MarshalData_st, TPMU_SENSITIVE_COMPOSITE_DATA)))
489 #define TPMT_SENSITIVE_MARSHAL_REF                  \
490             ((UINT16)(offsetof(MarshalData_st, TPMT_SENSITIVE_DATA)))
491 #define TPM2B_SENSITIVE_MARSHAL_REF                 \
492             ((UINT16)(offsetof(MarshalData_st, TPM2B_SENSITIVE_DATA)))
493 #define TPM2B_PRIVATE_MARSHAL_REF                   \
494             ((UINT16)(offsetof(MarshalData_st, TPM2B_PRIVATE_DATA)))
495 #define TPM2B_ID_OBJECT_MARSHAL_REF                 \
496             ((UINT16)(offsetof(MarshalData_st, TPM2B_ID_OBJECT_DATA)))
497 #define TPMS_NV_PIN_COUNTER_PARAMETERS_MARSHAL_REF  \
498             ((UINT16)(offsetof(MarshalData_st, TPMS_NV_PIN_COUNTER_PARAMETERS_DATA)))
499 #define TPMA_NV_MARSHAL_REF                         \
500             ((UINT16)(offsetof(MarshalData_st, TPMA_NV_DATA)))
501 #define TPMS_NV_PUBLIC_MARSHAL_REF                  \
502             ((UINT16)(offsetof(MarshalData_st, TPMS_NV_PUBLIC_DATA)))
503 #define TPM2B_NV_PUBLIC_MARSHAL_REF                 \
504             ((UINT16)(offsetof(MarshalData_st, TPM2B_NV_PUBLIC_DATA)))
505 #define TPM2B_CONTEXT_SENSITIVE_MARSHAL_REF         \
506             ((UINT16)(offsetof(MarshalData_st, TPM2B_CONTEXT_SENSITIVE_DATA)))
507 #define TPMS_CONTEXT_DATA_MARSHAL_REF               \
508             ((UINT16)(offsetof(MarshalData_st, TPMS_CONTEXT_DATA_DATA)))
509 #define TPM2B_CONTEXT_DATA_MARSHAL_REF              \
510             ((UINT16)(offsetof(MarshalData_st, TPM2B_CONTEXT_DATA_DATA)))
511 #define TPMS_CONTEXT_MARSHAL_REF                    \
512             ((UINT16)(offsetof(MarshalData_st, TPMS_CONTEXT_DATA)))
513 #define TPMS_CREATION_DATA_MARSHAL_REF              \
514             ((UINT16)(offsetof(MarshalData_st, TPMS_CREATION_DATA_DATA)))
515 #define TPM2B_CREATION_DATA_MARSHAL_REF             \
516             ((UINT16)(offsetof(MarshalData_st, TPM2B_CREATION_DATA_DATA)))
517 #define TPM_AT_MARSHAL_REF                          \
518             ((UINT16)(offsetof(MarshalData_st, TPM_AT_DATA)))
519 #define TPMS_AC_OUTPUT_MARSHAL_REF                  \
520             ((UINT16)(offsetof(MarshalData_st, TPMS_AC_OUTPUT_DATA)))
521 #define TPML_AC_CAPABILITIES_MARSHAL_REF            \
522             ((UINT16)(offsetof(MarshalData_st, TPML_AC_CAPABILITIES_DATA)))
523 #define Type00_MARSHAL_REF                          \
524             ((UINT16)(offsetof(MarshalData_st, Type00_DATA)))
525 #define Type01_MARSHAL_REF                          \
526             ((UINT16)(offsetof(MarshalData_st, Type01_DATA)))
527 #define Type02_MARSHAL_REF                          \
528             ((UINT16)(offsetof(MarshalData_st, Type02_DATA)))
529 #define Type03_MARSHAL_REF                          \
530             ((UINT16)(offsetof(MarshalData_st, Type03_DATA)))
531 #define Type04_MARSHAL_REF                          \
532             ((UINT16)(offsetof(MarshalData_st, Type04_DATA)))
533 #define Type05_MARSHAL_REF                          \
534             ((UINT16)(offsetof(MarshalData_st, Type05_DATA)))
535 #define Type06_MARSHAL_REF                          \
536             ((UINT16)(offsetof(MarshalData_st, Type06_DATA)))
537 #define Type07_MARSHAL_REF                          \
538             ((UINT16)(offsetof(MarshalData_st, Type07_DATA)))
539 #define Type08_MARSHAL_REF                          \
540             ((UINT16)(offsetof(MarshalData_st, Type08_DATA)))
541 #define Type09_MARSHAL_REF                          Type08_MARSHAL_REF
542 #define Type14_MARSHAL_REF                          Type08_MARSHAL_REF
543 #define Type10_MARSHAL_REF                          \
544             ((UINT16)(offsetof(MarshalData_st, Type10_DATA)))
545 #define Type11_MARSHAL_REF                          \
546             ((UINT16)(offsetof(MarshalData_st, Type11_DATA)))
547 #define Type12_MARSHAL_REF                          \
548             ((UINT16)(offsetof(MarshalData_st, Type12_DATA)))
549 #define Type13_MARSHAL_REF                          \
550             ((UINT16)(offsetof(MarshalData_st, Type13_DATA)))
551 #define Type15_MARSHAL_REF                          \
552             ((UINT16)(offsetof(MarshalData_st, Type15_DATA)))
553 #define Type16_MARSHAL_REF                          Type15_MARSHAL_REF
554 #define Type17_MARSHAL_REF                          \
555             ((UINT16)(offsetof(MarshalData_st, Type17_DATA)))
556 #define Type18_MARSHAL_REF                          \
557             ((UINT16)(offsetof(MarshalData_st, Type18_DATA)))
558 #define Type19_MARSHAL_REF                          \
559             ((UINT16)(offsetof(MarshalData_st, Type19_DATA)))
560 #define Type20_MARSHAL_REF                          \
561             ((UINT16)(offsetof(MarshalData_st, Type20_DATA)))
562 #define Type21_MARSHAL_REF                          Type20_MARSHAL_REF
563 #define Type22_MARSHAL_REF                          \
564             ((UINT16)(offsetof(MarshalData_st, Type22_DATA)))
565 #define Type23_MARSHAL_REF                          \
566             ((UINT16)(offsetof(MarshalData_st, Type23_DATA)))
567 #define Type24_MARSHAL_REF                          \
568             ((UINT16)(offsetof(MarshalData_st, Type24_DATA)))
569 #define Type25_MARSHAL_REF                          \
570             ((UINT16)(offsetof(MarshalData_st, Type25_DATA)))
571 #define Type26_MARSHAL_REF                          \
572             ((UINT16)(offsetof(MarshalData_st, Type26_DATA)))
573 #define Type27_MARSHAL_REF                          \
574             ((UINT16)(offsetof(MarshalData_st, Type27_DATA)))
575 #define Type28_MARSHAL_REF                          \
576             ((UINT16)(offsetof(MarshalData_st, Type28_DATA)))
577 #define Type29_MARSHAL_REF                          \
578             ((UINT16)(offsetof(MarshalData_st, Type29_DATA)))
579 #define Type30_MARSHAL_REF                          \
580             ((UINT16)(offsetof(MarshalData_st, Type30_DATA)))
581 #define Type31_MARSHAL_REF                          \
582             ((UINT16)(offsetof(MarshalData_st, Type31_DATA)))
583 #define Type32_MARSHAL_REF                          \
584             ((UINT16)(offsetof(MarshalData_st, Type32_DATA)))
585 #define Type33_MARSHAL_REF                          \
586             ((UINT16)(offsetof(MarshalData_st, Type33_DATA)))
587 #define Type34_MARSHAL_REF                          \
588             ((UINT16)(offsetof(MarshalData_st, Type34_DATA)))
589 #define Type35_MARSHAL_REF                          \
590             ((UINT16)(offsetof(MarshalData_st, Type35_DATA)))
591 #define Type36_MARSHAL_REF                          \
592             ((UINT16)(offsetof(MarshalData_st, Type36_DATA)))
593 #define Type37_MARSHAL_REF                          \
594             ((UINT16)(offsetof(MarshalData_st, Type37_DATA)))
595 #define Type38_MARSHAL_REF                          \
596             ((UINT16)(offsetof(MarshalData_st, Type38_DATA)))
597 #define Type39_MARSHAL_REF                          \
598             ((UINT16)(offsetof(MarshalData_st, Type39_DATA)))
599 #define Type40_MARSHAL_REF                          \
600             ((UINT16)(offsetof(MarshalData_st, Type40_DATA)))
601 #define Type41_MARSHAL_REF                          \
602             ((UINT16)(offsetof(MarshalData_st, Type41_DATA)))
603 #define Type42_MARSHAL_REF                          \
604             ((UINT16)(offsetof(MarshalData_st, Type42_DATA)))
605 #define Type43_MARSHAL_REF                          \
606             ((UINT16)(offsetof(MarshalData_st, Type43_DATA)))
607 #define Type44_MARSHAL_REF                          \
608             ((UINT16)(offsetof(MarshalData_st, Type44_DATA)))
609 
610 
611 //#defines to change calling sequence for code using marshaling
612 #define UINT8_Unmarshal(target, buffer, size)                                       \
613     Unmarshal(UINT8_MARSHAL_REF, (target), (buffer), (size))
614 #define UINT8_Marshal(source, buffer, size)                                         \
615     Marshal(UINT8_MARSHAL_REF, (source), (buffer), (size))
616 #define BYTE_Unmarshal(target, buffer, size)                                        \
617     Unmarshal(UINT8_MARSHAL_REF, (target), (buffer), (size))
618 #define BYTE_Marshal(source, buffer, size)                                          \
619     Marshal(UINT8_MARSHAL_REF, (source), (buffer), (size))
620 #define INT8_Unmarshal(target, buffer, size)                                        \
621     Unmarshal(INT8_MARSHAL_REF, (target), (buffer), (size))
622 #define INT8_Marshal(source, buffer, size)                                          \
623     Marshal(INT8_MARSHAL_REF, (source), (buffer), (size))
624 #define UINT16_Unmarshal(target, buffer, size)                                      \
625     Unmarshal(UINT16_MARSHAL_REF, (target), (buffer), (size))
626 #define UINT16_Marshal(source, buffer, size)                                        \
627     Marshal(UINT16_MARSHAL_REF, (source), (buffer), (size))
628 #define INT16_Unmarshal(target, buffer, size)                                       \
629     Unmarshal(INT16_MARSHAL_REF, (target), (buffer), (size))
630 #define INT16_Marshal(source, buffer, size)                                         \
631     Marshal(INT16_MARSHAL_REF, (source), (buffer), (size))
632 #define UINT32_Unmarshal(target, buffer, size)                                      \
633     Unmarshal(UINT32_MARSHAL_REF, (target), (buffer), (size))
634 #define UINT32_Marshal(source, buffer, size)                                        \
635     Marshal(UINT32_MARSHAL_REF, (source), (buffer), (size))
636 #define INT32_Unmarshal(target, buffer, size)                                       \
637     Unmarshal(INT32_MARSHAL_REF, (target), (buffer), (size))
638 #define INT32_Marshal(source, buffer, size)                                         \
639     Marshal(INT32_MARSHAL_REF, (source), (buffer), (size))
640 #define UINT64_Unmarshal(target, buffer, size)                                      \
641     Unmarshal(UINT64_MARSHAL_REF, (target), (buffer), (size))
642 #define UINT64_Marshal(source, buffer, size)                                        \
643     Marshal(UINT64_MARSHAL_REF, (source), (buffer), (size))
644 #define INT64_Unmarshal(target, buffer, size)                                       \
645     Unmarshal(INT64_MARSHAL_REF, (target), (buffer), (size))
646 #define INT64_Marshal(source, buffer, size)                                         \
647     Marshal(INT64_MARSHAL_REF, (source), (buffer), (size))
648 #define TPM_ALGORITHM_ID_Unmarshal(target, buffer, size)                            \
649     Unmarshal(TPM_ALGORITHM_ID_MARSHAL_REF, (target), (buffer), (size))
650 #define TPM_ALGORITHM_ID_Marshal(source, buffer, size)                              \
651     Marshal(TPM_ALGORITHM_ID_MARSHAL_REF, (source), (buffer), (size))
652 #define TPM_MODIFIER_INDICATOR_Unmarshal(target, buffer, size)                      \
653     Unmarshal(TPM_MODIFIER_INDICATOR_MARSHAL_REF, (target), (buffer), (size))
654 #define TPM_MODIFIER_INDICATOR_Marshal(source, buffer, size)                        \
655     Marshal(TPM_MODIFIER_INDICATOR_MARSHAL_REF, (source), (buffer), (size))
656 #define TPM_AUTHORIZATION_SIZE_Unmarshal(target, buffer, size)                      \
657     Unmarshal(TPM_AUTHORIZATION_SIZE_MARSHAL_REF, (target), (buffer), (size))
658 #define TPM_AUTHORIZATION_SIZE_Marshal(source, buffer, size)                        \
659     Marshal(TPM_AUTHORIZATION_SIZE_MARSHAL_REF, (source), (buffer), (size))
660 #define TPM_PARAMETER_SIZE_Unmarshal(target, buffer, size)                          \
661     Unmarshal(TPM_PARAMETER_SIZE_MARSHAL_REF, (target), (buffer), (size))
662 #define TPM_PARAMETER_SIZE_Marshal(source, buffer, size)                            \
663     Marshal(TPM_PARAMETER_SIZE_MARSHAL_REF, (source), (buffer), (size))
664 #define TPM_KEY_SIZE_Unmarshal(target, buffer, size)                                \
665     Unmarshal(TPM_KEY_SIZE_MARSHAL_REF, (target), (buffer), (size))
666 #define TPM_KEY_SIZE_Marshal(source, buffer, size)                                  \
667     Marshal(TPM_KEY_SIZE_MARSHAL_REF, (source), (buffer), (size))
668 #define TPM_KEY_BITS_Unmarshal(target, buffer, size)                                \
669     Unmarshal(TPM_KEY_BITS_MARSHAL_REF, (target), (buffer), (size))
670 #define TPM_KEY_BITS_Marshal(source, buffer, size)                                  \
671     Marshal(TPM_KEY_BITS_MARSHAL_REF, (source), (buffer), (size))
672 #define TPM_CONSTANTS32_Marshal(source, buffer, size)                               \
673     Marshal(TPM_CONSTANTS32_MARSHAL_REF, (source), (buffer), (size))
674 #define TPM_ALG_ID_Unmarshal(target, buffer, size)                                  \
675     Unmarshal(TPM_ALG_ID_MARSHAL_REF, (target), (buffer), (size))
676 #define TPM_ALG_ID_Marshal(source, buffer, size)                                    \
677     Marshal(TPM_ALG_ID_MARSHAL_REF, (source), (buffer), (size))
678 #define TPM_ECC_CURVE_Unmarshal(target, buffer, size)                               \
679     Unmarshal(TPM_ECC_CURVE_MARSHAL_REF, (target), (buffer), (size))
680 #define TPM_ECC_CURVE_Marshal(source, buffer, size)                                 \
681     Marshal(TPM_ECC_CURVE_MARSHAL_REF, (source), (buffer), (size))
682 #define TPM_CC_Unmarshal(target, buffer, size)                                      \
683     Unmarshal(TPM_CC_MARSHAL_REF, (target), (buffer), (size))
684 #define TPM_CC_Marshal(source, buffer, size)                                        \
685     Marshal(TPM_CC_MARSHAL_REF, (source), (buffer), (size))
686 #define TPM_RC_Marshal(source, buffer, size)                                        \
687     Marshal(TPM_RC_MARSHAL_REF, (source), (buffer), (size))
688 #define TPM_CLOCK_ADJUST_Unmarshal(target, buffer, size)                            \
689     Unmarshal(TPM_CLOCK_ADJUST_MARSHAL_REF, (target), (buffer), (size))
690 #define TPM_EO_Unmarshal(target, buffer, size)                                      \
691     Unmarshal(TPM_EO_MARSHAL_REF, (target), (buffer), (size))
692 #define TPM_EO_Marshal(source, buffer, size)                                        \
693     Marshal(TPM_EO_MARSHAL_REF, (source), (buffer), (size))
694 #define TPM_ST_Unmarshal(target, buffer, size)                                      \
695     Unmarshal(TPM_ST_MARSHAL_REF, (target), (buffer), (size))
696 #define TPM_ST_Marshal(source, buffer, size)                                        \
697     Marshal(TPM_ST_MARSHAL_REF, (source), (buffer), (size))
698 #define TPM_SU_Unmarshal(target, buffer, size)                                      \
699     Unmarshal(TPM_SU_MARSHAL_REF, (target), (buffer), (size))
700 #define TPM_SE_Unmarshal(target, buffer, size)                                      \
701     Unmarshal(TPM_SE_MARSHAL_REF, (target), (buffer), (size))
702 #define TPM_CAP_Unmarshal(target, buffer, size)                                     \
703     Unmarshal(TPM_CAP_MARSHAL_REF, (target), (buffer), (size))
704 #define TPM_CAP_Marshal(source, buffer, size)                                       \
705     Marshal(TPM_CAP_MARSHAL_REF, (source), (buffer), (size))
706 #define TPM_PT_Unmarshal(target, buffer, size)                                      \
707     Unmarshal(TPM_PT_MARSHAL_REF, (target), (buffer), (size))
708 #define TPM_PT_Marshal(source, buffer, size)                                        \
709     Marshal(TPM_PT_MARSHAL_REF, (source), (buffer), (size))
710 #define TPM_PT_PCR_Unmarshal(target, buffer, size)                                  \
711     Unmarshal(TPM_PT_PCR_MARSHAL_REF, (target), (buffer), (size))
712 #define TPM_PT_PCR_Marshal(source, buffer, size)                                    \
713     Marshal(TPM_PT_PCR_MARSHAL_REF, (source), (buffer), (size))
714 #define TPM_PS_Marshal(source, buffer, size)                                        \
715     Marshal(TPM_PS_MARSHAL_REF, (source), (buffer), (size))
716 #define TPM_HANDLE_Unmarshal(target, buffer, size)                                  \
717     Unmarshal(TPM_HANDLE_MARSHAL_REF, (target), (buffer), (size))
718 #define TPM_HANDLE_Marshal(source, buffer, size)                                    \
719     Marshal(TPM_HANDLE_MARSHAL_REF, (source), (buffer), (size))
720 #define TPM_HT_Unmarshal(target, buffer, size)                                      \
721     Unmarshal(TPM_HT_MARSHAL_REF, (target), (buffer), (size))
722 #define TPM_HT_Marshal(source, buffer, size)                                        \
723     Marshal(TPM_HT_MARSHAL_REF, (source), (buffer), (size))
724 #define TPM_RH_Unmarshal(target, buffer, size)                                      \
725     Unmarshal(TPM_RH_MARSHAL_REF, (target), (buffer), (size))
726 #define TPM_RH_Marshal(source, buffer, size)                                        \
727     Marshal(TPM_RH_MARSHAL_REF, (source), (buffer), (size))
728 #define TPM_HC_Unmarshal(target, buffer, size)                                      \
729     Unmarshal(TPM_HC_MARSHAL_REF, (target), (buffer), (size))
730 #define TPM_HC_Marshal(source, buffer, size)                                        \
731     Marshal(TPM_HC_MARSHAL_REF, (source), (buffer), (size))
732 #define TPMA_ALGORITHM_Unmarshal(target, buffer, size)                              \
733     Unmarshal(TPMA_ALGORITHM_MARSHAL_REF, (target), (buffer), (size))
734 #define TPMA_ALGORITHM_Marshal(source, buffer, size)                                \
735     Marshal(TPMA_ALGORITHM_MARSHAL_REF, (source), (buffer), (size))
736 #define TPMA_OBJECT_Unmarshal(target, buffer, size)                                 \
737     Unmarshal(TPMA_OBJECT_MARSHAL_REF, (target), (buffer), (size))
738 #define TPMA_OBJECT_Marshal(source, buffer, size)                                   \
739     Marshal(TPMA_OBJECT_MARSHAL_REF, (source), (buffer), (size))
740 #define TPMA_SESSION_Unmarshal(target, buffer, size)                                \
741     Unmarshal(TPMA_SESSION_MARSHAL_REF, (target), (buffer), (size))
742 #define TPMA_SESSION_Marshal(source, buffer, size)                                  \
743     Marshal(TPMA_SESSION_MARSHAL_REF, (source), (buffer), (size))
744 #define TPMA_LOCALITY_Unmarshal(target, buffer, size)                               \
745     Unmarshal(TPMA_LOCALITY_MARSHAL_REF, (target), (buffer), (size))
746 #define TPMA_LOCALITY_Marshal(source, buffer, size)                                 \
747     Marshal(TPMA_LOCALITY_MARSHAL_REF, (source), (buffer), (size))
748 #define TPMA_PERMANENT_Marshal(source, buffer, size)                                \
749     Marshal(TPMA_PERMANENT_MARSHAL_REF, (source), (buffer), (size))
750 #define TPMA_STARTUP_CLEAR_Marshal(source, buffer, size)                            \
751     Marshal(TPMA_STARTUP_CLEAR_MARSHAL_REF, (source), (buffer), (size))
752 #define TPMA_MEMORY_Marshal(source, buffer, size)                                   \
753     Marshal(TPMA_MEMORY_MARSHAL_REF, (source), (buffer), (size))
754 #define TPMA_CC_Marshal(source, buffer, size)                                       \
755     Marshal(TPMA_CC_MARSHAL_REF, (source), (buffer), (size))
756 #define TPMA_MODES_Marshal(source, buffer, size)                                    \
757     Marshal(TPMA_MODES_MARSHAL_REF, (source), (buffer), (size))
758 #define TPMA_X509_KEY_USAGE_Marshal(source, buffer, size)                           \
759     Marshal(TPMA_X509_KEY_USAGE_MARSHAL_REF, (source), (buffer), (size))
760 #define TPMA_ACT_Unmarshal(target, buffer, size)                                    \
761     Unmarshal(TPMA_ACT_MARSHAL_REF, (target), (buffer), (size))
762 #define TPMA_ACT_Marshal(source, buffer, size)                                      \
763     Marshal(TPMA_ACT_MARSHAL_REF, (source), (buffer), (size))
764 #define TPMI_YES_NO_Unmarshal(target, buffer, size)                                 \
765     Unmarshal(TPMI_YES_NO_MARSHAL_REF, (target), (buffer), (size))
766 #define TPMI_YES_NO_Marshal(source, buffer, size)                                   \
767     Marshal(TPMI_YES_NO_MARSHAL_REF, (source), (buffer), (size))
768 #define TPMI_DH_OBJECT_Unmarshal(target, buffer, size, flag)                        \
769     Unmarshal(TPMI_DH_OBJECT_MARSHAL_REF|(flag ? NULL_FLAG : 0), (target), (buffer),\
770       (size))
771 #define TPMI_DH_OBJECT_Marshal(source, buffer, size)                                \
772     Marshal(TPMI_DH_OBJECT_MARSHAL_REF, (source), (buffer), (size))
773 #define TPMI_DH_PARENT_Unmarshal(target, buffer, size, flag)                        \
774     Unmarshal(TPMI_DH_PARENT_MARSHAL_REF|(flag ? NULL_FLAG : 0), (target), (buffer),\
775       (size))
776 #define TPMI_DH_PARENT_Marshal(source, buffer, size)                                \
777     Marshal(TPMI_DH_PARENT_MARSHAL_REF, (source), (buffer), (size))
778 #define TPMI_DH_PERSISTENT_Unmarshal(target, buffer, size)                          \
779     Unmarshal(TPMI_DH_PERSISTENT_MARSHAL_REF, (target), (buffer), (size))
780 #define TPMI_DH_PERSISTENT_Marshal(source, buffer, size)                            \
781     Marshal(TPMI_DH_PERSISTENT_MARSHAL_REF, (source), (buffer), (size))
782 #define TPMI_DH_ENTITY_Unmarshal(target, buffer, size, flag)                        \
783     Unmarshal(TPMI_DH_ENTITY_MARSHAL_REF|(flag ? NULL_FLAG : 0), (target), (buffer),\
784       (size))
785 #define TPMI_DH_PCR_Unmarshal(target, buffer, size, flag)                           \
786     Unmarshal(TPMI_DH_PCR_MARSHAL_REF|(flag ? NULL_FLAG : 0), (target), (buffer),   \
787       (size))
788 #define TPMI_SH_AUTH_SESSION_Unmarshal(target, buffer, size, flag)                  \
789     Unmarshal(TPMI_SH_AUTH_SESSION_MARSHAL_REF|(flag ? NULL_FLAG : 0), (target),    \
790       (buffer), (size))
791 #define TPMI_SH_AUTH_SESSION_Marshal(source, buffer, size)                          \
792     Marshal(TPMI_SH_AUTH_SESSION_MARSHAL_REF, (source), (buffer), (size))
793 #define TPMI_SH_HMAC_Unmarshal(target, buffer, size)                                \
794     Unmarshal(TPMI_SH_HMAC_MARSHAL_REF, (target), (buffer), (size))
795 #define TPMI_SH_HMAC_Marshal(source, buffer, size)                                  \
796     Marshal(TPMI_SH_HMAC_MARSHAL_REF, (source), (buffer), (size))
797 #define TPMI_SH_POLICY_Unmarshal(target, buffer, size)                              \
798     Unmarshal(TPMI_SH_POLICY_MARSHAL_REF, (target), (buffer), (size))
799 #define TPMI_SH_POLICY_Marshal(source, buffer, size)                                \
800     Marshal(TPMI_SH_POLICY_MARSHAL_REF, (source), (buffer), (size))
801 #define TPMI_DH_CONTEXT_Unmarshal(target, buffer, size)                             \
802     Unmarshal(TPMI_DH_CONTEXT_MARSHAL_REF, (target), (buffer), (size))
803 #define TPMI_DH_CONTEXT_Marshal(source, buffer, size)                               \
804     Marshal(TPMI_DH_CONTEXT_MARSHAL_REF, (source), (buffer), (size))
805 #define TPMI_DH_SAVED_Unmarshal(target, buffer, size)                               \
806     Unmarshal(TPMI_DH_SAVED_MARSHAL_REF, (target), (buffer), (size))
807 #define TPMI_DH_SAVED_Marshal(source, buffer, size)                                 \
808     Marshal(TPMI_DH_SAVED_MARSHAL_REF, (source), (buffer), (size))
809 #define TPMI_RH_HIERARCHY_Unmarshal(target, buffer, size, flag)                     \
810     Unmarshal(TPMI_RH_HIERARCHY_MARSHAL_REF|(flag ? NULL_FLAG : 0), (target),       \
811       (buffer), (size))
812 #define TPMI_RH_HIERARCHY_Marshal(source, buffer, size)                             \
813     Marshal(TPMI_RH_HIERARCHY_MARSHAL_REF, (source), (buffer), (size))
814 #define TPMI_RH_ENABLES_Unmarshal(target, buffer, size, flag)                       \
815     Unmarshal(TPMI_RH_ENABLES_MARSHAL_REF|(flag ? NULL_FLAG : 0), (target),         \
816       (buffer), (size))
817 #define TPMI_RH_ENABLES_Marshal(source, buffer, size)                               \
818     Marshal(TPMI_RH_ENABLES_MARSHAL_REF, (source), (buffer), (size))
819 #define TPMI_RH_HIERARCHY_AUTH_Unmarshal(target, buffer, size)                      \
820     Unmarshal(TPMI_RH_HIERARCHY_AUTH_MARSHAL_REF, (target), (buffer), (size))
821 #define TPMI_RH_HIERARCHY_POLICY_Unmarshal(target, buffer, size)                    \
822     Unmarshal(TPMI_RH_HIERARCHY_POLICY_MARSHAL_REF, (target), (buffer), (size))
823 #define TPMI_RH_PLATFORM_Unmarshal(target, buffer, size)                            \
824     Unmarshal(TPMI_RH_PLATFORM_MARSHAL_REF, (target), (buffer), (size))
825 #define TPMI_RH_OWNER_Unmarshal(target, buffer, size, flag)                         \
826     Unmarshal(TPMI_RH_OWNER_MARSHAL_REF|(flag ? NULL_FLAG : 0), (target), (buffer), \
827       (size))
828 #define TPMI_RH_ENDORSEMENT_Unmarshal(target, buffer, size, flag)                   \
829     Unmarshal(TPMI_RH_ENDORSEMENT_MARSHAL_REF|(flag ? NULL_FLAG : 0), (target),     \
830       (buffer), (size))
831 #define TPMI_RH_PROVISION_Unmarshal(target, buffer, size)                           \
832     Unmarshal(TPMI_RH_PROVISION_MARSHAL_REF, (target), (buffer), (size))
833 #define TPMI_RH_CLEAR_Unmarshal(target, buffer, size)                               \
834     Unmarshal(TPMI_RH_CLEAR_MARSHAL_REF, (target), (buffer), (size))
835 #define TPMI_RH_NV_AUTH_Unmarshal(target, buffer, size)                             \
836     Unmarshal(TPMI_RH_NV_AUTH_MARSHAL_REF, (target), (buffer), (size))
837 #define TPMI_RH_LOCKOUT_Unmarshal(target, buffer, size)                             \
838     Unmarshal(TPMI_RH_LOCKOUT_MARSHAL_REF, (target), (buffer), (size))
839 #define TPMI_RH_NV_INDEX_Unmarshal(target, buffer, size)                            \
840     Unmarshal(TPMI_RH_NV_INDEX_MARSHAL_REF, (target), (buffer), (size))
841 #define TPMI_RH_NV_INDEX_Marshal(source, buffer, size)                              \
842     Marshal(TPMI_RH_NV_INDEX_MARSHAL_REF, (source), (buffer), (size))
843 #define TPMI_RH_AC_Unmarshal(target, buffer, size)                                  \
844     Unmarshal(TPMI_RH_AC_MARSHAL_REF, (target), (buffer), (size))
845 #define TPMI_RH_ACT_Unmarshal(target, buffer, size)                                 \
846     Unmarshal(TPMI_RH_ACT_MARSHAL_REF, (target), (buffer), (size))
847 #define TPMI_RH_ACT_Marshal(source, buffer, size)                                   \
848     Marshal(TPMI_RH_ACT_MARSHAL_REF, (source), (buffer), (size))
849 #define TPMI_ALG_HASH_Unmarshal(target, buffer, size, flag)                         \
850     Unmarshal(TPMI_ALG_HASH_MARSHAL_REF|(flag ? NULL_FLAG : 0), (target), (buffer), \
851       (size))
852 #define TPMI_ALG_HASH_Marshal(source, buffer, size)                                 \
853     Marshal(TPMI_ALG_HASH_MARSHAL_REF, (source), (buffer), (size))
854 #define TPMI_ALG_ASYM_Unmarshal(target, buffer, size, flag)                         \
855     Unmarshal(TPMI_ALG_ASYM_MARSHAL_REF|(flag ? NULL_FLAG : 0), (target), (buffer), \
856       (size))
857 #define TPMI_ALG_ASYM_Marshal(source, buffer, size)                                 \
858     Marshal(TPMI_ALG_ASYM_MARSHAL_REF, (source), (buffer), (size))
859 #define TPMI_ALG_SYM_Unmarshal(target, buffer, size, flag)                          \
860     Unmarshal(TPMI_ALG_SYM_MARSHAL_REF|(flag ? NULL_FLAG : 0), (target), (buffer),  \
861       (size))
862 #define TPMI_ALG_SYM_Marshal(source, buffer, size)                                  \
863     Marshal(TPMI_ALG_SYM_MARSHAL_REF, (source), (buffer), (size))
864 #define TPMI_ALG_SYM_OBJECT_Unmarshal(target, buffer, size, flag)                   \
865     Unmarshal(TPMI_ALG_SYM_OBJECT_MARSHAL_REF|(flag ? NULL_FLAG : 0), (target),     \
866       (buffer), (size))
867 #define TPMI_ALG_SYM_OBJECT_Marshal(source, buffer, size)                           \
868     Marshal(TPMI_ALG_SYM_OBJECT_MARSHAL_REF, (source), (buffer), (size))
869 #define TPMI_ALG_SYM_MODE_Unmarshal(target, buffer, size, flag)                     \
870     Unmarshal(TPMI_ALG_SYM_MODE_MARSHAL_REF|(flag ? NULL_FLAG : 0), (target),       \
871       (buffer), (size))
872 #define TPMI_ALG_SYM_MODE_Marshal(source, buffer, size)                             \
873     Marshal(TPMI_ALG_SYM_MODE_MARSHAL_REF, (source), (buffer), (size))
874 #define TPMI_ALG_KDF_Unmarshal(target, buffer, size, flag)                          \
875     Unmarshal(TPMI_ALG_KDF_MARSHAL_REF|(flag ? NULL_FLAG : 0), (target), (buffer),  \
876       (size))
877 #define TPMI_ALG_KDF_Marshal(source, buffer, size)                                  \
878     Marshal(TPMI_ALG_KDF_MARSHAL_REF, (source), (buffer), (size))
879 #define TPMI_ALG_SIG_SCHEME_Unmarshal(target, buffer, size, flag)                   \
880     Unmarshal(TPMI_ALG_SIG_SCHEME_MARSHAL_REF|(flag ? NULL_FLAG : 0), (target),     \
881       (buffer), (size))
882 #define TPMI_ALG_SIG_SCHEME_Marshal(source, buffer, size)                           \
883     Marshal(TPMI_ALG_SIG_SCHEME_MARSHAL_REF, (source), (buffer), (size))
884 #define TPMI_ECC_KEY_EXCHANGE_Unmarshal(target, buffer, size, flag)                 \
885     Unmarshal(TPMI_ECC_KEY_EXCHANGE_MARSHAL_REF|(flag ? NULL_FLAG : 0), (target),   \
886       (buffer), (size))
887 #define TPMI_ECC_KEY_EXCHANGE_Marshal(source, buffer, size)                         \
888     Marshal(TPMI_ECC_KEY_EXCHANGE_MARSHAL_REF, (source), (buffer), (size))
889 #define TPMI_ST_COMMAND_TAG_Unmarshal(target, buffer, size)                         \
890     Unmarshal(TPMI_ST_COMMAND_TAG_MARSHAL_REF, (target), (buffer), (size))
891 #define TPMI_ST_COMMAND_TAG_Marshal(source, buffer, size)                           \
892     Marshal(TPMI_ST_COMMAND_TAG_MARSHAL_REF, (source), (buffer), (size))
893 #define TPMI_ALG_MAC_SCHEME_Unmarshal(target, buffer, size, flag)                   \
894     Unmarshal(TPMI_ALG_MAC_SCHEME_MARSHAL_REF|(flag ? NULL_FLAG : 0), (target),     \
895       (buffer), (size))
896 #define TPMI_ALG_MAC_SCHEME_Marshal(source, buffer, size)                           \
897     Marshal(TPMI_ALG_MAC_SCHEME_MARSHAL_REF, (source), (buffer), (size))
898 #define TPMI_ALG_CIPHER_MODE_Unmarshal(target, buffer, size, flag)                  \
899     Unmarshal(TPMI_ALG_CIPHER_MODE_MARSHAL_REF|(flag ? NULL_FLAG : 0), (target),    \
900       (buffer), (size))
901 #define TPMI_ALG_CIPHER_MODE_Marshal(source, buffer, size)                          \
902     Marshal(TPMI_ALG_CIPHER_MODE_MARSHAL_REF, (source), (buffer), (size))
903 #define TPMS_EMPTY_Unmarshal(target, buffer, size)                                  \
904     Unmarshal(TPMS_EMPTY_MARSHAL_REF, (target), (buffer), (size))
905 #define TPMS_EMPTY_Marshal(source, buffer, size)                                    \
906     Marshal(TPMS_EMPTY_MARSHAL_REF, (source), (buffer), (size))
907 #define TPMS_ALGORITHM_DESCRIPTION_Marshal(source, buffer, size)                    \
908     Marshal(TPMS_ALGORITHM_DESCRIPTION_MARSHAL_REF, (source), (buffer), (size))
909 #define TPMU_HA_Unmarshal(target, buffer, size, selector)                           \
910     UnmarshalUnion(TPMU_HA_MARSHAL_REF, (target), (buffer), (size), (selector))
911 #define TPMU_HA_Marshal(source, buffer, size, selector)                             \
912     MarshalUnion(TPMU_HA_MARSHAL_REF, (source), (buffer), (size), (selector))
913 #define TPMT_HA_Unmarshal(target, buffer, size, flag)                               \
914     Unmarshal(TPMT_HA_MARSHAL_REF|(flag ? NULL_FLAG : 0), (target), (buffer),       \
915       (size))
916 #define TPMT_HA_Marshal(source, buffer, size)                                       \
917     Marshal(TPMT_HA_MARSHAL_REF, (source), (buffer), (size))
918 #define TPM2B_DIGEST_Unmarshal(target, buffer, size)                                \
919     Unmarshal(TPM2B_DIGEST_MARSHAL_REF, (target), (buffer), (size))
920 #define TPM2B_DIGEST_Marshal(source, buffer, size)                                  \
921     Marshal(TPM2B_DIGEST_MARSHAL_REF, (source), (buffer), (size))
922 #define TPM2B_DATA_Unmarshal(target, buffer, size)                                  \
923     Unmarshal(TPM2B_DATA_MARSHAL_REF, (target), (buffer), (size))
924 #define TPM2B_DATA_Marshal(source, buffer, size)                                    \
925     Marshal(TPM2B_DATA_MARSHAL_REF, (source), (buffer), (size))
926 #define TPM2B_NONCE_Unmarshal(target, buffer, size)                                 \
927     Unmarshal(TPM2B_NONCE_MARSHAL_REF, (target), (buffer), (size))
928 #define TPM2B_NONCE_Marshal(source, buffer, size)                                   \
929     Marshal(TPM2B_NONCE_MARSHAL_REF, (source), (buffer), (size))
930 #define TPM2B_AUTH_Unmarshal(target, buffer, size)                                  \
931     Unmarshal(TPM2B_AUTH_MARSHAL_REF, (target), (buffer), (size))
932 #define TPM2B_AUTH_Marshal(source, buffer, size)                                    \
933     Marshal(TPM2B_AUTH_MARSHAL_REF, (source), (buffer), (size))
934 #define TPM2B_OPERAND_Unmarshal(target, buffer, size)                               \
935     Unmarshal(TPM2B_OPERAND_MARSHAL_REF, (target), (buffer), (size))
936 #define TPM2B_OPERAND_Marshal(source, buffer, size)                                 \
937     Marshal(TPM2B_OPERAND_MARSHAL_REF, (source), (buffer), (size))
938 #define TPM2B_EVENT_Unmarshal(target, buffer, size)                                 \
939     Unmarshal(TPM2B_EVENT_MARSHAL_REF, (target), (buffer), (size))
940 #define TPM2B_EVENT_Marshal(source, buffer, size)                                   \
941     Marshal(TPM2B_EVENT_MARSHAL_REF, (source), (buffer), (size))
942 #define TPM2B_MAX_BUFFER_Unmarshal(target, buffer, size)                            \
943     Unmarshal(TPM2B_MAX_BUFFER_MARSHAL_REF, (target), (buffer), (size))
944 #define TPM2B_MAX_BUFFER_Marshal(source, buffer, size)                              \
945     Marshal(TPM2B_MAX_BUFFER_MARSHAL_REF, (source), (buffer), (size))
946 #define TPM2B_MAX_NV_BUFFER_Unmarshal(target, buffer, size)                         \
947     Unmarshal(TPM2B_MAX_NV_BUFFER_MARSHAL_REF, (target), (buffer), (size))
948 #define TPM2B_MAX_NV_BUFFER_Marshal(source, buffer, size)                           \
949     Marshal(TPM2B_MAX_NV_BUFFER_MARSHAL_REF, (source), (buffer), (size))
950 #define TPM2B_TIMEOUT_Unmarshal(target, buffer, size)                               \
951     Unmarshal(TPM2B_TIMEOUT_MARSHAL_REF, (target), (buffer), (size))
952 #define TPM2B_TIMEOUT_Marshal(source, buffer, size)                                 \
953     Marshal(TPM2B_TIMEOUT_MARSHAL_REF, (source), (buffer), (size))
954 #define TPM2B_IV_Unmarshal(target, buffer, size)                                    \
955     Unmarshal(TPM2B_IV_MARSHAL_REF, (target), (buffer), (size))
956 #define TPM2B_IV_Marshal(source, buffer, size)                                      \
957     Marshal(TPM2B_IV_MARSHAL_REF, (source), (buffer), (size))
958 #define TPM2B_NAME_Unmarshal(target, buffer, size)                                  \
959     Unmarshal(TPM2B_NAME_MARSHAL_REF, (target), (buffer), (size))
960 #define TPM2B_NAME_Marshal(source, buffer, size)                                    \
961     Marshal(TPM2B_NAME_MARSHAL_REF, (source), (buffer), (size))
962 #define TPMS_PCR_SELECT_Unmarshal(target, buffer, size)                             \
963     Unmarshal(TPMS_PCR_SELECT_MARSHAL_REF, (target), (buffer), (size))
964 #define TPMS_PCR_SELECT_Marshal(source, buffer, size)                               \
965     Marshal(TPMS_PCR_SELECT_MARSHAL_REF, (source), (buffer), (size))
966 #define TPMS_PCR_SELECTION_Unmarshal(target, buffer, size)                          \
967     Unmarshal(TPMS_PCR_SELECTION_MARSHAL_REF, (target), (buffer), (size))
968 #define TPMS_PCR_SELECTION_Marshal(source, buffer, size)                            \
969     Marshal(TPMS_PCR_SELECTION_MARSHAL_REF, (source), (buffer), (size))
970 #define TPMT_TK_CREATION_Unmarshal(target, buffer, size)                            \
971     Unmarshal(TPMT_TK_CREATION_MARSHAL_REF, (target), (buffer), (size))
972 #define TPMT_TK_CREATION_Marshal(source, buffer, size)                              \
973     Marshal(TPMT_TK_CREATION_MARSHAL_REF, (source), (buffer), (size))
974 #define TPMT_TK_VERIFIED_Unmarshal(target, buffer, size)                            \
975     Unmarshal(TPMT_TK_VERIFIED_MARSHAL_REF, (target), (buffer), (size))
976 #define TPMT_TK_VERIFIED_Marshal(source, buffer, size)                              \
977     Marshal(TPMT_TK_VERIFIED_MARSHAL_REF, (source), (buffer), (size))
978 #define TPMT_TK_AUTH_Unmarshal(target, buffer, size)                                \
979     Unmarshal(TPMT_TK_AUTH_MARSHAL_REF, (target), (buffer), (size))
980 #define TPMT_TK_AUTH_Marshal(source, buffer, size)                                  \
981     Marshal(TPMT_TK_AUTH_MARSHAL_REF, (source), (buffer), (size))
982 #define TPMT_TK_HASHCHECK_Unmarshal(target, buffer, size)                           \
983     Unmarshal(TPMT_TK_HASHCHECK_MARSHAL_REF, (target), (buffer), (size))
984 #define TPMT_TK_HASHCHECK_Marshal(source, buffer, size)                             \
985     Marshal(TPMT_TK_HASHCHECK_MARSHAL_REF, (source), (buffer), (size))
986 #define TPMS_ALG_PROPERTY_Marshal(source, buffer, size)                             \
987     Marshal(TPMS_ALG_PROPERTY_MARSHAL_REF, (source), (buffer), (size))
988 #define TPMS_TAGGED_PROPERTY_Marshal(source, buffer, size)                          \
989     Marshal(TPMS_TAGGED_PROPERTY_MARSHAL_REF, (source), (buffer), (size))
990 #define TPMS_TAGGED_PCR_SELECT_Marshal(source, buffer, size)                        \
991     Marshal(TPMS_TAGGED_PCR_SELECT_MARSHAL_REF, (source), (buffer), (size))
992 #define TPMS_TAGGED_POLICY_Marshal(source, buffer, size)                            \
993     Marshal(TPMS_TAGGED_POLICY_MARSHAL_REF, (source), (buffer), (size))
994 #define TPMS_ACT_DATA_Marshal(source, buffer, size)                                 \
995     Marshal(TPMS_ACT_DATA_MARSHAL_REF, (source), (buffer), (size))
996 #define TPML_CC_Unmarshal(target, buffer, size)                                     \
997     Unmarshal(TPML_CC_MARSHAL_REF, (target), (buffer), (size))
998 #define TPML_CC_Marshal(source, buffer, size)                                       \
999     Marshal(TPML_CC_MARSHAL_REF, (source), (buffer), (size))
1000 #define TPML_CCA_Marshal(source, buffer, size)                                      \
1001     Marshal(TPML_CCA_MARSHAL_REF, (source), (buffer), (size))
1002 #define TPML_ALG_Unmarshal(target, buffer, size)                                    \
1003     Unmarshal(TPML_ALG_MARSHAL_REF, (target), (buffer), (size))
1004 #define TPML_ALG_Marshal(source, buffer, size)                                      \
1005     Marshal(TPML_ALG_MARSHAL_REF, (source), (buffer), (size))
1006 #define TPML_HANDLE_Marshal(source, buffer, size)                                   \
1007     Marshal(TPML_HANDLE_MARSHAL_REF, (source), (buffer), (size))
1008 #define TPML_DIGEST_Unmarshal(target, buffer, size)                                 \
1009     Unmarshal(TPML_DIGEST_MARSHAL_REF, (target), (buffer), (size))
1010 #define TPML_DIGEST_Marshal(source, buffer, size)                                   \
1011     Marshal(TPML_DIGEST_MARSHAL_REF, (source), (buffer), (size))
1012 #define TPML_DIGEST_VALUES_Unmarshal(target, buffer, size)                          \
1013     Unmarshal(TPML_DIGEST_VALUES_MARSHAL_REF, (target), (buffer), (size))
1014 #define TPML_DIGEST_VALUES_Marshal(source, buffer, size)                            \
1015     Marshal(TPML_DIGEST_VALUES_MARSHAL_REF, (source), (buffer), (size))
1016 #define TPML_PCR_SELECTION_Unmarshal(target, buffer, size)                          \
1017     Unmarshal(TPML_PCR_SELECTION_MARSHAL_REF, (target), (buffer), (size))
1018 #define TPML_PCR_SELECTION_Marshal(source, buffer, size)                            \
1019     Marshal(TPML_PCR_SELECTION_MARSHAL_REF, (source), (buffer), (size))
1020 #define TPML_ALG_PROPERTY_Marshal(source, buffer, size)                             \
1021     Marshal(TPML_ALG_PROPERTY_MARSHAL_REF, (source), (buffer), (size))
1022 #define TPML_TAGGED_TPM_PROPERTY_Marshal(source, buffer, size)                      \
1023     Marshal(TPML_TAGGED_TPM_PROPERTY_MARSHAL_REF, (source), (buffer), (size))
1024 #define TPML_TAGGED_PCR_PROPERTY_Marshal(source, buffer, size)                      \
1025     Marshal(TPML_TAGGED_PCR_PROPERTY_MARSHAL_REF, (source), (buffer), (size))
1026 #define TPML_ECC_CURVE_Marshal(source, buffer, size)                                \
1027     Marshal(TPML_ECC_CURVE_MARSHAL_REF, (source), (buffer), (size))
1028 #define TPML_TAGGED_POLICY_Marshal(source, buffer, size)                            \
1029     Marshal(TPML_TAGGED_POLICY_MARSHAL_REF, (source), (buffer), (size))
1030 #define TPML_ACT_DATA_Marshal(source, buffer, size)                                 \
1031     Marshal(TPML_ACT_DATA_MARSHAL_REF, (source), (buffer), (size))
1032 #define TPMU_CAPABILITIES_Marshal(source, buffer, size, selector)                   \
1033     MarshalUnion(TPMU_CAPABILITIES_MARSHAL_REF, (source), (buffer), (size),         \
1034       (selector))
1035 #define TPMS_CAPABILITY_DATA_Marshal(source, buffer, size)                          \
1036     Marshal(TPMS_CAPABILITY_DATA_MARSHAL_REF, (source), (buffer), (size))
1037 #define TPMS_CLOCK_INFO_Unmarshal(target, buffer, size)                             \
1038     Unmarshal(TPMS_CLOCK_INFO_MARSHAL_REF, (target), (buffer), (size))
1039 #define TPMS_CLOCK_INFO_Marshal(source, buffer, size)                               \
1040     Marshal(TPMS_CLOCK_INFO_MARSHAL_REF, (source), (buffer), (size))
1041 #define TPMS_TIME_INFO_Unmarshal(target, buffer, size)                              \
1042     Unmarshal(TPMS_TIME_INFO_MARSHAL_REF, (target), (buffer), (size))
1043 #define TPMS_TIME_INFO_Marshal(source, buffer, size)                                \
1044     Marshal(TPMS_TIME_INFO_MARSHAL_REF, (source), (buffer), (size))
1045 #define TPMS_TIME_ATTEST_INFO_Marshal(source, buffer, size)                         \
1046     Marshal(TPMS_TIME_ATTEST_INFO_MARSHAL_REF, (source), (buffer), (size))
1047 #define TPMS_CERTIFY_INFO_Marshal(source, buffer, size)                             \
1048     Marshal(TPMS_CERTIFY_INFO_MARSHAL_REF, (source), (buffer), (size))
1049 #define TPMS_QUOTE_INFO_Marshal(source, buffer, size)                               \
1050     Marshal(TPMS_QUOTE_INFO_MARSHAL_REF, (source), (buffer), (size))
1051 #define TPMS_COMMAND_AUDIT_INFO_Marshal(source, buffer, size)                       \
1052     Marshal(TPMS_COMMAND_AUDIT_INFO_MARSHAL_REF, (source), (buffer), (size))
1053 #define TPMS_SESSION_AUDIT_INFO_Marshal(source, buffer, size)                       \
1054     Marshal(TPMS_SESSION_AUDIT_INFO_MARSHAL_REF, (source), (buffer), (size))
1055 #define TPMS_CREATION_INFO_Marshal(source, buffer, size)                            \
1056     Marshal(TPMS_CREATION_INFO_MARSHAL_REF, (source), (buffer), (size))
1057 #define TPMS_NV_CERTIFY_INFO_Marshal(source, buffer, size)                          \
1058     Marshal(TPMS_NV_CERTIFY_INFO_MARSHAL_REF, (source), (buffer), (size))
1059 #define TPMS_NV_DIGEST_CERTIFY_INFO_Marshal(source, buffer, size)                   \
1060     Marshal(TPMS_NV_DIGEST_CERTIFY_INFO_MARSHAL_REF, (source), (buffer), (size))
1061 #define TPMI_ST_ATTEST_Marshal(source, buffer, size)                                \
1062     Marshal(TPMI_ST_ATTEST_MARSHAL_REF, (source), (buffer), (size))
1063 #define TPMU_ATTEST_Marshal(source, buffer, size, selector)                         \
1064     MarshalUnion(TPMU_ATTEST_MARSHAL_REF, (source), (buffer), (size), (selector))
1065 #define TPMS_ATTEST_Marshal(source, buffer, size)                                   \
1066     Marshal(TPMS_ATTEST_MARSHAL_REF, (source), (buffer), (size))
1067 #define TPM2B_ATTEST_Marshal(source, buffer, size)                                  \
1068     Marshal(TPM2B_ATTEST_MARSHAL_REF, (source), (buffer), (size))
1069 #define TPMS_AUTH_COMMAND_Unmarshal(target, buffer, size)                           \
1070     Unmarshal(TPMS_AUTH_COMMAND_MARSHAL_REF, (target), (buffer), (size))
1071 #define TPMS_AUTH_RESPONSE_Marshal(source, buffer, size)                            \
1072     Marshal(TPMS_AUTH_RESPONSE_MARSHAL_REF, (source), (buffer), (size))
1073 #define TPMI_TDES_KEY_BITS_Unmarshal(target, buffer, size)                          \
1074     Unmarshal(TPMI_TDES_KEY_BITS_MARSHAL_REF, (target), (buffer), (size))
1075 #define TPMI_TDES_KEY_BITS_Marshal(source, buffer, size)                            \
1076     Marshal(TPMI_TDES_KEY_BITS_MARSHAL_REF, (source), (buffer), (size))
1077 #define TPMI_AES_KEY_BITS_Unmarshal(target, buffer, size)                           \
1078     Unmarshal(TPMI_AES_KEY_BITS_MARSHAL_REF, (target), (buffer), (size))
1079 #define TPMI_AES_KEY_BITS_Marshal(source, buffer, size)                             \
1080     Marshal(TPMI_AES_KEY_BITS_MARSHAL_REF, (source), (buffer), (size))
1081 #define TPMI_SM4_KEY_BITS_Unmarshal(target, buffer, size)                           \
1082     Unmarshal(TPMI_SM4_KEY_BITS_MARSHAL_REF, (target), (buffer), (size))
1083 #define TPMI_SM4_KEY_BITS_Marshal(source, buffer, size)                             \
1084     Marshal(TPMI_SM4_KEY_BITS_MARSHAL_REF, (source), (buffer), (size))
1085 #define TPMI_CAMELLIA_KEY_BITS_Unmarshal(target, buffer, size)                      \
1086     Unmarshal(TPMI_CAMELLIA_KEY_BITS_MARSHAL_REF, (target), (buffer), (size))
1087 #define TPMI_CAMELLIA_KEY_BITS_Marshal(source, buffer, size)                        \
1088     Marshal(TPMI_CAMELLIA_KEY_BITS_MARSHAL_REF, (source), (buffer), (size))
1089 #define TPMU_SYM_KEY_BITS_Unmarshal(target, buffer, size, selector)                 \
1090     UnmarshalUnion(TPMU_SYM_KEY_BITS_MARSHAL_REF, (target), (buffer), (size),       \
1091       (selector))
1092 #define TPMU_SYM_KEY_BITS_Marshal(source, buffer, size, selector)                   \
1093     MarshalUnion(TPMU_SYM_KEY_BITS_MARSHAL_REF, (source), (buffer), (size),         \
1094       (selector))
1095 #define TPMU_SYM_MODE_Unmarshal(target, buffer, size, selector)                     \
1096     UnmarshalUnion(TPMU_SYM_MODE_MARSHAL_REF, (target), (buffer), (size),           \
1097       (selector))
1098 #define TPMU_SYM_MODE_Marshal(source, buffer, size, selector)                       \
1099     MarshalUnion(TPMU_SYM_MODE_MARSHAL_REF, (source), (buffer), (size), (selector))
1100 #define TPMT_SYM_DEF_Unmarshal(target, buffer, size, flag)                          \
1101     Unmarshal(TPMT_SYM_DEF_MARSHAL_REF|(flag ? NULL_FLAG : 0), (target), (buffer),  \
1102       (size))
1103 #define TPMT_SYM_DEF_Marshal(source, buffer, size)                                  \
1104     Marshal(TPMT_SYM_DEF_MARSHAL_REF, (source), (buffer), (size))
1105 #define TPMT_SYM_DEF_OBJECT_Unmarshal(target, buffer, size, flag)                   \
1106     Unmarshal(TPMT_SYM_DEF_OBJECT_MARSHAL_REF|(flag ? NULL_FLAG : 0), (target),     \
1107       (buffer), (size))
1108 #define TPMT_SYM_DEF_OBJECT_Marshal(source, buffer, size)                           \
1109     Marshal(TPMT_SYM_DEF_OBJECT_MARSHAL_REF, (source), (buffer), (size))
1110 #define TPM2B_SYM_KEY_Unmarshal(target, buffer, size)                               \
1111     Unmarshal(TPM2B_SYM_KEY_MARSHAL_REF, (target), (buffer), (size))
1112 #define TPM2B_SYM_KEY_Marshal(source, buffer, size)                                 \
1113     Marshal(TPM2B_SYM_KEY_MARSHAL_REF, (source), (buffer), (size))
1114 #define TPMS_SYMCIPHER_PARMS_Unmarshal(target, buffer, size)                        \
1115     Unmarshal(TPMS_SYMCIPHER_PARMS_MARSHAL_REF, (target), (buffer), (size))
1116 #define TPMS_SYMCIPHER_PARMS_Marshal(source, buffer, size)                          \
1117     Marshal(TPMS_SYMCIPHER_PARMS_MARSHAL_REF, (source), (buffer), (size))
1118 #define TPM2B_LABEL_Unmarshal(target, buffer, size)                                 \
1119     Unmarshal(TPM2B_LABEL_MARSHAL_REF, (target), (buffer), (size))
1120 #define TPM2B_LABEL_Marshal(source, buffer, size)                                   \
1121     Marshal(TPM2B_LABEL_MARSHAL_REF, (source), (buffer), (size))
1122 #define TPMS_DERIVE_Unmarshal(target, buffer, size)                                 \
1123     Unmarshal(TPMS_DERIVE_MARSHAL_REF, (target), (buffer), (size))
1124 #define TPMS_DERIVE_Marshal(source, buffer, size)                                   \
1125     Marshal(TPMS_DERIVE_MARSHAL_REF, (source), (buffer), (size))
1126 #define TPM2B_DERIVE_Unmarshal(target, buffer, size)                                \
1127     Unmarshal(TPM2B_DERIVE_MARSHAL_REF, (target), (buffer), (size))
1128 #define TPM2B_DERIVE_Marshal(source, buffer, size)                                  \
1129     Marshal(TPM2B_DERIVE_MARSHAL_REF, (source), (buffer), (size))
1130 #define TPM2B_SENSITIVE_DATA_Unmarshal(target, buffer, size)                        \
1131     Unmarshal(TPM2B_SENSITIVE_DATA_MARSHAL_REF, (target), (buffer), (size))
1132 #define TPM2B_SENSITIVE_DATA_Marshal(source, buffer, size)                          \
1133     Marshal(TPM2B_SENSITIVE_DATA_MARSHAL_REF, (source), (buffer), (size))
1134 #define TPMS_SENSITIVE_CREATE_Unmarshal(target, buffer, size)                       \
1135     Unmarshal(TPMS_SENSITIVE_CREATE_MARSHAL_REF, (target), (buffer), (size))
1136 #define TPM2B_SENSITIVE_CREATE_Unmarshal(target, buffer, size)                      \
1137     Unmarshal(TPM2B_SENSITIVE_CREATE_MARSHAL_REF, (target), (buffer), (size))
1138 #define TPMS_SCHEME_HASH_Unmarshal(target, buffer, size)                            \
1139     Unmarshal(TPMS_SCHEME_HASH_MARSHAL_REF, (target), (buffer), (size))
1140 #define TPMS_SCHEME_HASH_Marshal(source, buffer, size)                              \
1141     Marshal(TPMS_SCHEME_HASH_MARSHAL_REF, (source), (buffer), (size))
1142 #define TPMS_SCHEME_ECDAA_Unmarshal(target, buffer, size)                           \
1143     Unmarshal(TPMS_SCHEME_ECDAA_MARSHAL_REF, (target), (buffer), (size))
1144 #define TPMS_SCHEME_ECDAA_Marshal(source, buffer, size)                             \
1145     Marshal(TPMS_SCHEME_ECDAA_MARSHAL_REF, (source), (buffer), (size))
1146 #define TPMI_ALG_KEYEDHASH_SCHEME_Unmarshal(target, buffer, size, flag)             \
1147     Unmarshal(TPMI_ALG_KEYEDHASH_SCHEME_MARSHAL_REF|(flag ? NULL_FLAG : 0),         \
1148       (target), (buffer), (size))
1149 #define TPMI_ALG_KEYEDHASH_SCHEME_Marshal(source, buffer, size)                     \
1150     Marshal(TPMI_ALG_KEYEDHASH_SCHEME_MARSHAL_REF, (source), (buffer), (size))
1151 #define TPMS_SCHEME_HMAC_Unmarshal(target, buffer, size)                            \
1152     Unmarshal(TPMS_SCHEME_HMAC_MARSHAL_REF, (target), (buffer), (size))
1153 #define TPMS_SCHEME_HMAC_Marshal(source, buffer, size)                              \
1154     Marshal(TPMS_SCHEME_HMAC_MARSHAL_REF, (source), (buffer), (size))
1155 #define TPMS_SCHEME_XOR_Unmarshal(target, buffer, size)                             \
1156     Unmarshal(TPMS_SCHEME_XOR_MARSHAL_REF, (target), (buffer), (size))
1157 #define TPMS_SCHEME_XOR_Marshal(source, buffer, size)                               \
1158     Marshal(TPMS_SCHEME_XOR_MARSHAL_REF, (source), (buffer), (size))
1159 #define TPMU_SCHEME_KEYEDHASH_Unmarshal(target, buffer, size, selector)             \
1160     UnmarshalUnion(TPMU_SCHEME_KEYEDHASH_MARSHAL_REF, (target), (buffer), (size),   \
1161       (selector))
1162 #define TPMU_SCHEME_KEYEDHASH_Marshal(source, buffer, size, selector)               \
1163     MarshalUnion(TPMU_SCHEME_KEYEDHASH_MARSHAL_REF, (source), (buffer), (size),     \
1164       (selector))
1165 #define TPMT_KEYEDHASH_SCHEME_Unmarshal(target, buffer, size, flag)                 \
1166     Unmarshal(TPMT_KEYEDHASH_SCHEME_MARSHAL_REF|(flag ? NULL_FLAG : 0), (target),   \
1167       (buffer), (size))
1168 #define TPMT_KEYEDHASH_SCHEME_Marshal(source, buffer, size)                         \
1169     Marshal(TPMT_KEYEDHASH_SCHEME_MARSHAL_REF, (source), (buffer), (size))
1170 #define TPMS_SIG_SCHEME_RSASSA_Unmarshal(target, buffer, size)                      \
1171     Unmarshal(TPMS_SIG_SCHEME_RSASSA_MARSHAL_REF, (target), (buffer), (size))
1172 #define TPMS_SIG_SCHEME_RSASSA_Marshal(source, buffer, size)                        \
1173     Marshal(TPMS_SIG_SCHEME_RSASSA_MARSHAL_REF, (source), (buffer), (size))
1174 #define TPMS_SIG_SCHEME_RSAPSS_Unmarshal(target, buffer, size)                      \
1175     Unmarshal(TPMS_SIG_SCHEME_RSAPSS_MARSHAL_REF, (target), (buffer), (size))
1176 #define TPMS_SIG_SCHEME_RSAPSS_Marshal(source, buffer, size)                        \
1177     Marshal(TPMS_SIG_SCHEME_RSAPSS_MARSHAL_REF, (source), (buffer), (size))
1178 #define TPMS_SIG_SCHEME_ECDSA_Unmarshal(target, buffer, size)                       \
1179     Unmarshal(TPMS_SIG_SCHEME_ECDSA_MARSHAL_REF, (target), (buffer), (size))
1180 #define TPMS_SIG_SCHEME_ECDSA_Marshal(source, buffer, size)                         \
1181     Marshal(TPMS_SIG_SCHEME_ECDSA_MARSHAL_REF, (source), (buffer), (size))
1182 #define TPMS_SIG_SCHEME_SM2_Unmarshal(target, buffer, size)                         \
1183     Unmarshal(TPMS_SIG_SCHEME_SM2_MARSHAL_REF, (target), (buffer), (size))
1184 #define TPMS_SIG_SCHEME_SM2_Marshal(source, buffer, size)                           \
1185     Marshal(TPMS_SIG_SCHEME_SM2_MARSHAL_REF, (source), (buffer), (size))
1186 #define TPMS_SIG_SCHEME_ECSCHNORR_Unmarshal(target, buffer, size)                   \
1187     Unmarshal(TPMS_SIG_SCHEME_ECSCHNORR_MARSHAL_REF, (target), (buffer), (size))
1188 #define TPMS_SIG_SCHEME_ECSCHNORR_Marshal(source, buffer, size)                     \
1189     Marshal(TPMS_SIG_SCHEME_ECSCHNORR_MARSHAL_REF, (source), (buffer), (size))
1190 #define TPMS_SIG_SCHEME_ECDAA_Unmarshal(target, buffer, size)                       \
1191     Unmarshal(TPMS_SIG_SCHEME_ECDAA_MARSHAL_REF, (target), (buffer), (size))
1192 #define TPMS_SIG_SCHEME_ECDAA_Marshal(source, buffer, size)                         \
1193     Marshal(TPMS_SIG_SCHEME_ECDAA_MARSHAL_REF, (source), (buffer), (size))
1194 #define TPMU_SIG_SCHEME_Unmarshal(target, buffer, size, selector)                   \
1195     UnmarshalUnion(TPMU_SIG_SCHEME_MARSHAL_REF, (target), (buffer), (size),         \
1196       (selector))
1197 #define TPMU_SIG_SCHEME_Marshal(source, buffer, size, selector)                     \
1198     MarshalUnion(TPMU_SIG_SCHEME_MARSHAL_REF, (source), (buffer), (size),           \
1199       (selector))
1200 #define TPMT_SIG_SCHEME_Unmarshal(target, buffer, size, flag)                       \
1201     Unmarshal(TPMT_SIG_SCHEME_MARSHAL_REF|(flag ? NULL_FLAG : 0), (target),         \
1202       (buffer), (size))
1203 #define TPMT_SIG_SCHEME_Marshal(source, buffer, size)                               \
1204     Marshal(TPMT_SIG_SCHEME_MARSHAL_REF, (source), (buffer), (size))
1205 #define TPMS_ENC_SCHEME_OAEP_Unmarshal(target, buffer, size)                        \
1206     Unmarshal(TPMS_ENC_SCHEME_OAEP_MARSHAL_REF, (target), (buffer), (size))
1207 #define TPMS_ENC_SCHEME_OAEP_Marshal(source, buffer, size)                          \
1208     Marshal(TPMS_ENC_SCHEME_OAEP_MARSHAL_REF, (source), (buffer), (size))
1209 #define TPMS_ENC_SCHEME_RSAES_Unmarshal(target, buffer, size)                       \
1210     Unmarshal(TPMS_ENC_SCHEME_RSAES_MARSHAL_REF, (target), (buffer), (size))
1211 #define TPMS_ENC_SCHEME_RSAES_Marshal(source, buffer, size)                         \
1212     Marshal(TPMS_ENC_SCHEME_RSAES_MARSHAL_REF, (source), (buffer), (size))
1213 #define TPMS_KEY_SCHEME_ECDH_Unmarshal(target, buffer, size)                        \
1214     Unmarshal(TPMS_KEY_SCHEME_ECDH_MARSHAL_REF, (target), (buffer), (size))
1215 #define TPMS_KEY_SCHEME_ECDH_Marshal(source, buffer, size)                          \
1216     Marshal(TPMS_KEY_SCHEME_ECDH_MARSHAL_REF, (source), (buffer), (size))
1217 #define TPMS_KEY_SCHEME_ECMQV_Unmarshal(target, buffer, size)                       \
1218     Unmarshal(TPMS_KEY_SCHEME_ECMQV_MARSHAL_REF, (target), (buffer), (size))
1219 #define TPMS_KEY_SCHEME_ECMQV_Marshal(source, buffer, size)                         \
1220     Marshal(TPMS_KEY_SCHEME_ECMQV_MARSHAL_REF, (source), (buffer), (size))
1221 #define TPMS_KDF_SCHEME_MGF1_Unmarshal(target, buffer, size)                        \
1222     Unmarshal(TPMS_KDF_SCHEME_MGF1_MARSHAL_REF, (target), (buffer), (size))
1223 #define TPMS_KDF_SCHEME_MGF1_Marshal(source, buffer, size)                          \
1224     Marshal(TPMS_KDF_SCHEME_MGF1_MARSHAL_REF, (source), (buffer), (size))
1225 #define TPMS_KDF_SCHEME_KDF1_SP800_56A_Unmarshal(target, buffer, size)              \
1226     Unmarshal(TPMS_KDF_SCHEME_KDF1_SP800_56A_MARSHAL_REF, (target), (buffer),       \
1227       (size))
1228 #define TPMS_KDF_SCHEME_KDF1_SP800_56A_Marshal(source, buffer, size)                \
1229     Marshal(TPMS_KDF_SCHEME_KDF1_SP800_56A_MARSHAL_REF, (source), (buffer), (size))
1230 #define TPMS_KDF_SCHEME_KDF2_Unmarshal(target, buffer, size)                        \
1231     Unmarshal(TPMS_KDF_SCHEME_KDF2_MARSHAL_REF, (target), (buffer), (size))
1232 #define TPMS_KDF_SCHEME_KDF2_Marshal(source, buffer, size)                          \
1233     Marshal(TPMS_KDF_SCHEME_KDF2_MARSHAL_REF, (source), (buffer), (size))
1234 #define TPMS_KDF_SCHEME_KDF1_SP800_108_Unmarshal(target, buffer, size)              \
1235     Unmarshal(TPMS_KDF_SCHEME_KDF1_SP800_108_MARSHAL_REF, (target), (buffer),       \
1236       (size))
1237 #define TPMS_KDF_SCHEME_KDF1_SP800_108_Marshal(source, buffer, size)                \
1238     Marshal(TPMS_KDF_SCHEME_KDF1_SP800_108_MARSHAL_REF, (source), (buffer), (size))
1239 #define TPMU_KDF_SCHEME_Unmarshal(target, buffer, size, selector)                   \
1240     UnmarshalUnion(TPMU_KDF_SCHEME_MARSHAL_REF, (target), (buffer), (size),         \
1241       (selector))
1242 #define TPMU_KDF_SCHEME_Marshal(source, buffer, size, selector)                     \
1243     MarshalUnion(TPMU_KDF_SCHEME_MARSHAL_REF, (source), (buffer), (size),           \
1244       (selector))
1245 #define TPMT_KDF_SCHEME_Unmarshal(target, buffer, size, flag)                       \
1246     Unmarshal(TPMT_KDF_SCHEME_MARSHAL_REF|(flag ? NULL_FLAG : 0), (target),         \
1247       (buffer), (size))
1248 #define TPMT_KDF_SCHEME_Marshal(source, buffer, size)                               \
1249     Marshal(TPMT_KDF_SCHEME_MARSHAL_REF, (source), (buffer), (size))
1250 #define TPMI_ALG_ASYM_SCHEME_Unmarshal(target, buffer, size, flag)                  \
1251     Unmarshal(TPMI_ALG_ASYM_SCHEME_MARSHAL_REF|(flag ? NULL_FLAG : 0), (target),    \
1252       (buffer), (size))
1253 #define TPMI_ALG_ASYM_SCHEME_Marshal(source, buffer, size)                          \
1254     Marshal(TPMI_ALG_ASYM_SCHEME_MARSHAL_REF, (source), (buffer), (size))
1255 #define TPMU_ASYM_SCHEME_Unmarshal(target, buffer, size, selector)                  \
1256     UnmarshalUnion(TPMU_ASYM_SCHEME_MARSHAL_REF, (target), (buffer), (size),        \
1257       (selector))
1258 #define TPMU_ASYM_SCHEME_Marshal(source, buffer, size, selector)                    \
1259     MarshalUnion(TPMU_ASYM_SCHEME_MARSHAL_REF, (source), (buffer), (size),          \
1260       (selector))
1261 #define TPMI_ALG_RSA_SCHEME_Unmarshal(target, buffer, size, flag)                   \
1262     Unmarshal(TPMI_ALG_RSA_SCHEME_MARSHAL_REF|(flag ? NULL_FLAG : 0), (target),     \
1263       (buffer), (size))
1264 #define TPMI_ALG_RSA_SCHEME_Marshal(source, buffer, size)                           \
1265     Marshal(TPMI_ALG_RSA_SCHEME_MARSHAL_REF, (source), (buffer), (size))
1266 #define TPMT_RSA_SCHEME_Unmarshal(target, buffer, size, flag)                       \
1267     Unmarshal(TPMT_RSA_SCHEME_MARSHAL_REF|(flag ? NULL_FLAG : 0), (target),         \
1268       (buffer), (size))
1269 #define TPMT_RSA_SCHEME_Marshal(source, buffer, size)                               \
1270     Marshal(TPMT_RSA_SCHEME_MARSHAL_REF, (source), (buffer), (size))
1271 #define TPMI_ALG_RSA_DECRYPT_Unmarshal(target, buffer, size, flag)                  \
1272     Unmarshal(TPMI_ALG_RSA_DECRYPT_MARSHAL_REF|(flag ? NULL_FLAG : 0), (target),    \
1273       (buffer), (size))
1274 #define TPMI_ALG_RSA_DECRYPT_Marshal(source, buffer, size)                          \
1275     Marshal(TPMI_ALG_RSA_DECRYPT_MARSHAL_REF, (source), (buffer), (size))
1276 #define TPMT_RSA_DECRYPT_Unmarshal(target, buffer, size, flag)                      \
1277     Unmarshal(TPMT_RSA_DECRYPT_MARSHAL_REF|(flag ? NULL_FLAG : 0), (target),        \
1278       (buffer), (size))
1279 #define TPMT_RSA_DECRYPT_Marshal(source, buffer, size)                              \
1280     Marshal(TPMT_RSA_DECRYPT_MARSHAL_REF, (source), (buffer), (size))
1281 #define TPM2B_PUBLIC_KEY_RSA_Unmarshal(target, buffer, size)                        \
1282     Unmarshal(TPM2B_PUBLIC_KEY_RSA_MARSHAL_REF, (target), (buffer), (size))
1283 #define TPM2B_PUBLIC_KEY_RSA_Marshal(source, buffer, size)                          \
1284     Marshal(TPM2B_PUBLIC_KEY_RSA_MARSHAL_REF, (source), (buffer), (size))
1285 #define TPMI_RSA_KEY_BITS_Unmarshal(target, buffer, size)                           \
1286     Unmarshal(TPMI_RSA_KEY_BITS_MARSHAL_REF, (target), (buffer), (size))
1287 #define TPMI_RSA_KEY_BITS_Marshal(source, buffer, size)                             \
1288     Marshal(TPMI_RSA_KEY_BITS_MARSHAL_REF, (source), (buffer), (size))
1289 #define TPM2B_PRIVATE_KEY_RSA_Unmarshal(target, buffer, size)                       \
1290     Unmarshal(TPM2B_PRIVATE_KEY_RSA_MARSHAL_REF, (target), (buffer), (size))
1291 #define TPM2B_PRIVATE_KEY_RSA_Marshal(source, buffer, size)                         \
1292     Marshal(TPM2B_PRIVATE_KEY_RSA_MARSHAL_REF, (source), (buffer), (size))
1293 #define TPM2B_ECC_PARAMETER_Unmarshal(target, buffer, size)                         \
1294     Unmarshal(TPM2B_ECC_PARAMETER_MARSHAL_REF, (target), (buffer), (size))
1295 #define TPM2B_ECC_PARAMETER_Marshal(source, buffer, size)                           \
1296     Marshal(TPM2B_ECC_PARAMETER_MARSHAL_REF, (source), (buffer), (size))
1297 #define TPMS_ECC_POINT_Unmarshal(target, buffer, size)                              \
1298     Unmarshal(TPMS_ECC_POINT_MARSHAL_REF, (target), (buffer), (size))
1299 #define TPMS_ECC_POINT_Marshal(source, buffer, size)                                \
1300     Marshal(TPMS_ECC_POINT_MARSHAL_REF, (source), (buffer), (size))
1301 #define TPM2B_ECC_POINT_Unmarshal(target, buffer, size)                             \
1302     Unmarshal(TPM2B_ECC_POINT_MARSHAL_REF, (target), (buffer), (size))
1303 #define TPM2B_ECC_POINT_Marshal(source, buffer, size)                               \
1304     Marshal(TPM2B_ECC_POINT_MARSHAL_REF, (source), (buffer), (size))
1305 #define TPMI_ALG_ECC_SCHEME_Unmarshal(target, buffer, size, flag)                   \
1306     Unmarshal(TPMI_ALG_ECC_SCHEME_MARSHAL_REF|(flag ? NULL_FLAG : 0), (target),     \
1307       (buffer), (size))
1308 #define TPMI_ALG_ECC_SCHEME_Marshal(source, buffer, size)                           \
1309     Marshal(TPMI_ALG_ECC_SCHEME_MARSHAL_REF, (source), (buffer), (size))
1310 #define TPMI_ECC_CURVE_Unmarshal(target, buffer, size)                              \
1311     Unmarshal(TPMI_ECC_CURVE_MARSHAL_REF, (target), (buffer), (size))
1312 #define TPMI_ECC_CURVE_Marshal(source, buffer, size)                                \
1313     Marshal(TPMI_ECC_CURVE_MARSHAL_REF, (source), (buffer), (size))
1314 #define TPMT_ECC_SCHEME_Unmarshal(target, buffer, size, flag)                       \
1315     Unmarshal(TPMT_ECC_SCHEME_MARSHAL_REF|(flag ? NULL_FLAG : 0), (target),         \
1316       (buffer), (size))
1317 #define TPMT_ECC_SCHEME_Marshal(source, buffer, size)                               \
1318     Marshal(TPMT_ECC_SCHEME_MARSHAL_REF, (source), (buffer), (size))
1319 #define TPMS_ALGORITHM_DETAIL_ECC_Marshal(source, buffer, size)                     \
1320     Marshal(TPMS_ALGORITHM_DETAIL_ECC_MARSHAL_REF, (source), (buffer), (size))
1321 #define TPMS_SIGNATURE_RSA_Unmarshal(target, buffer, size)                          \
1322     Unmarshal(TPMS_SIGNATURE_RSA_MARSHAL_REF, (target), (buffer), (size))
1323 #define TPMS_SIGNATURE_RSA_Marshal(source, buffer, size)                            \
1324     Marshal(TPMS_SIGNATURE_RSA_MARSHAL_REF, (source), (buffer), (size))
1325 #define TPMS_SIGNATURE_RSASSA_Unmarshal(target, buffer, size)                       \
1326     Unmarshal(TPMS_SIGNATURE_RSASSA_MARSHAL_REF, (target), (buffer), (size))
1327 #define TPMS_SIGNATURE_RSASSA_Marshal(source, buffer, size)                         \
1328     Marshal(TPMS_SIGNATURE_RSASSA_MARSHAL_REF, (source), (buffer), (size))
1329 #define TPMS_SIGNATURE_RSAPSS_Unmarshal(target, buffer, size)                       \
1330     Unmarshal(TPMS_SIGNATURE_RSAPSS_MARSHAL_REF, (target), (buffer), (size))
1331 #define TPMS_SIGNATURE_RSAPSS_Marshal(source, buffer, size)                         \
1332     Marshal(TPMS_SIGNATURE_RSAPSS_MARSHAL_REF, (source), (buffer), (size))
1333 #define TPMS_SIGNATURE_ECC_Unmarshal(target, buffer, size)                          \
1334     Unmarshal(TPMS_SIGNATURE_ECC_MARSHAL_REF, (target), (buffer), (size))
1335 #define TPMS_SIGNATURE_ECC_Marshal(source, buffer, size)                            \
1336     Marshal(TPMS_SIGNATURE_ECC_MARSHAL_REF, (source), (buffer), (size))
1337 #define TPMS_SIGNATURE_ECDAA_Unmarshal(target, buffer, size)                        \
1338     Unmarshal(TPMS_SIGNATURE_ECDAA_MARSHAL_REF, (target), (buffer), (size))
1339 #define TPMS_SIGNATURE_ECDAA_Marshal(source, buffer, size)                          \
1340     Marshal(TPMS_SIGNATURE_ECDAA_MARSHAL_REF, (source), (buffer), (size))
1341 #define TPMS_SIGNATURE_ECDSA_Unmarshal(target, buffer, size)                        \
1342     Unmarshal(TPMS_SIGNATURE_ECDSA_MARSHAL_REF, (target), (buffer), (size))
1343 #define TPMS_SIGNATURE_ECDSA_Marshal(source, buffer, size)                          \
1344     Marshal(TPMS_SIGNATURE_ECDSA_MARSHAL_REF, (source), (buffer), (size))
1345 #define TPMS_SIGNATURE_SM2_Unmarshal(target, buffer, size)                          \
1346     Unmarshal(TPMS_SIGNATURE_SM2_MARSHAL_REF, (target), (buffer), (size))
1347 #define TPMS_SIGNATURE_SM2_Marshal(source, buffer, size)                            \
1348     Marshal(TPMS_SIGNATURE_SM2_MARSHAL_REF, (source), (buffer), (size))
1349 #define TPMS_SIGNATURE_ECSCHNORR_Unmarshal(target, buffer, size)                    \
1350     Unmarshal(TPMS_SIGNATURE_ECSCHNORR_MARSHAL_REF, (target), (buffer), (size))
1351 #define TPMS_SIGNATURE_ECSCHNORR_Marshal(source, buffer, size)                      \
1352     Marshal(TPMS_SIGNATURE_ECSCHNORR_MARSHAL_REF, (source), (buffer), (size))
1353 #define TPMU_SIGNATURE_Unmarshal(target, buffer, size, selector)                    \
1354     UnmarshalUnion(TPMU_SIGNATURE_MARSHAL_REF, (target), (buffer), (size),          \
1355       (selector))
1356 #define TPMU_SIGNATURE_Marshal(source, buffer, size, selector)                      \
1357     MarshalUnion(TPMU_SIGNATURE_MARSHAL_REF, (source), (buffer), (size), (selector))
1358 #define TPMT_SIGNATURE_Unmarshal(target, buffer, size, flag)                        \
1359     Unmarshal(TPMT_SIGNATURE_MARSHAL_REF|(flag ? NULL_FLAG : 0), (target), (buffer),\
1360       (size))
1361 #define TPMT_SIGNATURE_Marshal(source, buffer, size)                                \
1362     Marshal(TPMT_SIGNATURE_MARSHAL_REF, (source), (buffer), (size))
1363 #define TPMU_ENCRYPTED_SECRET_Unmarshal(target, buffer, size, selector)             \
1364     UnmarshalUnion(TPMU_ENCRYPTED_SECRET_MARSHAL_REF, (target), (buffer), (size),   \
1365       (selector))
1366 #define TPMU_ENCRYPTED_SECRET_Marshal(source, buffer, size, selector)               \
1367     MarshalUnion(TPMU_ENCRYPTED_SECRET_MARSHAL_REF, (source), (buffer), (size),     \
1368       (selector))
1369 #define TPM2B_ENCRYPTED_SECRET_Unmarshal(target, buffer, size)                      \
1370     Unmarshal(TPM2B_ENCRYPTED_SECRET_MARSHAL_REF, (target), (buffer), (size))
1371 #define TPM2B_ENCRYPTED_SECRET_Marshal(source, buffer, size)                        \
1372     Marshal(TPM2B_ENCRYPTED_SECRET_MARSHAL_REF, (source), (buffer), (size))
1373 #define TPMI_ALG_PUBLIC_Unmarshal(target, buffer, size)                             \
1374     Unmarshal(TPMI_ALG_PUBLIC_MARSHAL_REF, (target), (buffer), (size))
1375 #define TPMI_ALG_PUBLIC_Marshal(source, buffer, size)                               \
1376     Marshal(TPMI_ALG_PUBLIC_MARSHAL_REF, (source), (buffer), (size))
1377 #define TPMU_PUBLIC_ID_Unmarshal(target, buffer, size, selector)                    \
1378     UnmarshalUnion(TPMU_PUBLIC_ID_MARSHAL_REF, (target), (buffer), (size),          \
1379       (selector))
1380 #define TPMU_PUBLIC_ID_Marshal(source, buffer, size, selector)                      \
1381     MarshalUnion(TPMU_PUBLIC_ID_MARSHAL_REF, (source), (buffer), (size), (selector))
1382 #define TPMS_KEYEDHASH_PARMS_Unmarshal(target, buffer, size)                        \
1383     Unmarshal(TPMS_KEYEDHASH_PARMS_MARSHAL_REF, (target), (buffer), (size))
1384 #define TPMS_KEYEDHASH_PARMS_Marshal(source, buffer, size)                          \
1385     Marshal(TPMS_KEYEDHASH_PARMS_MARSHAL_REF, (source), (buffer), (size))
1386 #define TPMS_RSA_PARMS_Unmarshal(target, buffer, size)                              \
1387     Unmarshal(TPMS_RSA_PARMS_MARSHAL_REF, (target), (buffer), (size))
1388 #define TPMS_RSA_PARMS_Marshal(source, buffer, size)                                \
1389     Marshal(TPMS_RSA_PARMS_MARSHAL_REF, (source), (buffer), (size))
1390 #define TPMS_ECC_PARMS_Unmarshal(target, buffer, size)                              \
1391     Unmarshal(TPMS_ECC_PARMS_MARSHAL_REF, (target), (buffer), (size))
1392 #define TPMS_ECC_PARMS_Marshal(source, buffer, size)                                \
1393     Marshal(TPMS_ECC_PARMS_MARSHAL_REF, (source), (buffer), (size))
1394 #define TPMU_PUBLIC_PARMS_Unmarshal(target, buffer, size, selector)                 \
1395     UnmarshalUnion(TPMU_PUBLIC_PARMS_MARSHAL_REF, (target), (buffer), (size),       \
1396       (selector))
1397 #define TPMU_PUBLIC_PARMS_Marshal(source, buffer, size, selector)                   \
1398     MarshalUnion(TPMU_PUBLIC_PARMS_MARSHAL_REF, (source), (buffer), (size),         \
1399       (selector))
1400 #define TPMT_PUBLIC_PARMS_Unmarshal(target, buffer, size)                           \
1401     Unmarshal(TPMT_PUBLIC_PARMS_MARSHAL_REF, (target), (buffer), (size))
1402 #define TPMT_PUBLIC_PARMS_Marshal(source, buffer, size)                             \
1403     Marshal(TPMT_PUBLIC_PARMS_MARSHAL_REF, (source), (buffer), (size))
1404 #define TPMT_PUBLIC_Unmarshal(target, buffer, size, flag)                           \
1405     Unmarshal(TPMT_PUBLIC_MARSHAL_REF|(flag ? NULL_FLAG : 0), (target), (buffer),   \
1406       (size))
1407 #define TPMT_PUBLIC_Marshal(source, buffer, size)                                   \
1408     Marshal(TPMT_PUBLIC_MARSHAL_REF, (source), (buffer), (size))
1409 #define TPM2B_PUBLIC_Unmarshal(target, buffer, size, flag)                          \
1410     Unmarshal(TPM2B_PUBLIC_MARSHAL_REF|(flag ? NULL_FLAG : 0), (target), (buffer),  \
1411       (size))
1412 #define TPM2B_PUBLIC_Marshal(source, buffer, size)                                  \
1413     Marshal(TPM2B_PUBLIC_MARSHAL_REF, (source), (buffer), (size))
1414 #define TPM2B_TEMPLATE_Unmarshal(target, buffer, size)                              \
1415     Unmarshal(TPM2B_TEMPLATE_MARSHAL_REF, (target), (buffer), (size))
1416 #define TPM2B_TEMPLATE_Marshal(source, buffer, size)                                \
1417     Marshal(TPM2B_TEMPLATE_MARSHAL_REF, (source), (buffer), (size))
1418 #define TPM2B_PRIVATE_VENDOR_SPECIFIC_Unmarshal(target, buffer, size)               \
1419     Unmarshal(TPM2B_PRIVATE_VENDOR_SPECIFIC_MARSHAL_REF, (target), (buffer), (size))
1420 #define TPM2B_PRIVATE_VENDOR_SPECIFIC_Marshal(source, buffer, size)                 \
1421     Marshal(TPM2B_PRIVATE_VENDOR_SPECIFIC_MARSHAL_REF, (source), (buffer), (size))
1422 #define TPMU_SENSITIVE_COMPOSITE_Unmarshal(target, buffer, size, selector)          \
1423     UnmarshalUnion(TPMU_SENSITIVE_COMPOSITE_MARSHAL_REF, (target), (buffer), (size),\
1424       (selector))
1425 #define TPMU_SENSITIVE_COMPOSITE_Marshal(source, buffer, size, selector)            \
1426     MarshalUnion(TPMU_SENSITIVE_COMPOSITE_MARSHAL_REF, (source), (buffer), (size),  \
1427       (selector))
1428 #define TPMT_SENSITIVE_Unmarshal(target, buffer, size)                              \
1429     Unmarshal(TPMT_SENSITIVE_MARSHAL_REF, (target), (buffer), (size))
1430 #define TPMT_SENSITIVE_Marshal(source, buffer, size)                                \
1431     Marshal(TPMT_SENSITIVE_MARSHAL_REF, (source), (buffer), (size))
1432 #define TPM2B_SENSITIVE_Unmarshal(target, buffer, size)                             \
1433     Unmarshal(TPM2B_SENSITIVE_MARSHAL_REF, (target), (buffer), (size))
1434 #define TPM2B_SENSITIVE_Marshal(source, buffer, size)                               \
1435     Marshal(TPM2B_SENSITIVE_MARSHAL_REF, (source), (buffer), (size))
1436 #define TPM2B_PRIVATE_Unmarshal(target, buffer, size)                               \
1437     Unmarshal(TPM2B_PRIVATE_MARSHAL_REF, (target), (buffer), (size))
1438 #define TPM2B_PRIVATE_Marshal(source, buffer, size)                                 \
1439     Marshal(TPM2B_PRIVATE_MARSHAL_REF, (source), (buffer), (size))
1440 #define TPM2B_ID_OBJECT_Unmarshal(target, buffer, size)                             \
1441     Unmarshal(TPM2B_ID_OBJECT_MARSHAL_REF, (target), (buffer), (size))
1442 #define TPM2B_ID_OBJECT_Marshal(source, buffer, size)                               \
1443     Marshal(TPM2B_ID_OBJECT_MARSHAL_REF, (source), (buffer), (size))
1444 #define TPM_NV_INDEX_Marshal(source, buffer, size)                                  \
1445     Marshal(TPM_NV_INDEX_MARSHAL_REF, (source), (buffer), (size))
1446 #define TPMS_NV_PIN_COUNTER_PARAMETERS_Unmarshal(target, buffer, size)              \
1447     Unmarshal(TPMS_NV_PIN_COUNTER_PARAMETERS_MARSHAL_REF, (target), (buffer),       \
1448       (size))
1449 #define TPMS_NV_PIN_COUNTER_PARAMETERS_Marshal(source, buffer, size)                \
1450     Marshal(TPMS_NV_PIN_COUNTER_PARAMETERS_MARSHAL_REF, (source), (buffer), (size))
1451 #define TPMA_NV_Unmarshal(target, buffer, size)                                     \
1452     Unmarshal(TPMA_NV_MARSHAL_REF, (target), (buffer), (size))
1453 #define TPMA_NV_Marshal(source, buffer, size)                                       \
1454     Marshal(TPMA_NV_MARSHAL_REF, (source), (buffer), (size))
1455 #define TPMS_NV_PUBLIC_Unmarshal(target, buffer, size)                              \
1456     Unmarshal(TPMS_NV_PUBLIC_MARSHAL_REF, (target), (buffer), (size))
1457 #define TPMS_NV_PUBLIC_Marshal(source, buffer, size)                                \
1458     Marshal(TPMS_NV_PUBLIC_MARSHAL_REF, (source), (buffer), (size))
1459 #define TPM2B_NV_PUBLIC_Unmarshal(target, buffer, size)                             \
1460     Unmarshal(TPM2B_NV_PUBLIC_MARSHAL_REF, (target), (buffer), (size))
1461 #define TPM2B_NV_PUBLIC_Marshal(source, buffer, size)                               \
1462     Marshal(TPM2B_NV_PUBLIC_MARSHAL_REF, (source), (buffer), (size))
1463 #define TPM2B_CONTEXT_SENSITIVE_Unmarshal(target, buffer, size)                     \
1464     Unmarshal(TPM2B_CONTEXT_SENSITIVE_MARSHAL_REF, (target), (buffer), (size))
1465 #define TPM2B_CONTEXT_SENSITIVE_Marshal(source, buffer, size)                       \
1466     Marshal(TPM2B_CONTEXT_SENSITIVE_MARSHAL_REF, (source), (buffer), (size))
1467 #define TPMS_CONTEXT_DATA_Unmarshal(target, buffer, size)                           \
1468     Unmarshal(TPMS_CONTEXT_DATA_MARSHAL_REF, (target), (buffer), (size))
1469 #define TPMS_CONTEXT_DATA_Marshal(source, buffer, size)                             \
1470     Marshal(TPMS_CONTEXT_DATA_MARSHAL_REF, (source), (buffer), (size))
1471 #define TPM2B_CONTEXT_DATA_Unmarshal(target, buffer, size)                          \
1472     Unmarshal(TPM2B_CONTEXT_DATA_MARSHAL_REF, (target), (buffer), (size))
1473 #define TPM2B_CONTEXT_DATA_Marshal(source, buffer, size)                            \
1474     Marshal(TPM2B_CONTEXT_DATA_MARSHAL_REF, (source), (buffer), (size))
1475 #define TPMS_CONTEXT_Unmarshal(target, buffer, size)                                \
1476     Unmarshal(TPMS_CONTEXT_MARSHAL_REF, (target), (buffer), (size))
1477 #define TPMS_CONTEXT_Marshal(source, buffer, size)                                  \
1478     Marshal(TPMS_CONTEXT_MARSHAL_REF, (source), (buffer), (size))
1479 #define TPMS_CREATION_DATA_Marshal(source, buffer, size)                            \
1480     Marshal(TPMS_CREATION_DATA_MARSHAL_REF, (source), (buffer), (size))
1481 #define TPM2B_CREATION_DATA_Marshal(source, buffer, size)                           \
1482     Marshal(TPM2B_CREATION_DATA_MARSHAL_REF, (source), (buffer), (size))
1483 #define TPM_AT_Unmarshal(target, buffer, size)                                      \
1484     Unmarshal(TPM_AT_MARSHAL_REF, (target), (buffer), (size))
1485 #define TPM_AT_Marshal(source, buffer, size)                                        \
1486     Marshal(TPM_AT_MARSHAL_REF, (source), (buffer), (size))
1487 #define TPM_AE_Marshal(source, buffer, size)                                        \
1488     Marshal(TPM_AE_MARSHAL_REF, (source), (buffer), (size))
1489 #define TPMS_AC_OUTPUT_Marshal(source, buffer, size)                                \
1490     Marshal(TPMS_AC_OUTPUT_MARSHAL_REF, (source), (buffer), (size))
1491 #define TPML_AC_CAPABILITIES_Marshal(source, buffer, size)                          \
1492     Marshal(TPML_AC_CAPABILITIES_MARSHAL_REF, (source), (buffer), (size))
1493 
1494 #endif // _TABLE_MARSHAL_DEFINES_H_
1495