1 //
2 // Copyright (C) 2015 The Android Open Source Project
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //      http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 // THIS CODE IS GENERATED - DO NOT MODIFY!
18 
19 #ifndef TRUNKS_TPM_GENERATED_H_
20 #define TRUNKS_TPM_GENERATED_H_
21 
22 #include <string>
23 
24 #include <base/callback_forward.h>
25 #include <base/macros.h>
26 
27 #include "trunks/trunks_export.h"
28 
29 namespace trunks {
30 
31 class AuthorizationDelegate;
32 class CommandTransceiver;
33 
34 #if !defined(SHA1_DIGEST_SIZE)
35 #define SHA1_DIGEST_SIZE 20
36 #endif
37 #if !defined(SHA1_BLOCK_SIZE)
38 #define SHA1_BLOCK_SIZE 64
39 #endif
40 #if !defined(SHA1_DER_SIZE)
41 #define SHA1_DER_SIZE 15
42 #endif
43 #if !defined(SHA1_DER)
44 #define SHA1_DER {0x30,0x21,0x30,0x09,0x06,0x05,0x2B,0x0E,0x03,0x02,0x1A,0x05,0x00,0x04,0x14}
45 #endif
46 #if !defined(SHA256_DIGEST_SIZE)
47 #define SHA256_DIGEST_SIZE 32
48 #endif
49 #if !defined(SHA256_BLOCK_SIZE)
50 #define SHA256_BLOCK_SIZE 64
51 #endif
52 #if !defined(SHA256_DER_SIZE)
53 #define SHA256_DER_SIZE 19
54 #endif
55 #if !defined(SHA256_DER)
56 #define SHA256_DER {0x30,0x31,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x01,0x05,0x00,0x04,0x20}
57 #endif
58 #if !defined(SHA384_DIGEST_SIZE)
59 #define SHA384_DIGEST_SIZE 48
60 #endif
61 #if !defined(SHA384_BLOCK_SIZE)
62 #define SHA384_BLOCK_SIZE 128
63 #endif
64 #if !defined(SHA384_DER_SIZE)
65 #define SHA384_DER_SIZE 19
66 #endif
67 #if !defined(SHA384_DER)
68 #define SHA384_DER {0x30,0x41,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x02,0x05,0x00,0x04,0x30}
69 #endif
70 #if !defined(SHA512_DIGEST_SIZE)
71 #define SHA512_DIGEST_SIZE 64
72 #endif
73 #if !defined(SHA512_BLOCK_SIZE)
74 #define SHA512_BLOCK_SIZE 128
75 #endif
76 #if !defined(SHA512_DER_SIZE)
77 #define SHA512_DER_SIZE 19
78 #endif
79 #if !defined(SHA512_DER)
80 #define SHA512_DER {0x30,0x51,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x03,0x05,0x00,0x04,0x40}
81 #endif
82 #if !defined(SM3_256_DIGEST_SIZE)
83 #define SM3_256_DIGEST_SIZE 32
84 #endif
85 #if !defined(SM3_256_BLOCK_SIZE)
86 #define SM3_256_BLOCK_SIZE 64
87 #endif
88 #if !defined(SM3_256_DER_SIZE)
89 #define SM3_256_DER_SIZE 18
90 #endif
91 #if !defined(SM3_256_DER)
92 #define SM3_256_DER {0x30,0x30,0x30,0x0c,0x06,0x08,0x2a,0x81,0x1c,0x81,0x45,0x01,0x83,0x11,0x05,0x00,0x04,0x20}
93 #endif
94 #if !defined(MAX_SESSION_NUMBER)
95 #define MAX_SESSION_NUMBER 3
96 #endif
97 #if !defined(YES)
98 #define YES 1
99 #endif
100 #if !defined(NO)
101 #define NO 0
102 #endif
103 #if !defined(TRUE)
104 #define TRUE 1
105 #endif
106 #if !defined(FALSE)
107 #define FALSE 0
108 #endif
109 #if !defined(SET)
110 #define SET 1
111 #endif
112 #if !defined(CLEAR)
113 #define CLEAR 0
114 #endif
115 #if !defined(BIG_ENDIAN_TPM)
116 #define BIG_ENDIAN_TPM NO
117 #endif
118 #if !defined(LITTLE_ENDIAN_TPM)
119 #define LITTLE_ENDIAN_TPM YES
120 #endif
121 #if !defined(NO_AUTO_ALIGN)
122 #define NO_AUTO_ALIGN NO
123 #endif
124 #if !defined(RSA_KEY_SIZES_BITS)
125 #define RSA_KEY_SIZES_BITS {1024, 2048}
126 #endif
127 #if !defined(MAX_RSA_KEY_BITS)
128 #define MAX_RSA_KEY_BITS 2048
129 #endif
130 #if !defined(MAX_RSA_KEY_BYTES)
131 #define MAX_RSA_KEY_BYTES ((MAX_RSA_KEY_BITS + 7) / 8)
132 #endif
133 #if !defined(ECC_CURVES)
134 #define ECC_CURVES {TPM_ECC_NIST_P256, TPM_ECC_BN_P256, TPM_ECC_SM2_P256}
135 #endif
136 #if !defined(ECC_KEY_SIZES_BITS)
137 #define ECC_KEY_SIZES_BITS {256}
138 #endif
139 #if !defined(MAX_ECC_KEY_BITS)
140 #define MAX_ECC_KEY_BITS 256
141 #endif
142 #if !defined(MAX_ECC_KEY_BYTES)
143 #define MAX_ECC_KEY_BYTES ((MAX_ECC_KEY_BITS + 7) / 8)
144 #endif
145 #if !defined(AES_KEY_SIZES_BITS)
146 #define AES_KEY_SIZES_BITS {128}
147 #endif
148 #if !defined(MAX_AES_KEY_BITS)
149 #define MAX_AES_KEY_BITS 128
150 #endif
151 #if !defined(MAX_AES_BLOCK_SIZE_BYTES)
152 #define MAX_AES_BLOCK_SIZE_BYTES 16
153 #endif
154 #if !defined(MAX_AES_KEY_BYTES)
155 #define MAX_AES_KEY_BYTES ((MAX_AES_KEY_BITS + 7) / 8)
156 #endif
157 #if !defined(SM4_KEY_SIZES_BITS)
158 #define SM4_KEY_SIZES_BITS {128}
159 #endif
160 #if !defined(MAX_SM4_KEY_BITS)
161 #define MAX_SM4_KEY_BITS 128
162 #endif
163 #if !defined(MAX_SM4_BLOCK_SIZE_BYTES)
164 #define MAX_SM4_BLOCK_SIZE_BYTES 16
165 #endif
166 #if !defined(MAX_SM4_KEY_BYTES)
167 #define MAX_SM4_KEY_BYTES ((MAX_SM4_KEY_BITS + 7) / 8)
168 #endif
169 #if !defined(MAX_SYM_KEY_BITS)
170 #define MAX_SYM_KEY_BITS MAX_AES_KEY_BITS
171 #endif
172 #if !defined(MAX_SYM_KEY_BYTES)
173 #define MAX_SYM_KEY_BYTES MAX_AES_KEY_BYTES
174 #endif
175 #if !defined(MAX_SYM_BLOCK_SIZE)
176 #define MAX_SYM_BLOCK_SIZE MAX_AES_BLOCK_SIZE_BYTES
177 #endif
178 #if !defined(FIELD_UPGRADE_IMPLEMENTED)
179 #define FIELD_UPGRADE_IMPLEMENTED NO
180 #endif
181 #if !defined(BSIZE)
182 #define BSIZE UINT16
183 #endif
184 #if !defined(BUFFER_ALIGNMENT)
185 #define BUFFER_ALIGNMENT 4
186 #endif
187 #if !defined(IMPLEMENTATION_PCR)
188 #define IMPLEMENTATION_PCR 24
189 #endif
190 #if !defined(PLATFORM_PCR)
191 #define PLATFORM_PCR 24
192 #endif
193 #if !defined(DRTM_PCR)
194 #define DRTM_PCR 17
195 #endif
196 #if !defined(HCRTM_PCR)
197 #define HCRTM_PCR 0
198 #endif
199 #if !defined(NUM_LOCALITIES)
200 #define NUM_LOCALITIES 5
201 #endif
202 #if !defined(MAX_HANDLE_NUM)
203 #define MAX_HANDLE_NUM 3
204 #endif
205 #if !defined(MAX_ACTIVE_SESSIONS)
206 #define MAX_ACTIVE_SESSIONS 64
207 #endif
208 #if !defined(CONTEXT_SLOT)
209 #define CONTEXT_SLOT UINT16
210 #endif
211 #if !defined(CONTEXT_COUNTER)
212 #define CONTEXT_COUNTER UINT64
213 #endif
214 #if !defined(MAX_LOADED_SESSIONS)
215 #define MAX_LOADED_SESSIONS 3
216 #endif
217 #if !defined(MAX_SESSION_NUM)
218 #define MAX_SESSION_NUM 3
219 #endif
220 #if !defined(MAX_LOADED_OBJECTS)
221 #define MAX_LOADED_OBJECTS 3
222 #endif
223 #if !defined(MIN_EVICT_OBJECTS)
224 #define MIN_EVICT_OBJECTS 2
225 #endif
226 #if !defined(PCR_SELECT_MIN)
227 #define PCR_SELECT_MIN ((PLATFORM_PCR+7)/8)
228 #endif
229 #if !defined(PCR_SELECT_MAX)
230 #define PCR_SELECT_MAX ((IMPLEMENTATION_PCR+7)/8)
231 #endif
232 #if !defined(NUM_POLICY_PCR_GROUP)
233 #define NUM_POLICY_PCR_GROUP 1
234 #endif
235 #if !defined(NUM_AUTHVALUE_PCR_GROUP)
236 #define NUM_AUTHVALUE_PCR_GROUP 1
237 #endif
238 #if !defined(MAX_CONTEXT_SIZE)
239 #define MAX_CONTEXT_SIZE 4000
240 #endif
241 #if !defined(MAX_DIGEST_BUFFER)
242 #define MAX_DIGEST_BUFFER 1024
243 #endif
244 #if !defined(MAX_NV_INDEX_SIZE)
245 #define MAX_NV_INDEX_SIZE 2048
246 #endif
247 #if !defined(MAX_NV_BUFFER_SIZE)
248 #define MAX_NV_BUFFER_SIZE 1024
249 #endif
250 #if !defined(MAX_CAP_BUFFER)
251 #define MAX_CAP_BUFFER 1024
252 #endif
253 #if !defined(NV_MEMORY_SIZE)
254 #define NV_MEMORY_SIZE 16384
255 #endif
256 #if !defined(NUM_STATIC_PCR)
257 #define NUM_STATIC_PCR 16
258 #endif
259 #if !defined(MAX_ALG_LIST_SIZE)
260 #define MAX_ALG_LIST_SIZE 64
261 #endif
262 #if !defined(TIMER_PRESCALE)
263 #define TIMER_PRESCALE 100000
264 #endif
265 #if !defined(PRIMARY_SEED_SIZE)
266 #define PRIMARY_SEED_SIZE 32
267 #endif
268 #if !defined(CONTEXT_ENCRYPT_ALG)
269 #define CONTEXT_ENCRYPT_ALG TPM_ALG_AES
270 #endif
271 #if !defined(CONTEXT_ENCRYPT_KEY_BITS)
272 #define CONTEXT_ENCRYPT_KEY_BITS MAX_SYM_KEY_BITS
273 #endif
274 #if !defined(CONTEXT_ENCRYPT_KEY_BYTES)
275 #define CONTEXT_ENCRYPT_KEY_BYTES ((CONTEXT_ENCRYPT_KEY_BITS+7)/8)
276 #endif
277 #if !defined(CONTEXT_INTEGRITY_HASH_ALG)
278 #define CONTEXT_INTEGRITY_HASH_ALG TPM_ALG_SHA256
279 #endif
280 #if !defined(CONTEXT_INTEGRITY_HASH_SIZE)
281 #define CONTEXT_INTEGRITY_HASH_SIZE SHA256_DIGEST_SIZE
282 #endif
283 #if !defined(PROOF_SIZE)
284 #define PROOF_SIZE CONTEXT_INTEGRITY_HASH_SIZE
285 #endif
286 #if !defined(NV_CLOCK_UPDATE_INTERVAL)
287 #define NV_CLOCK_UPDATE_INTERVAL 12
288 #endif
289 #if !defined(NUM_POLICY_PCR)
290 #define NUM_POLICY_PCR 1
291 #endif
292 #if !defined(MAX_COMMAND_SIZE)
293 #define MAX_COMMAND_SIZE 4096
294 #endif
295 #if !defined(MAX_RESPONSE_SIZE)
296 #define MAX_RESPONSE_SIZE 4096
297 #endif
298 #if !defined(ORDERLY_BITS)
299 #define ORDERLY_BITS 8
300 #endif
301 #if !defined(MAX_ORDERLY_COUNT)
302 #define MAX_ORDERLY_COUNT ((1 << ORDERLY_BITS) - 1)
303 #endif
304 #if !defined(ALG_ID_FIRST)
305 #define ALG_ID_FIRST TPM_ALG_FIRST
306 #endif
307 #if !defined(ALG_ID_LAST)
308 #define ALG_ID_LAST TPM_ALG_LAST
309 #endif
310 #if !defined(MAX_SYM_DATA)
311 #define MAX_SYM_DATA 128
312 #endif
313 #if !defined(MAX_RNG_ENTROPY_SIZE)
314 #define MAX_RNG_ENTROPY_SIZE 64
315 #endif
316 #if !defined(RAM_INDEX_SPACE)
317 #define RAM_INDEX_SPACE 512
318 #endif
319 #if !defined(RSA_DEFAULT_PUBLIC_EXPONENT)
320 #define RSA_DEFAULT_PUBLIC_EXPONENT 0x00010001
321 #endif
322 #if !defined(ENABLE_PCR_NO_INCREMENT)
323 #define ENABLE_PCR_NO_INCREMENT YES
324 #endif
325 #if !defined(CRT_FORMAT_RSA)
326 #define CRT_FORMAT_RSA YES
327 #endif
328 #if !defined(PRIVATE_VENDOR_SPECIFIC_BYTES)
329 #define PRIVATE_VENDOR_SPECIFIC_BYTES ((MAX_RSA_KEY_BYTES/2) * (3 + CRT_FORMAT_RSA * 2))
330 #endif
331 #if !defined(MAX_CAP_DATA)
332 #define MAX_CAP_DATA (MAX_CAP_BUFFER-sizeof(TPM_CAP)-sizeof(UINT32))
333 #endif
334 #if !defined(MAX_CAP_ALGS)
335 #define MAX_CAP_ALGS (TPM_ALG_LAST - TPM_ALG_FIRST + 1)
336 #endif
337 #if !defined(MAX_CAP_HANDLES)
338 #define MAX_CAP_HANDLES (MAX_CAP_DATA/sizeof(TPM_HANDLE))
339 #endif
340 #if !defined(MAX_CAP_CC)
341 #define MAX_CAP_CC ((TPM_CC_LAST - TPM_CC_FIRST) + 1)
342 #endif
343 #if !defined(MAX_TPM_PROPERTIES)
344 #define MAX_TPM_PROPERTIES (MAX_CAP_DATA/sizeof(TPMS_TAGGED_PROPERTY))
345 #endif
346 #if !defined(MAX_PCR_PROPERTIES)
347 #define MAX_PCR_PROPERTIES (MAX_CAP_DATA/sizeof(TPMS_TAGGED_PCR_SELECT))
348 #endif
349 #if !defined(MAX_ECC_CURVES)
350 #define MAX_ECC_CURVES (MAX_CAP_DATA/sizeof(TPM_ECC_CURVE))
351 #endif
352 #if !defined(HASH_COUNT)
353 #define HASH_COUNT 3
354 #endif
355 
356 typedef uint8_t UINT8;
357 typedef uint8_t BYTE;
358 typedef int8_t INT8;
359 typedef int BOOL;
360 typedef uint16_t UINT16;
361 typedef int16_t INT16;
362 typedef uint32_t UINT32;
363 typedef int32_t INT32;
364 typedef uint64_t UINT64;
365 typedef int64_t INT64;
366 typedef UINT32 TPM_ALGORITHM_ID;
367 typedef UINT32 TPM_MODIFIER_INDICATOR;
368 typedef UINT32 TPM_AUTHORIZATION_SIZE;
369 typedef UINT32 TPM_PARAMETER_SIZE;
370 typedef UINT16 TPM_KEY_SIZE;
371 typedef UINT16 TPM_KEY_BITS;
372 typedef UINT32 TPM_HANDLE;
373 struct TPM2B_DIGEST;
374 typedef TPM2B_DIGEST TPM2B_NONCE;
375 typedef TPM2B_DIGEST TPM2B_AUTH;
376 typedef TPM2B_DIGEST TPM2B_OPERAND;
377 struct TPMS_SCHEME_SIGHASH;
378 typedef TPMS_SCHEME_SIGHASH TPMS_SCHEME_HMAC;
379 typedef TPMS_SCHEME_SIGHASH TPMS_SCHEME_RSASSA;
380 typedef TPMS_SCHEME_SIGHASH TPMS_SCHEME_RSAPSS;
381 typedef TPMS_SCHEME_SIGHASH TPMS_SCHEME_ECDSA;
382 typedef TPMS_SCHEME_SIGHASH TPMS_SCHEME_SM2;
383 typedef TPMS_SCHEME_SIGHASH TPMS_SCHEME_ECSCHNORR;
384 typedef BYTE TPMI_YES_NO;
385 typedef TPM_HANDLE TPMI_DH_OBJECT;
386 typedef TPM_HANDLE TPMI_DH_PERSISTENT;
387 typedef TPM_HANDLE TPMI_DH_ENTITY;
388 typedef TPM_HANDLE TPMI_DH_PCR;
389 typedef TPM_HANDLE TPMI_SH_AUTH_SESSION;
390 typedef TPM_HANDLE TPMI_SH_HMAC;
391 typedef TPM_HANDLE TPMI_SH_POLICY;
392 typedef TPM_HANDLE TPMI_DH_CONTEXT;
393 typedef TPM_HANDLE TPMI_RH_HIERARCHY;
394 typedef TPM_HANDLE TPMI_RH_ENABLES;
395 typedef TPM_HANDLE TPMI_RH_HIERARCHY_AUTH;
396 typedef TPM_HANDLE TPMI_RH_PLATFORM;
397 typedef TPM_HANDLE TPMI_RH_OWNER;
398 typedef TPM_HANDLE TPMI_RH_ENDORSEMENT;
399 typedef TPM_HANDLE TPMI_RH_PROVISION;
400 typedef TPM_HANDLE TPMI_RH_CLEAR;
401 typedef TPM_HANDLE TPMI_RH_NV_AUTH;
402 typedef TPM_HANDLE TPMI_RH_LOCKOUT;
403 typedef TPM_HANDLE TPMI_RH_NV_INDEX;
404 typedef UINT16 TPM_ALG_ID;
405 typedef TPM_ALG_ID TPMI_ALG_HASH;
406 typedef TPM_ALG_ID TPMI_ALG_ASYM;
407 typedef TPM_ALG_ID TPMI_ALG_SYM;
408 typedef TPM_ALG_ID TPMI_ALG_SYM_OBJECT;
409 typedef TPM_ALG_ID TPMI_ALG_SYM_MODE;
410 typedef TPM_ALG_ID TPMI_ALG_KDF;
411 typedef TPM_ALG_ID TPMI_ALG_SIG_SCHEME;
412 typedef TPM_ALG_ID TPMI_ECC_KEY_EXCHANGE;
413 typedef UINT16 TPM_ST;
414 typedef TPM_ST TPMI_ST_COMMAND_TAG;
415 typedef TPM_ST TPMI_ST_ATTEST;
416 typedef TPM_KEY_BITS TPMI_AES_KEY_BITS;
417 typedef TPM_KEY_BITS TPMI_SM4_KEY_BITS;
418 typedef TPM_ALG_ID TPMI_ALG_KEYEDHASH_SCHEME;
419 typedef TPM_ALG_ID TPMI_ALG_ASYM_SCHEME;
420 typedef TPM_ALG_ID TPMI_ALG_RSA_SCHEME;
421 typedef TPM_ALG_ID TPMI_ALG_RSA_DECRYPT;
422 typedef TPM_KEY_BITS TPMI_RSA_KEY_BITS;
423 typedef TPM_ALG_ID TPMI_ALG_ECC_SCHEME;
424 typedef UINT16 TPM_ECC_CURVE;
425 typedef TPM_ECC_CURVE TPMI_ECC_CURVE;
426 typedef TPM_ALG_ID TPMI_ALG_PUBLIC;
427 typedef UINT32 TPMA_ALGORITHM;
428 typedef UINT32 TPMA_OBJECT;
429 typedef UINT8 TPMA_SESSION;
430 typedef UINT8 TPMA_LOCALITY;
431 typedef UINT32 TPMA_PERMANENT;
432 typedef UINT32 TPMA_STARTUP_CLEAR;
433 typedef UINT32 TPMA_MEMORY;
434 typedef UINT32 TPM_CC;
435 typedef TPM_CC TPMA_CC;
436 typedef UINT32 TPM_NV_INDEX;
437 typedef UINT32 TPMA_NV;
438 typedef UINT32 TPM_SPEC;
439 typedef UINT32 TPM_GENERATED;
440 typedef UINT32 TPM_RC;
441 typedef INT8 TPM_CLOCK_ADJUST;
442 typedef UINT16 TPM_EO;
443 typedef UINT16 TPM_SU;
444 typedef UINT8 TPM_SE;
445 typedef UINT32 TPM_CAP;
446 typedef UINT32 TPM_PT;
447 typedef UINT32 TPM_PT_PCR;
448 typedef UINT32 TPM_PS;
449 typedef UINT8 TPM_HT;
450 typedef UINT32 TPM_RH;
451 typedef TPM_HANDLE TPM_HC;
452 
453 const TPM_SPEC TPM_SPEC_FAMILY = 0x322E3000;
454 const TPM_SPEC TPM_SPEC_LEVEL = 00;
455 const TPM_SPEC TPM_SPEC_VERSION = 99;
456 const TPM_SPEC TPM_SPEC_YEAR = 2013;
457 const TPM_SPEC TPM_SPEC_DAY_OF_YEAR = 304;
458 const TPM_GENERATED TPM_GENERATED_VALUE = 0xff544347;
459 const TPM_ALG_ID TPM_ALG_ERROR = 0x0000;
460 const TPM_ALG_ID TPM_ALG_FIRST = 0x0001;
461 const TPM_ALG_ID TPM_ALG_RSA = 0x0001;
462 const TPM_ALG_ID TPM_ALG_SHA = 0x0004;
463 const TPM_ALG_ID TPM_ALG_SHA1 = 0x0004;
464 const TPM_ALG_ID TPM_ALG_HMAC = 0x0005;
465 const TPM_ALG_ID TPM_ALG_AES = 0x0006;
466 const TPM_ALG_ID TPM_ALG_MGF1 = 0x0007;
467 const TPM_ALG_ID TPM_ALG_KEYEDHASH = 0x0008;
468 const TPM_ALG_ID TPM_ALG_XOR = 0x000A;
469 const TPM_ALG_ID TPM_ALG_SHA256 = 0x000B;
470 const TPM_ALG_ID TPM_ALG_SHA384 = 0x000C;
471 const TPM_ALG_ID TPM_ALG_SHA512 = 0x000D;
472 const TPM_ALG_ID TPM_ALG_NULL = 0x0010;
473 const TPM_ALG_ID TPM_ALG_SM3_256 = 0x0012;
474 const TPM_ALG_ID TPM_ALG_SM4 = 0x0013;
475 const TPM_ALG_ID TPM_ALG_RSASSA = 0x0014;
476 const TPM_ALG_ID TPM_ALG_RSAES = 0x0015;
477 const TPM_ALG_ID TPM_ALG_RSAPSS = 0x0016;
478 const TPM_ALG_ID TPM_ALG_OAEP = 0x0017;
479 const TPM_ALG_ID TPM_ALG_ECDSA = 0x0018;
480 const TPM_ALG_ID TPM_ALG_ECDH = 0x0019;
481 const TPM_ALG_ID TPM_ALG_ECDAA = 0x001A;
482 const TPM_ALG_ID TPM_ALG_SM2 = 0x001B;
483 const TPM_ALG_ID TPM_ALG_ECSCHNORR = 0x001C;
484 const TPM_ALG_ID TPM_ALG_ECMQV = 0x001D;
485 const TPM_ALG_ID TPM_ALG_KDF1_SP800_56a = 0x0020;
486 const TPM_ALG_ID TPM_ALG_KDF2 = 0x0021;
487 const TPM_ALG_ID TPM_ALG_KDF1_SP800_108 = 0x0022;
488 const TPM_ALG_ID TPM_ALG_ECC = 0x0023;
489 const TPM_ALG_ID TPM_ALG_SYMCIPHER = 0x0025;
490 const TPM_ALG_ID TPM_ALG_CTR = 0x0040;
491 const TPM_ALG_ID TPM_ALG_OFB = 0x0041;
492 const TPM_ALG_ID TPM_ALG_CBC = 0x0042;
493 const TPM_ALG_ID TPM_ALG_CFB = 0x0043;
494 const TPM_ALG_ID TPM_ALG_ECB = 0x0044;
495 const TPM_ALG_ID TPM_ALG_LAST = 0x0044;
496 const TPM_ECC_CURVE TPM_ECC_NONE = 0x0000;
497 const TPM_ECC_CURVE TPM_ECC_NIST_P192 = 0x0001;
498 const TPM_ECC_CURVE TPM_ECC_NIST_P224 = 0x0002;
499 const TPM_ECC_CURVE TPM_ECC_NIST_P256 = 0x0003;
500 const TPM_ECC_CURVE TPM_ECC_NIST_P384 = 0x0004;
501 const TPM_ECC_CURVE TPM_ECC_NIST_P521 = 0x0005;
502 const TPM_ECC_CURVE TPM_ECC_BN_P256 = 0x0010;
503 const TPM_ECC_CURVE TPM_ECC_BN_P638 = 0x0011;
504 const TPM_ECC_CURVE TPM_ECC_SM2_P256 = 0x0020;
505 const TPM_CC TPM_CC_FIRST = 0x0000011F;
506 const TPM_CC TPM_CC_PP_FIRST = 0x0000011F;
507 const TPM_CC TPM_CC_NV_UndefineSpaceSpecial = 0x0000011F;
508 const TPM_CC TPM_CC_EvictControl = 0x00000120;
509 const TPM_CC TPM_CC_HierarchyControl = 0x00000121;
510 const TPM_CC TPM_CC_NV_UndefineSpace = 0x00000122;
511 const TPM_CC TPM_CC_ChangeEPS = 0x00000124;
512 const TPM_CC TPM_CC_ChangePPS = 0x00000125;
513 const TPM_CC TPM_CC_Clear = 0x00000126;
514 const TPM_CC TPM_CC_ClearControl = 0x00000127;
515 const TPM_CC TPM_CC_ClockSet = 0x00000128;
516 const TPM_CC TPM_CC_HierarchyChangeAuth = 0x00000129;
517 const TPM_CC TPM_CC_NV_DefineSpace = 0x0000012A;
518 const TPM_CC TPM_CC_PCR_Allocate = 0x0000012B;
519 const TPM_CC TPM_CC_PCR_SetAuthPolicy = 0x0000012C;
520 const TPM_CC TPM_CC_PP_Commands = 0x0000012D;
521 const TPM_CC TPM_CC_SetPrimaryPolicy = 0x0000012E;
522 const TPM_CC TPM_CC_FieldUpgradeStart = 0x0000012F;
523 const TPM_CC TPM_CC_ClockRateAdjust = 0x00000130;
524 const TPM_CC TPM_CC_CreatePrimary = 0x00000131;
525 const TPM_CC TPM_CC_NV_GlobalWriteLock = 0x00000132;
526 const TPM_CC TPM_CC_PP_LAST = 0x00000132;
527 const TPM_CC TPM_CC_GetCommandAuditDigest = 0x00000133;
528 const TPM_CC TPM_CC_NV_Increment = 0x00000134;
529 const TPM_CC TPM_CC_NV_SetBits = 0x00000135;
530 const TPM_CC TPM_CC_NV_Extend = 0x00000136;
531 const TPM_CC TPM_CC_NV_Write = 0x00000137;
532 const TPM_CC TPM_CC_NV_WriteLock = 0x00000138;
533 const TPM_CC TPM_CC_DictionaryAttackLockReset = 0x00000139;
534 const TPM_CC TPM_CC_DictionaryAttackParameters = 0x0000013A;
535 const TPM_CC TPM_CC_NV_ChangeAuth = 0x0000013B;
536 const TPM_CC TPM_CC_PCR_Event = 0x0000013C;
537 const TPM_CC TPM_CC_PCR_Reset = 0x0000013D;
538 const TPM_CC TPM_CC_SequenceComplete = 0x0000013E;
539 const TPM_CC TPM_CC_SetAlgorithmSet = 0x0000013F;
540 const TPM_CC TPM_CC_SetCommandCodeAuditStatus = 0x00000140;
541 const TPM_CC TPM_CC_FieldUpgradeData = 0x00000141;
542 const TPM_CC TPM_CC_IncrementalSelfTest = 0x00000142;
543 const TPM_CC TPM_CC_SelfTest = 0x00000143;
544 const TPM_CC TPM_CC_Startup = 0x00000144;
545 const TPM_CC TPM_CC_Shutdown = 0x00000145;
546 const TPM_CC TPM_CC_StirRandom = 0x00000146;
547 const TPM_CC TPM_CC_ActivateCredential = 0x00000147;
548 const TPM_CC TPM_CC_Certify = 0x00000148;
549 const TPM_CC TPM_CC_PolicyNV = 0x00000149;
550 const TPM_CC TPM_CC_CertifyCreation = 0x0000014A;
551 const TPM_CC TPM_CC_Duplicate = 0x0000014B;
552 const TPM_CC TPM_CC_GetTime = 0x0000014C;
553 const TPM_CC TPM_CC_GetSessionAuditDigest = 0x0000014D;
554 const TPM_CC TPM_CC_NV_Read = 0x0000014E;
555 const TPM_CC TPM_CC_NV_ReadLock = 0x0000014F;
556 const TPM_CC TPM_CC_ObjectChangeAuth = 0x00000150;
557 const TPM_CC TPM_CC_PolicySecret = 0x00000151;
558 const TPM_CC TPM_CC_Rewrap = 0x00000152;
559 const TPM_CC TPM_CC_Create = 0x00000153;
560 const TPM_CC TPM_CC_ECDH_ZGen = 0x00000154;
561 const TPM_CC TPM_CC_HMAC = 0x00000155;
562 const TPM_CC TPM_CC_Import = 0x00000156;
563 const TPM_CC TPM_CC_Load = 0x00000157;
564 const TPM_CC TPM_CC_Quote = 0x00000158;
565 const TPM_CC TPM_CC_RSA_Decrypt = 0x00000159;
566 const TPM_CC TPM_CC_HMAC_Start = 0x0000015B;
567 const TPM_CC TPM_CC_SequenceUpdate = 0x0000015C;
568 const TPM_CC TPM_CC_Sign = 0x0000015D;
569 const TPM_CC TPM_CC_Unseal = 0x0000015E;
570 const TPM_CC TPM_CC_PolicySigned = 0x00000160;
571 const TPM_CC TPM_CC_ContextLoad = 0x00000161;
572 const TPM_CC TPM_CC_ContextSave = 0x00000162;
573 const TPM_CC TPM_CC_ECDH_KeyGen = 0x00000163;
574 const TPM_CC TPM_CC_EncryptDecrypt = 0x00000164;
575 const TPM_CC TPM_CC_FlushContext = 0x00000165;
576 const TPM_CC TPM_CC_LoadExternal = 0x00000167;
577 const TPM_CC TPM_CC_MakeCredential = 0x00000168;
578 const TPM_CC TPM_CC_NV_ReadPublic = 0x00000169;
579 const TPM_CC TPM_CC_PolicyAuthorize = 0x0000016A;
580 const TPM_CC TPM_CC_PolicyAuthValue = 0x0000016B;
581 const TPM_CC TPM_CC_PolicyCommandCode = 0x0000016C;
582 const TPM_CC TPM_CC_PolicyCounterTimer = 0x0000016D;
583 const TPM_CC TPM_CC_PolicyCpHash = 0x0000016E;
584 const TPM_CC TPM_CC_PolicyLocality = 0x0000016F;
585 const TPM_CC TPM_CC_PolicyNameHash = 0x00000170;
586 const TPM_CC TPM_CC_PolicyOR = 0x00000171;
587 const TPM_CC TPM_CC_PolicyTicket = 0x00000172;
588 const TPM_CC TPM_CC_ReadPublic = 0x00000173;
589 const TPM_CC TPM_CC_RSA_Encrypt = 0x00000174;
590 const TPM_CC TPM_CC_StartAuthSession = 0x00000176;
591 const TPM_CC TPM_CC_VerifySignature = 0x00000177;
592 const TPM_CC TPM_CC_ECC_Parameters = 0x00000178;
593 const TPM_CC TPM_CC_FirmwareRead = 0x00000179;
594 const TPM_CC TPM_CC_GetCapability = 0x0000017A;
595 const TPM_CC TPM_CC_GetRandom = 0x0000017B;
596 const TPM_CC TPM_CC_GetTestResult = 0x0000017C;
597 const TPM_CC TPM_CC_Hash = 0x0000017D;
598 const TPM_CC TPM_CC_PCR_Read = 0x0000017E;
599 const TPM_CC TPM_CC_PolicyPCR = 0x0000017F;
600 const TPM_CC TPM_CC_PolicyRestart = 0x00000180;
601 const TPM_CC TPM_CC_ReadClock = 0x00000181;
602 const TPM_CC TPM_CC_PCR_Extend = 0x00000182;
603 const TPM_CC TPM_CC_PCR_SetAuthValue = 0x00000183;
604 const TPM_CC TPM_CC_NV_Certify = 0x00000184;
605 const TPM_CC TPM_CC_EventSequenceComplete = 0x00000185;
606 const TPM_CC TPM_CC_HashSequenceStart = 0x00000186;
607 const TPM_CC TPM_CC_PolicyPhysicalPresence = 0x00000187;
608 const TPM_CC TPM_CC_PolicyDuplicationSelect = 0x00000188;
609 const TPM_CC TPM_CC_PolicyGetDigest = 0x00000189;
610 const TPM_CC TPM_CC_TestParms = 0x0000018A;
611 const TPM_CC TPM_CC_Commit = 0x0000018B;
612 const TPM_CC TPM_CC_PolicyPassword = 0x0000018C;
613 const TPM_CC TPM_CC_ZGen_2Phase = 0x0000018D;
614 const TPM_CC TPM_CC_EC_Ephemeral = 0x0000018E;
615 const TPM_CC TPM_CC_PolicyNvWritten = 0x0000018F;
616 const TPM_CC TPM_CC_LAST = 0x0000018F;
617 const TPM_RC TPM_RC_SUCCESS = 0x000;
618 const TPM_RC TPM_RC_BAD_TAG = 0x01E;
619 const TPM_RC RC_VER1 = 0x100;
620 const TPM_RC TPM_RC_INITIALIZE = RC_VER1 + 0x000;
621 const TPM_RC TPM_RC_FAILURE = RC_VER1 + 0x001;
622 const TPM_RC TPM_RC_SEQUENCE = RC_VER1 + 0x003;
623 const TPM_RC TPM_RC_PRIVATE = RC_VER1 + 0x00B;
624 const TPM_RC TPM_RC_HMAC = RC_VER1 + 0x019;
625 const TPM_RC TPM_RC_DISABLED = RC_VER1 + 0x020;
626 const TPM_RC TPM_RC_EXCLUSIVE = RC_VER1 + 0x021;
627 const TPM_RC TPM_RC_AUTH_TYPE = RC_VER1 + 0x024;
628 const TPM_RC TPM_RC_AUTH_MISSING = RC_VER1 + 0x025;
629 const TPM_RC TPM_RC_POLICY = RC_VER1 + 0x026;
630 const TPM_RC TPM_RC_PCR = RC_VER1 + 0x027;
631 const TPM_RC TPM_RC_PCR_CHANGED = RC_VER1 + 0x028;
632 const TPM_RC TPM_RC_UPGRADE = RC_VER1 + 0x02D;
633 const TPM_RC TPM_RC_TOO_MANY_CONTEXTS = RC_VER1 + 0x02E;
634 const TPM_RC TPM_RC_AUTH_UNAVAILABLE = RC_VER1 + 0x02F;
635 const TPM_RC TPM_RC_REBOOT = RC_VER1 + 0x030;
636 const TPM_RC TPM_RC_UNBALANCED = RC_VER1 + 0x031;
637 const TPM_RC TPM_RC_COMMAND_SIZE = RC_VER1 + 0x042;
638 const TPM_RC TPM_RC_COMMAND_CODE = RC_VER1 + 0x043;
639 const TPM_RC TPM_RC_AUTHSIZE = RC_VER1 + 0x044;
640 const TPM_RC TPM_RC_AUTH_CONTEXT = RC_VER1 + 0x045;
641 const TPM_RC TPM_RC_NV_RANGE = RC_VER1 + 0x046;
642 const TPM_RC TPM_RC_NV_SIZE = RC_VER1 + 0x047;
643 const TPM_RC TPM_RC_NV_LOCKED = RC_VER1 + 0x048;
644 const TPM_RC TPM_RC_NV_AUTHORIZATION = RC_VER1 + 0x049;
645 const TPM_RC TPM_RC_NV_UNINITIALIZED = RC_VER1 + 0x04A;
646 const TPM_RC TPM_RC_NV_SPACE = RC_VER1 + 0x04B;
647 const TPM_RC TPM_RC_NV_DEFINED = RC_VER1 + 0x04C;
648 const TPM_RC TPM_RC_BAD_CONTEXT = RC_VER1 + 0x050;
649 const TPM_RC TPM_RC_CPHASH = RC_VER1 + 0x051;
650 const TPM_RC TPM_RC_PARENT = RC_VER1 + 0x052;
651 const TPM_RC TPM_RC_NEEDS_TEST = RC_VER1 + 0x053;
652 const TPM_RC TPM_RC_NO_RESULT = RC_VER1 + 0x054;
653 const TPM_RC TPM_RC_SENSITIVE = RC_VER1 + 0x055;
654 const TPM_RC RC_MAX_FM0 = RC_VER1 + 0x07F;
655 const TPM_RC RC_FMT1 = 0x080;
656 const TPM_RC TPM_RC_ASYMMETRIC = RC_FMT1 + 0x001;
657 const TPM_RC TPM_RC_ATTRIBUTES = RC_FMT1 + 0x002;
658 const TPM_RC TPM_RC_HASH = RC_FMT1 + 0x003;
659 const TPM_RC TPM_RC_VALUE = RC_FMT1 + 0x004;
660 const TPM_RC TPM_RC_HIERARCHY = RC_FMT1 + 0x005;
661 const TPM_RC TPM_RC_KEY_SIZE = RC_FMT1 + 0x007;
662 const TPM_RC TPM_RC_MGF = RC_FMT1 + 0x008;
663 const TPM_RC TPM_RC_MODE = RC_FMT1 + 0x009;
664 const TPM_RC TPM_RC_TYPE = RC_FMT1 + 0x00A;
665 const TPM_RC TPM_RC_HANDLE = RC_FMT1 + 0x00B;
666 const TPM_RC TPM_RC_KDF = RC_FMT1 + 0x00C;
667 const TPM_RC TPM_RC_RANGE = RC_FMT1 + 0x00D;
668 const TPM_RC TPM_RC_AUTH_FAIL = RC_FMT1 + 0x00E;
669 const TPM_RC TPM_RC_NONCE = RC_FMT1 + 0x00F;
670 const TPM_RC TPM_RC_PP = RC_FMT1 + 0x010;
671 const TPM_RC TPM_RC_SCHEME = RC_FMT1 + 0x012;
672 const TPM_RC TPM_RC_SIZE = RC_FMT1 + 0x015;
673 const TPM_RC TPM_RC_SYMMETRIC = RC_FMT1 + 0x016;
674 const TPM_RC TPM_RC_TAG = RC_FMT1 + 0x017;
675 const TPM_RC TPM_RC_SELECTOR = RC_FMT1 + 0x018;
676 const TPM_RC TPM_RC_INSUFFICIENT = RC_FMT1 + 0x01A;
677 const TPM_RC TPM_RC_SIGNATURE = RC_FMT1 + 0x01B;
678 const TPM_RC TPM_RC_KEY = RC_FMT1 + 0x01C;
679 const TPM_RC TPM_RC_POLICY_FAIL = RC_FMT1 + 0x01D;
680 const TPM_RC TPM_RC_INTEGRITY = RC_FMT1 + 0x01F;
681 const TPM_RC TPM_RC_TICKET = RC_FMT1 + 0x020;
682 const TPM_RC TPM_RC_RESERVED_BITS = RC_FMT1 + 0x021;
683 const TPM_RC TPM_RC_BAD_AUTH = RC_FMT1 + 0x022;
684 const TPM_RC TPM_RC_EXPIRED = RC_FMT1 + 0x023;
685 const TPM_RC TPM_RC_POLICY_CC = RC_FMT1 + 0x024;
686 const TPM_RC TPM_RC_BINDING = RC_FMT1 + 0x025;
687 const TPM_RC TPM_RC_CURVE = RC_FMT1 + 0x026;
688 const TPM_RC TPM_RC_ECC_POINT = RC_FMT1 + 0x027;
689 const TPM_RC RC_WARN = 0x900;
690 const TPM_RC TPM_RC_CONTEXT_GAP = RC_WARN + 0x001;
691 const TPM_RC TPM_RC_OBJECT_MEMORY = RC_WARN + 0x002;
692 const TPM_RC TPM_RC_SESSION_MEMORY = RC_WARN + 0x003;
693 const TPM_RC TPM_RC_MEMORY = RC_WARN + 0x004;
694 const TPM_RC TPM_RC_SESSION_HANDLES = RC_WARN + 0x005;
695 const TPM_RC TPM_RC_OBJECT_HANDLES = RC_WARN + 0x006;
696 const TPM_RC TPM_RC_LOCALITY = RC_WARN + 0x007;
697 const TPM_RC TPM_RC_YIELDED = RC_WARN + 0x008;
698 const TPM_RC TPM_RC_CANCELED = RC_WARN + 0x009;
699 const TPM_RC TPM_RC_TESTING = RC_WARN + 0x00A;
700 const TPM_RC TPM_RC_REFERENCE_H0 = RC_WARN + 0x010;
701 const TPM_RC TPM_RC_REFERENCE_H1 = RC_WARN + 0x011;
702 const TPM_RC TPM_RC_REFERENCE_H2 = RC_WARN + 0x012;
703 const TPM_RC TPM_RC_REFERENCE_H3 = RC_WARN + 0x013;
704 const TPM_RC TPM_RC_REFERENCE_H4 = RC_WARN + 0x014;
705 const TPM_RC TPM_RC_REFERENCE_H5 = RC_WARN + 0x015;
706 const TPM_RC TPM_RC_REFERENCE_H6 = RC_WARN + 0x016;
707 const TPM_RC TPM_RC_REFERENCE_S0 = RC_WARN + 0x018;
708 const TPM_RC TPM_RC_REFERENCE_S1 = RC_WARN + 0x019;
709 const TPM_RC TPM_RC_REFERENCE_S2 = RC_WARN + 0x01A;
710 const TPM_RC TPM_RC_REFERENCE_S3 = RC_WARN + 0x01B;
711 const TPM_RC TPM_RC_REFERENCE_S4 = RC_WARN + 0x01C;
712 const TPM_RC TPM_RC_REFERENCE_S5 = RC_WARN + 0x01D;
713 const TPM_RC TPM_RC_REFERENCE_S6 = RC_WARN + 0x01E;
714 const TPM_RC TPM_RC_NV_RATE = RC_WARN + 0x020;
715 const TPM_RC TPM_RC_LOCKOUT = RC_WARN + 0x021;
716 const TPM_RC TPM_RC_RETRY = RC_WARN + 0x022;
717 const TPM_RC TPM_RC_NV_UNAVAILABLE = RC_WARN + 0x023;
718 const TPM_RC TPM_RC_NOT_USED = RC_WARN + 0x7F;
719 const TPM_RC TPM_RC_H = 0x000;
720 const TPM_RC TPM_RC_P = 0x040;
721 const TPM_RC TPM_RC_S = 0x800;
722 const TPM_RC TPM_RC_1 = 0x100;
723 const TPM_RC TPM_RC_2 = 0x200;
724 const TPM_RC TPM_RC_3 = 0x300;
725 const TPM_RC TPM_RC_4 = 0x400;
726 const TPM_RC TPM_RC_5 = 0x500;
727 const TPM_RC TPM_RC_6 = 0x600;
728 const TPM_RC TPM_RC_7 = 0x700;
729 const TPM_RC TPM_RC_8 = 0x800;
730 const TPM_RC TPM_RC_9 = 0x900;
731 const TPM_RC TPM_RC_A = 0xA00;
732 const TPM_RC TPM_RC_B = 0xB00;
733 const TPM_RC TPM_RC_C = 0xC00;
734 const TPM_RC TPM_RC_D = 0xD00;
735 const TPM_RC TPM_RC_E = 0xE00;
736 const TPM_RC TPM_RC_F = 0xF00;
737 const TPM_RC TPM_RC_N_MASK = 0xF00;
738 const TPM_CLOCK_ADJUST TPM_CLOCK_COARSE_SLOWER = -3;
739 const TPM_CLOCK_ADJUST TPM_CLOCK_MEDIUM_SLOWER = -2;
740 const TPM_CLOCK_ADJUST TPM_CLOCK_FINE_SLOWER = -1;
741 const TPM_CLOCK_ADJUST TPM_CLOCK_NO_CHANGE = 0;
742 const TPM_CLOCK_ADJUST TPM_CLOCK_FINE_FASTER = 1;
743 const TPM_CLOCK_ADJUST TPM_CLOCK_MEDIUM_FASTER = 2;
744 const TPM_CLOCK_ADJUST TPM_CLOCK_COARSE_FASTER = 3;
745 const TPM_EO TPM_EO_EQ = 0x0000;
746 const TPM_EO TPM_EO_NEQ = 0x0001;
747 const TPM_EO TPM_EO_SIGNED_GT = 0x0002;
748 const TPM_EO TPM_EO_UNSIGNED_GT = 0x0003;
749 const TPM_EO TPM_EO_SIGNED_LT = 0x0004;
750 const TPM_EO TPM_EO_UNSIGNED_LT = 0x0005;
751 const TPM_EO TPM_EO_SIGNED_GE = 0x0006;
752 const TPM_EO TPM_EO_UNSIGNED_GE = 0x0007;
753 const TPM_EO TPM_EO_SIGNED_LE = 0x0008;
754 const TPM_EO TPM_EO_UNSIGNED_LE = 0x0009;
755 const TPM_EO TPM_EO_BITSET = 0x000A;
756 const TPM_EO TPM_EO_BITCLEAR = 0x000B;
757 const TPM_ST TPM_ST_RSP_COMMAND = 0x00C4;
758 const TPM_ST TPM_ST_NULL = 0X8000;
759 const TPM_ST TPM_ST_NO_SESSIONS = 0x8001;
760 const TPM_ST TPM_ST_SESSIONS = 0x8002;
761 const TPM_ST TPM_ST_ATTEST_NV = 0x8014;
762 const TPM_ST TPM_ST_ATTEST_COMMAND_AUDIT = 0x8015;
763 const TPM_ST TPM_ST_ATTEST_SESSION_AUDIT = 0x8016;
764 const TPM_ST TPM_ST_ATTEST_CERTIFY = 0x8017;
765 const TPM_ST TPM_ST_ATTEST_QUOTE = 0x8018;
766 const TPM_ST TPM_ST_ATTEST_TIME = 0x8019;
767 const TPM_ST TPM_ST_ATTEST_CREATION = 0x801A;
768 const TPM_ST TPM_ST_CREATION = 0x8021;
769 const TPM_ST TPM_ST_VERIFIED = 0x8022;
770 const TPM_ST TPM_ST_AUTH_SECRET = 0x8023;
771 const TPM_ST TPM_ST_HASHCHECK = 0x8024;
772 const TPM_ST TPM_ST_AUTH_SIGNED = 0x8025;
773 const TPM_ST TPM_ST_FU_MANIFEST = 0x8029;
774 const TPM_SU TPM_SU_CLEAR = 0x0000;
775 const TPM_SU TPM_SU_STATE = 0x0001;
776 const TPM_SE TPM_SE_HMAC = 0x00;
777 const TPM_SE TPM_SE_POLICY = 0x01;
778 const TPM_SE TPM_SE_TRIAL = 0x03;
779 const TPM_CAP TPM_CAP_FIRST = 0x00000000;
780 const TPM_CAP TPM_CAP_ALGS = 0x00000000;
781 const TPM_CAP TPM_CAP_HANDLES = 0x00000001;
782 const TPM_CAP TPM_CAP_COMMANDS = 0x00000002;
783 const TPM_CAP TPM_CAP_PP_COMMANDS = 0x00000003;
784 const TPM_CAP TPM_CAP_AUDIT_COMMANDS = 0x00000004;
785 const TPM_CAP TPM_CAP_PCRS = 0x00000005;
786 const TPM_CAP TPM_CAP_TPM_PROPERTIES = 0x00000006;
787 const TPM_CAP TPM_CAP_PCR_PROPERTIES = 0x00000007;
788 const TPM_CAP TPM_CAP_ECC_CURVES = 0x00000008;
789 const TPM_CAP TPM_CAP_LAST = 0x00000008;
790 const TPM_CAP TPM_CAP_VENDOR_PROPERTY = 0x00000100;
791 const TPM_PT TPM_PT_NONE = 0x00000000;
792 const TPM_PT PT_GROUP = 0x00000100;
793 const TPM_PT PT_FIXED = PT_GROUP * 1;
794 const TPM_PT TPM_PT_FAMILY_INDICATOR = PT_FIXED + 0;
795 const TPM_PT TPM_PT_LEVEL = PT_FIXED + 1;
796 const TPM_PT TPM_PT_REVISION = PT_FIXED + 2;
797 const TPM_PT TPM_PT_DAY_OF_YEAR = PT_FIXED + 3;
798 const TPM_PT TPM_PT_YEAR = PT_FIXED + 4;
799 const TPM_PT TPM_PT_MANUFACTURER = PT_FIXED + 5;
800 const TPM_PT TPM_PT_VENDOR_STRING_1 = PT_FIXED + 6;
801 const TPM_PT TPM_PT_VENDOR_STRING_2 = PT_FIXED + 7;
802 const TPM_PT TPM_PT_VENDOR_STRING_3 = PT_FIXED + 8;
803 const TPM_PT TPM_PT_VENDOR_STRING_4 = PT_FIXED + 9;
804 const TPM_PT TPM_PT_VENDOR_TPM_TYPE = PT_FIXED + 10;
805 const TPM_PT TPM_PT_FIRMWARE_VERSION_1 = PT_FIXED + 11;
806 const TPM_PT TPM_PT_FIRMWARE_VERSION_2 = PT_FIXED + 12;
807 const TPM_PT TPM_PT_INPUT_BUFFER = PT_FIXED + 13;
808 const TPM_PT TPM_PT_HR_TRANSIENT_MIN = PT_FIXED + 14;
809 const TPM_PT TPM_PT_HR_PERSISTENT_MIN = PT_FIXED + 15;
810 const TPM_PT TPM_PT_HR_LOADED_MIN = PT_FIXED + 16;
811 const TPM_PT TPM_PT_ACTIVE_SESSIONS_MAX = PT_FIXED + 17;
812 const TPM_PT TPM_PT_PCR_COUNT = PT_FIXED + 18;
813 const TPM_PT TPM_PT_PCR_SELECT_MIN = PT_FIXED + 19;
814 const TPM_PT TPM_PT_CONTEXT_GAP_MAX = PT_FIXED + 20;
815 const TPM_PT TPM_PT_NV_COUNTERS_MAX = PT_FIXED + 22;
816 const TPM_PT TPM_PT_NV_INDEX_MAX = PT_FIXED + 23;
817 const TPM_PT TPM_PT_MEMORY = PT_FIXED + 24;
818 const TPM_PT TPM_PT_CLOCK_UPDATE = PT_FIXED + 25;
819 const TPM_PT TPM_PT_CONTEXT_HASH = PT_FIXED + 26;
820 const TPM_PT TPM_PT_CONTEXT_SYM = PT_FIXED + 27;
821 const TPM_PT TPM_PT_CONTEXT_SYM_SIZE = PT_FIXED + 28;
822 const TPM_PT TPM_PT_ORDERLY_COUNT = PT_FIXED + 29;
823 const TPM_PT TPM_PT_MAX_COMMAND_SIZE = PT_FIXED + 30;
824 const TPM_PT TPM_PT_MAX_RESPONSE_SIZE = PT_FIXED + 31;
825 const TPM_PT TPM_PT_MAX_DIGEST = PT_FIXED + 32;
826 const TPM_PT TPM_PT_MAX_OBJECT_CONTEXT = PT_FIXED + 33;
827 const TPM_PT TPM_PT_MAX_SESSION_CONTEXT = PT_FIXED + 34;
828 const TPM_PT TPM_PT_PS_FAMILY_INDICATOR = PT_FIXED + 35;
829 const TPM_PT TPM_PT_PS_LEVEL = PT_FIXED + 36;
830 const TPM_PT TPM_PT_PS_REVISION = PT_FIXED + 37;
831 const TPM_PT TPM_PT_PS_DAY_OF_YEAR = PT_FIXED + 38;
832 const TPM_PT TPM_PT_PS_YEAR = PT_FIXED + 39;
833 const TPM_PT TPM_PT_SPLIT_MAX = PT_FIXED + 40;
834 const TPM_PT TPM_PT_TOTAL_COMMANDS = PT_FIXED + 41;
835 const TPM_PT TPM_PT_LIBRARY_COMMANDS = PT_FIXED + 42;
836 const TPM_PT TPM_PT_VENDOR_COMMANDS = PT_FIXED + 43;
837 const TPM_PT TPM_PT_NV_BUFFER_MAX = PT_FIXED + 44;
838 const TPM_PT PT_VAR = PT_GROUP * 2;
839 const TPM_PT TPM_PT_PERMANENT = PT_VAR + 0;
840 const TPM_PT TPM_PT_STARTUP_CLEAR = PT_VAR + 1;
841 const TPM_PT TPM_PT_HR_NV_INDEX = PT_VAR + 2;
842 const TPM_PT TPM_PT_HR_LOADED = PT_VAR + 3;
843 const TPM_PT TPM_PT_HR_LOADED_AVAIL = PT_VAR + 4;
844 const TPM_PT TPM_PT_HR_ACTIVE = PT_VAR + 5;
845 const TPM_PT TPM_PT_HR_ACTIVE_AVAIL = PT_VAR + 6;
846 const TPM_PT TPM_PT_HR_TRANSIENT_AVAIL = PT_VAR + 7;
847 const TPM_PT TPM_PT_HR_PERSISTENT = PT_VAR + 8;
848 const TPM_PT TPM_PT_HR_PERSISTENT_AVAIL = PT_VAR + 9;
849 const TPM_PT TPM_PT_NV_COUNTERS = PT_VAR + 10;
850 const TPM_PT TPM_PT_NV_COUNTERS_AVAIL = PT_VAR + 11;
851 const TPM_PT TPM_PT_ALGORITHM_SET = PT_VAR + 12;
852 const TPM_PT TPM_PT_LOADED_CURVES = PT_VAR + 13;
853 const TPM_PT TPM_PT_LOCKOUT_COUNTER = PT_VAR + 14;
854 const TPM_PT TPM_PT_MAX_AUTH_FAIL = PT_VAR + 15;
855 const TPM_PT TPM_PT_LOCKOUT_INTERVAL = PT_VAR + 16;
856 const TPM_PT TPM_PT_LOCKOUT_RECOVERY = PT_VAR + 17;
857 const TPM_PT TPM_PT_NV_WRITE_RECOVERY = PT_VAR + 18;
858 const TPM_PT TPM_PT_AUDIT_COUNTER_0 = PT_VAR + 19;
859 const TPM_PT TPM_PT_AUDIT_COUNTER_1 = PT_VAR + 20;
860 const TPM_PT_PCR TPM_PT_PCR_FIRST = 0x00000000;
861 const TPM_PT_PCR TPM_PT_PCR_SAVE = 0x00000000;
862 const TPM_PT_PCR TPM_PT_PCR_EXTEND_L0 = 0x00000001;
863 const TPM_PT_PCR TPM_PT_PCR_RESET_L0 = 0x00000002;
864 const TPM_PT_PCR TPM_PT_PCR_EXTEND_L1 = 0x00000003;
865 const TPM_PT_PCR TPM_PT_PCR_RESET_L1 = 0x00000004;
866 const TPM_PT_PCR TPM_PT_PCR_EXTEND_L2 = 0x00000005;
867 const TPM_PT_PCR TPM_PT_PCR_RESET_L2 = 0x00000006;
868 const TPM_PT_PCR TPM_PT_PCR_EXTEND_L3 = 0x00000007;
869 const TPM_PT_PCR TPM_PT_PCR_RESET_L3 = 0x00000008;
870 const TPM_PT_PCR TPM_PT_PCR_EXTEND_L4 = 0x00000009;
871 const TPM_PT_PCR TPM_PT_PCR_RESET_L4 = 0x0000000A;
872 const TPM_PT_PCR TPM_PT_PCR_NO_INCREMENT = 0x00000011;
873 const TPM_PT_PCR TPM_PT_PCR_DRTM_RESET = 0x00000012;
874 const TPM_PT_PCR TPM_PT_PCR_POLICY = 0x00000013;
875 const TPM_PT_PCR TPM_PT_PCR_AUTH = 0x00000014;
876 const TPM_PT_PCR TPM_PT_PCR_LAST = 0x00000014;
877 const TPM_PS TPM_PS_MAIN = 0x00000000;
878 const TPM_PS TPM_PS_PC = 0x00000001;
879 const TPM_PS TPM_PS_PDA = 0x00000002;
880 const TPM_PS TPM_PS_CELL_PHONE = 0x00000003;
881 const TPM_PS TPM_PS_SERVER = 0x00000004;
882 const TPM_PS TPM_PS_PERIPHERAL = 0x00000005;
883 const TPM_PS TPM_PS_TSS = 0x00000006;
884 const TPM_PS TPM_PS_STORAGE = 0x00000007;
885 const TPM_PS TPM_PS_AUTHENTICATION = 0x00000008;
886 const TPM_PS TPM_PS_EMBEDDED = 0x00000009;
887 const TPM_PS TPM_PS_HARDCOPY = 0x0000000A;
888 const TPM_PS TPM_PS_INFRASTRUCTURE = 0x0000000B;
889 const TPM_PS TPM_PS_VIRTUALIZATION = 0x0000000C;
890 const TPM_PS TPM_PS_TNC = 0x0000000D;
891 const TPM_PS TPM_PS_MULTI_TENANT = 0x0000000E;
892 const TPM_PS TPM_PS_TC = 0x0000000F;
893 const TPM_HT TPM_HT_PCR = 0x00;
894 const TPM_HT TPM_HT_NV_INDEX = 0x01;
895 const TPM_HT TPM_HT_HMAC_SESSION = 0x02;
896 const TPM_HT TPM_HT_LOADED_SESSION = 0x02;
897 const TPM_HT TPM_HT_POLICY_SESSION = 0x03;
898 const TPM_HT TPM_HT_ACTIVE_SESSION = 0x03;
899 const TPM_HT TPM_HT_PERMANENT = 0x40;
900 const TPM_HT TPM_HT_TRANSIENT = 0x80;
901 const TPM_HT TPM_HT_PERSISTENT = 0x81;
902 const TPM_RH TPM_RH_FIRST = 0x40000000;
903 const TPM_RH TPM_RH_SRK = 0x40000000;
904 const TPM_RH TPM_RH_OWNER = 0x40000001;
905 const TPM_RH TPM_RH_REVOKE = 0x40000002;
906 const TPM_RH TPM_RH_TRANSPORT = 0x40000003;
907 const TPM_RH TPM_RH_OPERATOR = 0x40000004;
908 const TPM_RH TPM_RH_ADMIN = 0x40000005;
909 const TPM_RH TPM_RH_EK = 0x40000006;
910 const TPM_RH TPM_RH_NULL = 0x40000007;
911 const TPM_RH TPM_RH_UNASSIGNED = 0x40000008;
912 const TPM_RH TPM_RS_PW = 0x40000009;
913 const TPM_RH TPM_RH_LOCKOUT = 0x4000000A;
914 const TPM_RH TPM_RH_ENDORSEMENT = 0x4000000B;
915 const TPM_RH TPM_RH_PLATFORM = 0x4000000C;
916 const TPM_RH TPM_RH_PLATFORM_NV = 0x4000000D;
917 const TPM_RH TPM_RH_LAST = 0x4000000D;
918 const TPM_HC HR_HANDLE_MASK = 0x00FFFFFF;
919 const TPM_HC HR_RANGE_MASK = 0xFF000000;
920 const TPM_HC HR_SHIFT = 24;
921 const TPM_HC HR_PCR = (TPM_HT_PCR << HR_SHIFT);
922 const TPM_HC HR_HMAC_SESSION = (TPM_HT_HMAC_SESSION << HR_SHIFT);
923 const TPM_HC HR_POLICY_SESSION = (TPM_HT_POLICY_SESSION << HR_SHIFT);
924 const TPM_HC HR_TRANSIENT = (TPM_HT_TRANSIENT << HR_SHIFT);
925 const TPM_HC HR_PERSISTENT = (TPM_HT_PERSISTENT << HR_SHIFT);
926 const TPM_HC HR_NV_INDEX = (TPM_HT_NV_INDEX << HR_SHIFT);
927 const TPM_HC HR_PERMANENT = (TPM_HT_PERMANENT << HR_SHIFT);
928 const TPM_HC PCR_FIRST = (HR_PCR + 0);
929 const TPM_HC PCR_LAST = (PCR_FIRST + IMPLEMENTATION_PCR-1);
930 const TPM_HC HMAC_SESSION_FIRST = (HR_HMAC_SESSION + 0);
931 const TPM_HC HMAC_SESSION_LAST = (HMAC_SESSION_FIRST+MAX_ACTIVE_SESSIONS-1);
932 const TPM_HC LOADED_SESSION_LAST = HMAC_SESSION_LAST;
933 const TPM_HC POLICY_SESSION_FIRST = (HR_POLICY_SESSION + 0);
934 const TPM_HC POLICY_SESSION_LAST = (POLICY_SESSION_FIRST + MAX_ACTIVE_SESSIONS-1);
935 const TPM_HC TRANSIENT_FIRST = (HR_TRANSIENT + 0);
936 const TPM_HC ACTIVE_SESSION_FIRST = POLICY_SESSION_FIRST;
937 const TPM_HC ACTIVE_SESSION_LAST = POLICY_SESSION_LAST;
938 const TPM_HC TRANSIENT_LAST = (TRANSIENT_FIRST+MAX_LOADED_OBJECTS-1);
939 const TPM_HC PERSISTENT_FIRST = (HR_PERSISTENT + 0);
940 const TPM_HC PERSISTENT_LAST = (PERSISTENT_FIRST + 0x00FFFFFF);
941 const TPM_HC PLATFORM_PERSISTENT = (PERSISTENT_FIRST + 0x00800000);
942 const TPM_HC NV_INDEX_FIRST = (HR_NV_INDEX + 0);
943 const TPM_HC NV_INDEX_LAST = (NV_INDEX_FIRST + 0x00FFFFFF);
944 const TPM_HC PERMANENT_FIRST = TPM_RH_FIRST;
945 const TPM_HC PERMANENT_LAST = TPM_RH_LAST;
946 
947 struct TPMS_ALGORITHM_DESCRIPTION {
948   TPM_ALG_ID alg;
949   TPMA_ALGORITHM attributes;
950 };
951 
952 union TPMU_HA {
953   BYTE sha1[SHA1_DIGEST_SIZE];
954   BYTE sha256[SHA256_DIGEST_SIZE];
955   BYTE sm3_256[SM3_256_DIGEST_SIZE];
956   BYTE sha384[SHA384_DIGEST_SIZE];
957   BYTE sha512[SHA512_DIGEST_SIZE];
958 };
959 
960 struct TPMT_HA {
961   TPMI_ALG_HASH hash_alg;
962   TPMU_HA digest;
963 };
964 
965 struct TPM2B_DIGEST {
966   UINT16 size;
967   BYTE buffer[sizeof(TPMU_HA)];
968 };
969 
970 struct TPM2B_DATA {
971   UINT16 size;
972   BYTE buffer[sizeof(TPMT_HA)];
973 };
974 
975 struct TPM2B_EVENT {
976   UINT16 size;
977   BYTE buffer[1024];
978 };
979 
980 struct TPM2B_MAX_BUFFER {
981   UINT16 size;
982   BYTE buffer[MAX_DIGEST_BUFFER];
983 };
984 
985 struct TPM2B_MAX_NV_BUFFER {
986   UINT16 size;
987   BYTE buffer[MAX_NV_BUFFER_SIZE];
988 };
989 
990 struct TPM2B_TIMEOUT {
991   UINT16 size;
992   BYTE buffer[sizeof(UINT64)];
993 };
994 
995 struct TPM2B_IV {
996   UINT16 size;
997   BYTE buffer[MAX_SYM_BLOCK_SIZE];
998 };
999 
1000 union TPMU_NAME {
1001   TPMT_HA digest;
1002   TPM_HANDLE handle;
1003 };
1004 
1005 struct TPM2B_NAME {
1006   UINT16 size;
1007   BYTE name[sizeof(TPMU_NAME)];
1008 };
1009 
1010 struct TPMS_PCR_SELECT {
1011   UINT8 sizeof_select;
1012   BYTE pcr_select[PCR_SELECT_MAX];
1013 };
1014 
1015 struct TPMS_PCR_SELECTION {
1016   TPMI_ALG_HASH hash;
1017   UINT8 sizeof_select;
1018   BYTE pcr_select[PCR_SELECT_MAX];
1019 };
1020 
1021 struct TPMT_TK_CREATION {
1022   TPM_ST tag;
1023   TPMI_RH_HIERARCHY hierarchy;
1024   TPM2B_DIGEST digest;
1025 };
1026 
1027 struct TPMT_TK_VERIFIED {
1028   TPM_ST tag;
1029   TPMI_RH_HIERARCHY hierarchy;
1030   TPM2B_DIGEST digest;
1031 };
1032 
1033 struct TPMT_TK_AUTH {
1034   TPMI_RH_HIERARCHY hierarchy;
1035   TPM2B_DIGEST digest;
1036 };
1037 
1038 struct TPMT_TK_HASHCHECK {
1039   TPM_ST tag;
1040   TPMI_RH_HIERARCHY hierarchy;
1041   TPM2B_DIGEST digest;
1042 };
1043 
1044 struct TPMS_ALG_PROPERTY {
1045   TPM_ALG_ID alg;
1046   TPMA_ALGORITHM alg_properties;
1047 };
1048 
1049 struct TPMS_TAGGED_PROPERTY {
1050   TPM_PT property;
1051   UINT32 value;
1052 };
1053 
1054 struct TPMS_TAGGED_PCR_SELECT {
1055   TPM_PT tag;
1056   UINT8 sizeof_select;
1057   BYTE pcr_select[PCR_SELECT_MAX];
1058 };
1059 
1060 struct TPML_CC {
1061   UINT32 count;
1062   TPM_CC command_codes[MAX_CAP_CC];
1063 };
1064 
1065 struct TPML_CCA {
1066   UINT32 count;
1067   TPMA_CC command_attributes[MAX_CAP_CC];
1068 };
1069 
1070 struct TPML_ALG {
1071   UINT32 count;
1072   TPM_ALG_ID algorithms[MAX_ALG_LIST_SIZE];
1073 };
1074 
1075 struct TPML_HANDLE {
1076   UINT32 count;
1077   TPM_HANDLE handle[MAX_CAP_HANDLES];
1078 };
1079 
1080 struct TPML_DIGEST {
1081   UINT32 count;
1082   TPM2B_DIGEST digests[8];
1083 };
1084 
1085 struct TPML_DIGEST_VALUES {
1086   UINT32 count;
1087   TPMT_HA digests[HASH_COUNT];
1088 };
1089 
1090 struct TPM2B_DIGEST_VALUES {
1091   UINT16 size;
1092   BYTE buffer[sizeof(TPML_DIGEST_VALUES)];
1093 };
1094 
1095 struct TPML_PCR_SELECTION {
1096   UINT32 count;
1097   TPMS_PCR_SELECTION pcr_selections[HASH_COUNT];
1098 };
1099 
1100 struct TPML_ALG_PROPERTY {
1101   UINT32 count;
1102   TPMS_ALG_PROPERTY alg_properties[MAX_CAP_ALGS];
1103 };
1104 
1105 struct TPML_TAGGED_TPM_PROPERTY {
1106   UINT32 count;
1107   TPMS_TAGGED_PROPERTY tpm_property[MAX_TPM_PROPERTIES];
1108 };
1109 
1110 struct TPML_TAGGED_PCR_PROPERTY {
1111   UINT32 count;
1112   TPMS_TAGGED_PCR_SELECT pcr_property[MAX_PCR_PROPERTIES];
1113 };
1114 
1115 struct TPML_ECC_CURVE {
1116   UINT32 count;
1117   TPM_ECC_CURVE ecc_curves[MAX_ECC_CURVES];
1118 };
1119 
1120 union TPMU_CAPABILITIES {
1121   TPML_ALG_PROPERTY algorithms;
1122   TPML_HANDLE handles;
1123   TPML_CCA command;
1124   TPML_CC pp_commands;
1125   TPML_CC audit_commands;
1126   TPML_PCR_SELECTION assigned_pcr;
1127   TPML_TAGGED_TPM_PROPERTY tpm_properties;
1128   TPML_TAGGED_PCR_PROPERTY pcr_properties;
1129   TPML_ECC_CURVE ecc_curves;
1130 };
1131 
1132 struct TPMS_CAPABILITY_DATA {
1133   TPM_CAP capability;
1134   TPMU_CAPABILITIES data;
1135 };
1136 
1137 struct TPMS_CLOCK_INFO {
1138   UINT64 clock;
1139   UINT32 reset_count;
1140   UINT32 restart_count;
1141   TPMI_YES_NO safe;
1142 };
1143 
1144 struct TPMS_TIME_INFO {
1145   UINT64 time;
1146   TPMS_CLOCK_INFO clock_info;
1147 };
1148 
1149 struct TPMS_TIME_ATTEST_INFO {
1150   TPMS_TIME_INFO time;
1151   UINT64 firmware_version;
1152 };
1153 
1154 struct TPMS_CERTIFY_INFO {
1155   TPM2B_NAME name;
1156   TPM2B_NAME qualified_name;
1157 };
1158 
1159 struct TPMS_QUOTE_INFO {
1160   TPML_PCR_SELECTION pcr_select;
1161   TPM2B_DIGEST pcr_digest;
1162 };
1163 
1164 struct TPMS_COMMAND_AUDIT_INFO {
1165   UINT64 audit_counter;
1166   TPM_ALG_ID digest_alg;
1167   TPM2B_DIGEST audit_digest;
1168   TPM2B_DIGEST command_digest;
1169 };
1170 
1171 struct TPMS_SESSION_AUDIT_INFO {
1172   TPMI_YES_NO exclusive_session;
1173   TPM2B_DIGEST session_digest;
1174 };
1175 
1176 struct TPMS_CREATION_INFO {
1177   TPM2B_NAME object_name;
1178   TPM2B_DIGEST creation_hash;
1179 };
1180 
1181 struct TPMS_NV_CERTIFY_INFO {
1182   TPM2B_NAME index_name;
1183   UINT16 offset;
1184   TPM2B_MAX_NV_BUFFER nv_contents;
1185 };
1186 
1187 union TPMU_ATTEST {
1188   TPMS_CERTIFY_INFO certify;
1189   TPMS_CREATION_INFO creation;
1190   TPMS_QUOTE_INFO quote;
1191   TPMS_COMMAND_AUDIT_INFO command_audit;
1192   TPMS_SESSION_AUDIT_INFO session_audit;
1193   TPMS_TIME_ATTEST_INFO time;
1194   TPMS_NV_CERTIFY_INFO nv;
1195 };
1196 
1197 struct TPMS_ATTEST {
1198   TPM_GENERATED magic;
1199   TPMI_ST_ATTEST type;
1200   TPM2B_NAME qualified_signer;
1201   TPM2B_DATA extra_data;
1202   TPMS_CLOCK_INFO clock_info;
1203   UINT64 firmware_version;
1204   TPMU_ATTEST attested;
1205 };
1206 
1207 struct TPM2B_ATTEST {
1208   UINT16 size;
1209   BYTE attestation_data[sizeof(TPMS_ATTEST)];
1210 };
1211 
1212 struct TPMS_AUTH_COMMAND {
1213   TPMI_SH_AUTH_SESSION session_handle;
1214   TPM2B_NONCE nonce;
1215   TPMA_SESSION session_attributes;
1216   TPM2B_AUTH hmac;
1217 };
1218 
1219 struct TPMS_AUTH_RESPONSE {
1220   TPM2B_NONCE nonce;
1221   TPMA_SESSION session_attributes;
1222   TPM2B_AUTH hmac;
1223 };
1224 
1225 union TPMU_SYM_KEY_BITS {
1226   TPMI_AES_KEY_BITS aes;
1227   TPMI_SM4_KEY_BITS sm4;
1228   TPM_KEY_BITS sym;
1229   TPMI_ALG_HASH xor_;
1230 };
1231 
1232 union TPMU_SYM_MODE {
1233   TPMI_ALG_SYM_MODE aes;
1234   TPMI_ALG_SYM_MODE sm4;
1235   TPMI_ALG_SYM_MODE sym;
1236 };
1237 
1238 union TPMU_SYM_DETAILS {
1239 };
1240 
1241 struct TPMT_SYM_DEF {
1242   TPMI_ALG_SYM algorithm;
1243   TPMU_SYM_KEY_BITS key_bits;
1244   TPMU_SYM_MODE mode;
1245   TPMU_SYM_DETAILS details;
1246 };
1247 
1248 struct TPMT_SYM_DEF_OBJECT {
1249   TPMI_ALG_SYM_OBJECT algorithm;
1250   TPMU_SYM_KEY_BITS key_bits;
1251   TPMU_SYM_MODE mode;
1252   TPMU_SYM_DETAILS details;
1253 };
1254 
1255 struct TPM2B_SYM_KEY {
1256   UINT16 size;
1257   BYTE buffer[MAX_SYM_KEY_BYTES];
1258 };
1259 
1260 struct TPMS_SYMCIPHER_PARMS {
1261   TPMT_SYM_DEF_OBJECT sym;
1262 };
1263 
1264 struct TPM2B_SENSITIVE_DATA {
1265   UINT16 size;
1266   BYTE buffer[MAX_SYM_DATA];
1267 };
1268 
1269 struct TPMS_SENSITIVE_CREATE {
1270   TPM2B_AUTH user_auth;
1271   TPM2B_SENSITIVE_DATA data;
1272 };
1273 
1274 struct TPM2B_SENSITIVE_CREATE {
1275   UINT16 size;
1276   TPMS_SENSITIVE_CREATE sensitive;
1277 };
1278 
1279 struct TPMS_SCHEME_SIGHASH {
1280   TPMI_ALG_HASH hash_alg;
1281 };
1282 
1283 struct TPMS_SCHEME_XOR {
1284   TPMI_ALG_HASH hash_alg;
1285   TPMI_ALG_KDF kdf;
1286 };
1287 
1288 union TPMU_SCHEME_KEYEDHASH {
1289   TPMS_SCHEME_HMAC hmac;
1290   TPMS_SCHEME_XOR xor_;
1291 };
1292 
1293 struct TPMT_KEYEDHASH_SCHEME {
1294   TPMI_ALG_KEYEDHASH_SCHEME scheme;
1295   TPMU_SCHEME_KEYEDHASH details;
1296 };
1297 
1298 struct TPMS_SCHEME_ECDAA {
1299   TPMI_ALG_HASH hash_alg;
1300   UINT16 count;
1301 };
1302 
1303 union TPMU_SIG_SCHEME {
1304   TPMS_SCHEME_RSASSA rsassa;
1305   TPMS_SCHEME_RSAPSS rsapss;
1306   TPMS_SCHEME_ECDSA ecdsa;
1307   TPMS_SCHEME_SM2 sm2;
1308   TPMS_SCHEME_ECDAA ecdaa;
1309   TPMS_SCHEME_ECSCHNORR ec_schnorr;
1310   TPMS_SCHEME_HMAC hmac;
1311   TPMS_SCHEME_SIGHASH any;
1312 };
1313 
1314 struct TPMT_SIG_SCHEME {
1315   TPMI_ALG_SIG_SCHEME scheme;
1316   TPMU_SIG_SCHEME details;
1317 };
1318 
1319 struct TPMS_SCHEME_OAEP {
1320   TPMI_ALG_HASH hash_alg;
1321 };
1322 
1323 struct TPMS_SCHEME_ECDH {
1324   TPMI_ALG_HASH hash_alg;
1325 };
1326 
1327 struct TPMS_SCHEME_MGF1 {
1328   TPMI_ALG_HASH hash_alg;
1329 };
1330 
1331 struct TPMS_SCHEME_KDF1_SP800_56a {
1332   TPMI_ALG_HASH hash_alg;
1333 };
1334 
1335 struct TPMS_SCHEME_KDF2 {
1336   TPMI_ALG_HASH hash_alg;
1337 };
1338 
1339 struct TPMS_SCHEME_KDF1_SP800_108 {
1340   TPMI_ALG_HASH hash_alg;
1341 };
1342 
1343 union TPMU_KDF_SCHEME {
1344   TPMS_SCHEME_MGF1 mgf1;
1345   TPMS_SCHEME_KDF1_SP800_56a kdf1_sp800_56a;
1346   TPMS_SCHEME_KDF2 kdf2;
1347   TPMS_SCHEME_KDF1_SP800_108 kdf1_sp800_108;
1348 };
1349 
1350 struct TPMT_KDF_SCHEME {
1351   TPMI_ALG_KDF scheme;
1352   TPMU_KDF_SCHEME details;
1353 };
1354 
1355 union TPMU_ASYM_SCHEME {
1356   TPMS_SCHEME_RSASSA rsassa;
1357   TPMS_SCHEME_RSAPSS rsapss;
1358   TPMS_SCHEME_OAEP oaep;
1359   TPMS_SCHEME_ECDSA ecdsa;
1360   TPMS_SCHEME_SM2 sm2;
1361   TPMS_SCHEME_ECDAA ecdaa;
1362   TPMS_SCHEME_ECSCHNORR ec_schnorr;
1363   TPMS_SCHEME_ECDH ecdh;
1364   TPMS_SCHEME_SIGHASH any_sig;
1365 };
1366 
1367 struct TPMT_ASYM_SCHEME {
1368   TPMI_ALG_ASYM_SCHEME scheme;
1369   TPMU_ASYM_SCHEME details;
1370 };
1371 
1372 struct TPMT_RSA_SCHEME {
1373   TPMI_ALG_RSA_SCHEME scheme;
1374   TPMU_ASYM_SCHEME details;
1375 };
1376 
1377 struct TPMT_RSA_DECRYPT {
1378   TPMI_ALG_RSA_DECRYPT scheme;
1379   TPMU_ASYM_SCHEME details;
1380 };
1381 
1382 struct TPM2B_PUBLIC_KEY_RSA {
1383   UINT16 size;
1384   BYTE buffer[MAX_RSA_KEY_BYTES];
1385 };
1386 
1387 struct TPM2B_PRIVATE_KEY_RSA {
1388   UINT16 size;
1389   BYTE buffer[MAX_RSA_KEY_BYTES/2];
1390 };
1391 
1392 struct TPM2B_ECC_PARAMETER {
1393   UINT16 size;
1394   BYTE buffer[MAX_ECC_KEY_BYTES];
1395 };
1396 
1397 struct TPMS_ECC_POINT {
1398   TPM2B_ECC_PARAMETER x;
1399   TPM2B_ECC_PARAMETER y;
1400 };
1401 
1402 struct TPM2B_ECC_POINT {
1403   UINT16 size;
1404   TPMS_ECC_POINT point;
1405 };
1406 
1407 struct TPMT_ECC_SCHEME {
1408   TPMI_ALG_ECC_SCHEME scheme;
1409   TPMU_SIG_SCHEME details;
1410 };
1411 
1412 struct TPMS_ALGORITHM_DETAIL_ECC {
1413   TPM_ECC_CURVE curve_id;
1414   UINT16 key_size;
1415   TPMT_KDF_SCHEME kdf;
1416   TPMT_ECC_SCHEME sign;
1417   TPM2B_ECC_PARAMETER p;
1418   TPM2B_ECC_PARAMETER a;
1419   TPM2B_ECC_PARAMETER b;
1420   TPM2B_ECC_PARAMETER g_x;
1421   TPM2B_ECC_PARAMETER g_y;
1422   TPM2B_ECC_PARAMETER n;
1423   TPM2B_ECC_PARAMETER h;
1424 };
1425 
1426 struct TPMS_SIGNATURE_RSASSA {
1427   TPMI_ALG_HASH hash;
1428   TPM2B_PUBLIC_KEY_RSA sig;
1429 };
1430 
1431 struct TPMS_SIGNATURE_RSAPSS {
1432   TPMI_ALG_HASH hash;
1433   TPM2B_PUBLIC_KEY_RSA sig;
1434 };
1435 
1436 struct TPMS_SIGNATURE_ECDSA {
1437   TPMI_ALG_HASH hash;
1438   TPM2B_ECC_PARAMETER signature_r;
1439   TPM2B_ECC_PARAMETER signature_s;
1440 };
1441 
1442 union TPMU_SIGNATURE {
1443   TPMS_SIGNATURE_RSASSA rsassa;
1444   TPMS_SIGNATURE_RSAPSS rsapss;
1445   TPMS_SIGNATURE_ECDSA ecdsa;
1446   TPMS_SIGNATURE_ECDSA sm2;
1447   TPMS_SIGNATURE_ECDSA ecdaa;
1448   TPMS_SIGNATURE_ECDSA ecschnorr;
1449   TPMT_HA hmac;
1450   TPMS_SCHEME_SIGHASH any;
1451 };
1452 
1453 struct TPMT_SIGNATURE {
1454   TPMI_ALG_SIG_SCHEME sig_alg;
1455   TPMU_SIGNATURE signature;
1456 };
1457 
1458 union TPMU_ENCRYPTED_SECRET {
1459   BYTE ecc[sizeof(TPMS_ECC_POINT)];
1460   BYTE rsa[MAX_RSA_KEY_BYTES];
1461   BYTE symmetric[sizeof(TPM2B_DIGEST)];
1462   BYTE keyed_hash[sizeof(TPM2B_DIGEST)];
1463 };
1464 
1465 struct TPM2B_ENCRYPTED_SECRET {
1466   UINT16 size;
1467   BYTE secret[sizeof(TPMU_ENCRYPTED_SECRET)];
1468 };
1469 
1470 struct TPMS_KEYEDHASH_PARMS {
1471   TPMT_KEYEDHASH_SCHEME scheme;
1472 };
1473 
1474 struct TPMS_ASYM_PARMS {
1475   TPMT_SYM_DEF_OBJECT symmetric;
1476   TPMT_ASYM_SCHEME scheme;
1477 };
1478 
1479 struct TPMS_RSA_PARMS {
1480   TPMT_SYM_DEF_OBJECT symmetric;
1481   TPMT_RSA_SCHEME scheme;
1482   TPMI_RSA_KEY_BITS key_bits;
1483   UINT32 exponent;
1484 };
1485 
1486 struct TPMS_ECC_PARMS {
1487   TPMT_SYM_DEF_OBJECT symmetric;
1488   TPMT_ECC_SCHEME scheme;
1489   TPMI_ECC_CURVE curve_id;
1490   TPMT_KDF_SCHEME kdf;
1491 };
1492 
1493 union TPMU_PUBLIC_PARMS {
1494   TPMS_KEYEDHASH_PARMS keyed_hash_detail;
1495   TPMS_SYMCIPHER_PARMS sym_detail;
1496   TPMS_RSA_PARMS rsa_detail;
1497   TPMS_ECC_PARMS ecc_detail;
1498   TPMS_ASYM_PARMS asym_detail;
1499 };
1500 
1501 struct TPMT_PUBLIC_PARMS {
1502   TPMI_ALG_PUBLIC type;
1503   TPMU_PUBLIC_PARMS parameters;
1504 };
1505 
1506 union TPMU_PUBLIC_ID {
1507   TPM2B_DIGEST keyed_hash;
1508   TPM2B_DIGEST sym;
1509   TPM2B_PUBLIC_KEY_RSA rsa;
1510   TPMS_ECC_POINT ecc;
1511 };
1512 
1513 struct TPMT_PUBLIC {
1514   TPMI_ALG_PUBLIC type;
1515   TPMI_ALG_HASH name_alg;
1516   TPMA_OBJECT object_attributes;
1517   TPM2B_DIGEST auth_policy;
1518   TPMU_PUBLIC_PARMS parameters;
1519   TPMU_PUBLIC_ID unique;
1520 };
1521 
1522 struct TPM2B_PUBLIC {
1523   UINT16 size;
1524   TPMT_PUBLIC public_area;
1525 };
1526 
1527 struct TPM2B_PRIVATE_VENDOR_SPECIFIC {
1528   UINT16 size;
1529   BYTE buffer[PRIVATE_VENDOR_SPECIFIC_BYTES];
1530 };
1531 
1532 union TPMU_SENSITIVE_COMPOSITE {
1533   TPM2B_PRIVATE_KEY_RSA rsa;
1534   TPM2B_ECC_PARAMETER ecc;
1535   TPM2B_SENSITIVE_DATA bits;
1536   TPM2B_SYM_KEY sym;
1537   TPM2B_PRIVATE_VENDOR_SPECIFIC any;
1538 };
1539 
1540 struct TPMT_SENSITIVE {
1541   TPMI_ALG_PUBLIC sensitive_type;
1542   TPM2B_AUTH auth_value;
1543   TPM2B_DIGEST seed_value;
1544   TPMU_SENSITIVE_COMPOSITE sensitive;
1545 };
1546 
1547 struct TPM2B_SENSITIVE {
1548   UINT16 size;
1549   TPMT_SENSITIVE sensitive_area;
1550 };
1551 
1552 struct _PRIVATE {
1553   TPM2B_DIGEST integrity_outer;
1554   TPM2B_DIGEST integrity_inner;
1555   TPMT_SENSITIVE sensitive;
1556 };
1557 
1558 struct TPM2B_PRIVATE {
1559   UINT16 size;
1560   BYTE buffer[sizeof(_PRIVATE)];
1561 };
1562 
1563 struct _ID_OBJECT {
1564   TPM2B_DIGEST integrity_hmac;
1565   TPM2B_DIGEST enc_identity;
1566 };
1567 
1568 struct TPM2B_ID_OBJECT {
1569   UINT16 size;
1570   BYTE credential[sizeof(_ID_OBJECT)];
1571 };
1572 
1573 struct TPMS_NV_PUBLIC {
1574   TPMI_RH_NV_INDEX nv_index;
1575   TPMI_ALG_HASH name_alg;
1576   TPMA_NV attributes;
1577   TPM2B_DIGEST auth_policy;
1578   UINT16 data_size;
1579 };
1580 
1581 struct TPM2B_NV_PUBLIC {
1582   UINT16 size;
1583   TPMS_NV_PUBLIC nv_public;
1584 };
1585 
1586 struct TPM2B_CONTEXT_SENSITIVE {
1587   UINT16 size;
1588   BYTE buffer[MAX_CONTEXT_SIZE];
1589 };
1590 
1591 struct TPMS_CONTEXT_DATA {
1592   TPM2B_DIGEST integrity;
1593   TPM2B_CONTEXT_SENSITIVE encrypted;
1594 };
1595 
1596 struct TPM2B_CONTEXT_DATA {
1597   UINT16 size;
1598   BYTE buffer[sizeof(TPMS_CONTEXT_DATA)];
1599 };
1600 
1601 struct TPMS_CONTEXT {
1602   UINT64 sequence;
1603   TPMI_DH_CONTEXT saved_handle;
1604   TPMI_RH_HIERARCHY hierarchy;
1605   TPM2B_CONTEXT_DATA context_blob;
1606 };
1607 
1608 struct TPMS_CREATION_DATA {
1609   TPML_PCR_SELECTION pcr_select;
1610   TPM2B_DIGEST pcr_digest;
1611   TPMA_LOCALITY locality;
1612   TPM_ALG_ID parent_name_alg;
1613   TPM2B_NAME parent_name;
1614   TPM2B_NAME parent_qualified_name;
1615   TPM2B_DATA outside_info;
1616 };
1617 
1618 struct TPM2B_CREATION_DATA {
1619   UINT16 size;
1620   TPMS_CREATION_DATA creation_data;
1621 };
1622 
1623 
1624 TRUNKS_EXPORT size_t GetNumberOfRequestHandles(TPM_CC command_code);
1625 TRUNKS_EXPORT size_t GetNumberOfResponseHandles(TPM_CC command_code);
1626 
1627 TRUNKS_EXPORT TPM_RC Serialize_uint8_t(
1628     const uint8_t& value,
1629     std::string* buffer);
1630 
1631 TRUNKS_EXPORT TPM_RC Parse_uint8_t(
1632     std::string* buffer,
1633     uint8_t* value,
1634     std::string* value_bytes);
1635 
1636 TRUNKS_EXPORT TPM_RC Serialize_int8_t(
1637     const int8_t& value,
1638     std::string* buffer);
1639 
1640 TRUNKS_EXPORT TPM_RC Parse_int8_t(
1641     std::string* buffer,
1642     int8_t* value,
1643     std::string* value_bytes);
1644 
1645 TRUNKS_EXPORT TPM_RC Serialize_int(
1646     const int& value,
1647     std::string* buffer);
1648 
1649 TRUNKS_EXPORT TPM_RC Parse_int(
1650     std::string* buffer,
1651     int* value,
1652     std::string* value_bytes);
1653 
1654 TRUNKS_EXPORT TPM_RC Serialize_uint16_t(
1655     const uint16_t& value,
1656     std::string* buffer);
1657 
1658 TRUNKS_EXPORT TPM_RC Parse_uint16_t(
1659     std::string* buffer,
1660     uint16_t* value,
1661     std::string* value_bytes);
1662 
1663 TRUNKS_EXPORT TPM_RC Serialize_int16_t(
1664     const int16_t& value,
1665     std::string* buffer);
1666 
1667 TRUNKS_EXPORT TPM_RC Parse_int16_t(
1668     std::string* buffer,
1669     int16_t* value,
1670     std::string* value_bytes);
1671 
1672 TRUNKS_EXPORT TPM_RC Serialize_uint32_t(
1673     const uint32_t& value,
1674     std::string* buffer);
1675 
1676 TRUNKS_EXPORT TPM_RC Parse_uint32_t(
1677     std::string* buffer,
1678     uint32_t* value,
1679     std::string* value_bytes);
1680 
1681 TRUNKS_EXPORT TPM_RC Serialize_int32_t(
1682     const int32_t& value,
1683     std::string* buffer);
1684 
1685 TRUNKS_EXPORT TPM_RC Parse_int32_t(
1686     std::string* buffer,
1687     int32_t* value,
1688     std::string* value_bytes);
1689 
1690 TRUNKS_EXPORT TPM_RC Serialize_uint64_t(
1691     const uint64_t& value,
1692     std::string* buffer);
1693 
1694 TRUNKS_EXPORT TPM_RC Parse_uint64_t(
1695     std::string* buffer,
1696     uint64_t* value,
1697     std::string* value_bytes);
1698 
1699 TRUNKS_EXPORT TPM_RC Serialize_int64_t(
1700     const int64_t& value,
1701     std::string* buffer);
1702 
1703 TRUNKS_EXPORT TPM_RC Parse_int64_t(
1704     std::string* buffer,
1705     int64_t* value,
1706     std::string* value_bytes);
1707 
1708 TRUNKS_EXPORT TPM_RC Serialize_UINT8(
1709     const UINT8& value,
1710     std::string* buffer);
1711 
1712 TRUNKS_EXPORT TPM_RC Parse_UINT8(
1713     std::string* buffer,
1714     UINT8* value,
1715     std::string* value_bytes);
1716 
1717 TRUNKS_EXPORT TPM_RC Serialize_BYTE(
1718     const BYTE& value,
1719     std::string* buffer);
1720 
1721 TRUNKS_EXPORT TPM_RC Parse_BYTE(
1722     std::string* buffer,
1723     BYTE* value,
1724     std::string* value_bytes);
1725 
1726 TRUNKS_EXPORT TPM_RC Serialize_INT8(
1727     const INT8& value,
1728     std::string* buffer);
1729 
1730 TRUNKS_EXPORT TPM_RC Parse_INT8(
1731     std::string* buffer,
1732     INT8* value,
1733     std::string* value_bytes);
1734 
1735 TRUNKS_EXPORT TPM_RC Serialize_BOOL(
1736     const BOOL& value,
1737     std::string* buffer);
1738 
1739 TRUNKS_EXPORT TPM_RC Parse_BOOL(
1740     std::string* buffer,
1741     BOOL* value,
1742     std::string* value_bytes);
1743 
1744 TRUNKS_EXPORT TPM_RC Serialize_UINT16(
1745     const UINT16& value,
1746     std::string* buffer);
1747 
1748 TRUNKS_EXPORT TPM_RC Parse_UINT16(
1749     std::string* buffer,
1750     UINT16* value,
1751     std::string* value_bytes);
1752 
1753 TRUNKS_EXPORT TPM_RC Serialize_INT16(
1754     const INT16& value,
1755     std::string* buffer);
1756 
1757 TRUNKS_EXPORT TPM_RC Parse_INT16(
1758     std::string* buffer,
1759     INT16* value,
1760     std::string* value_bytes);
1761 
1762 TRUNKS_EXPORT TPM_RC Serialize_UINT32(
1763     const UINT32& value,
1764     std::string* buffer);
1765 
1766 TRUNKS_EXPORT TPM_RC Parse_UINT32(
1767     std::string* buffer,
1768     UINT32* value,
1769     std::string* value_bytes);
1770 
1771 TRUNKS_EXPORT TPM_RC Serialize_INT32(
1772     const INT32& value,
1773     std::string* buffer);
1774 
1775 TRUNKS_EXPORT TPM_RC Parse_INT32(
1776     std::string* buffer,
1777     INT32* value,
1778     std::string* value_bytes);
1779 
1780 TRUNKS_EXPORT TPM_RC Serialize_UINT64(
1781     const UINT64& value,
1782     std::string* buffer);
1783 
1784 TRUNKS_EXPORT TPM_RC Parse_UINT64(
1785     std::string* buffer,
1786     UINT64* value,
1787     std::string* value_bytes);
1788 
1789 TRUNKS_EXPORT TPM_RC Serialize_INT64(
1790     const INT64& value,
1791     std::string* buffer);
1792 
1793 TRUNKS_EXPORT TPM_RC Parse_INT64(
1794     std::string* buffer,
1795     INT64* value,
1796     std::string* value_bytes);
1797 
1798 TRUNKS_EXPORT TPM_RC Serialize_TPM_ALGORITHM_ID(
1799     const TPM_ALGORITHM_ID& value,
1800     std::string* buffer);
1801 
1802 TRUNKS_EXPORT TPM_RC Parse_TPM_ALGORITHM_ID(
1803     std::string* buffer,
1804     TPM_ALGORITHM_ID* value,
1805     std::string* value_bytes);
1806 
1807 TRUNKS_EXPORT TPM_RC Serialize_TPM_MODIFIER_INDICATOR(
1808     const TPM_MODIFIER_INDICATOR& value,
1809     std::string* buffer);
1810 
1811 TRUNKS_EXPORT TPM_RC Parse_TPM_MODIFIER_INDICATOR(
1812     std::string* buffer,
1813     TPM_MODIFIER_INDICATOR* value,
1814     std::string* value_bytes);
1815 
1816 TRUNKS_EXPORT TPM_RC Serialize_TPM_AUTHORIZATION_SIZE(
1817     const TPM_AUTHORIZATION_SIZE& value,
1818     std::string* buffer);
1819 
1820 TRUNKS_EXPORT TPM_RC Parse_TPM_AUTHORIZATION_SIZE(
1821     std::string* buffer,
1822     TPM_AUTHORIZATION_SIZE* value,
1823     std::string* value_bytes);
1824 
1825 TRUNKS_EXPORT TPM_RC Serialize_TPM_PARAMETER_SIZE(
1826     const TPM_PARAMETER_SIZE& value,
1827     std::string* buffer);
1828 
1829 TRUNKS_EXPORT TPM_RC Parse_TPM_PARAMETER_SIZE(
1830     std::string* buffer,
1831     TPM_PARAMETER_SIZE* value,
1832     std::string* value_bytes);
1833 
1834 TRUNKS_EXPORT TPM_RC Serialize_TPM_KEY_SIZE(
1835     const TPM_KEY_SIZE& value,
1836     std::string* buffer);
1837 
1838 TRUNKS_EXPORT TPM_RC Parse_TPM_KEY_SIZE(
1839     std::string* buffer,
1840     TPM_KEY_SIZE* value,
1841     std::string* value_bytes);
1842 
1843 TRUNKS_EXPORT TPM_RC Serialize_TPM_KEY_BITS(
1844     const TPM_KEY_BITS& value,
1845     std::string* buffer);
1846 
1847 TRUNKS_EXPORT TPM_RC Parse_TPM_KEY_BITS(
1848     std::string* buffer,
1849     TPM_KEY_BITS* value,
1850     std::string* value_bytes);
1851 
1852 TRUNKS_EXPORT TPM_RC Serialize_TPM_HANDLE(
1853     const TPM_HANDLE& value,
1854     std::string* buffer);
1855 
1856 TRUNKS_EXPORT TPM_RC Parse_TPM_HANDLE(
1857     std::string* buffer,
1858     TPM_HANDLE* value,
1859     std::string* value_bytes);
1860 
1861 TRUNKS_EXPORT TPM_RC Serialize_TPM2B_NONCE(
1862     const TPM2B_NONCE& value,
1863     std::string* buffer);
1864 
1865 TRUNKS_EXPORT TPM_RC Parse_TPM2B_NONCE(
1866     std::string* buffer,
1867     TPM2B_NONCE* value,
1868     std::string* value_bytes);
1869 
1870 TRUNKS_EXPORT TPM_RC Serialize_TPM2B_AUTH(
1871     const TPM2B_AUTH& value,
1872     std::string* buffer);
1873 
1874 TRUNKS_EXPORT TPM_RC Parse_TPM2B_AUTH(
1875     std::string* buffer,
1876     TPM2B_AUTH* value,
1877     std::string* value_bytes);
1878 
1879 TRUNKS_EXPORT TPM_RC Serialize_TPM2B_OPERAND(
1880     const TPM2B_OPERAND& value,
1881     std::string* buffer);
1882 
1883 TRUNKS_EXPORT TPM_RC Parse_TPM2B_OPERAND(
1884     std::string* buffer,
1885     TPM2B_OPERAND* value,
1886     std::string* value_bytes);
1887 
1888 TRUNKS_EXPORT TPM_RC Serialize_TPMS_SCHEME_HMAC(
1889     const TPMS_SCHEME_HMAC& value,
1890     std::string* buffer);
1891 
1892 TRUNKS_EXPORT TPM_RC Parse_TPMS_SCHEME_HMAC(
1893     std::string* buffer,
1894     TPMS_SCHEME_HMAC* value,
1895     std::string* value_bytes);
1896 
1897 TRUNKS_EXPORT TPM_RC Serialize_TPMS_SCHEME_RSASSA(
1898     const TPMS_SCHEME_RSASSA& value,
1899     std::string* buffer);
1900 
1901 TRUNKS_EXPORT TPM_RC Parse_TPMS_SCHEME_RSASSA(
1902     std::string* buffer,
1903     TPMS_SCHEME_RSASSA* value,
1904     std::string* value_bytes);
1905 
1906 TRUNKS_EXPORT TPM_RC Serialize_TPMS_SCHEME_RSAPSS(
1907     const TPMS_SCHEME_RSAPSS& value,
1908     std::string* buffer);
1909 
1910 TRUNKS_EXPORT TPM_RC Parse_TPMS_SCHEME_RSAPSS(
1911     std::string* buffer,
1912     TPMS_SCHEME_RSAPSS* value,
1913     std::string* value_bytes);
1914 
1915 TRUNKS_EXPORT TPM_RC Serialize_TPMS_SCHEME_ECDSA(
1916     const TPMS_SCHEME_ECDSA& value,
1917     std::string* buffer);
1918 
1919 TRUNKS_EXPORT TPM_RC Parse_TPMS_SCHEME_ECDSA(
1920     std::string* buffer,
1921     TPMS_SCHEME_ECDSA* value,
1922     std::string* value_bytes);
1923 
1924 TRUNKS_EXPORT TPM_RC Serialize_TPMS_SCHEME_SM2(
1925     const TPMS_SCHEME_SM2& value,
1926     std::string* buffer);
1927 
1928 TRUNKS_EXPORT TPM_RC Parse_TPMS_SCHEME_SM2(
1929     std::string* buffer,
1930     TPMS_SCHEME_SM2* value,
1931     std::string* value_bytes);
1932 
1933 TRUNKS_EXPORT TPM_RC Serialize_TPMS_SCHEME_ECSCHNORR(
1934     const TPMS_SCHEME_ECSCHNORR& value,
1935     std::string* buffer);
1936 
1937 TRUNKS_EXPORT TPM_RC Parse_TPMS_SCHEME_ECSCHNORR(
1938     std::string* buffer,
1939     TPMS_SCHEME_ECSCHNORR* value,
1940     std::string* value_bytes);
1941 
1942 TRUNKS_EXPORT TPM_RC Serialize_TPMI_YES_NO(
1943     const TPMI_YES_NO& value,
1944     std::string* buffer);
1945 
1946 TRUNKS_EXPORT TPM_RC Parse_TPMI_YES_NO(
1947     std::string* buffer,
1948     TPMI_YES_NO* value,
1949     std::string* value_bytes);
1950 
1951 TRUNKS_EXPORT TPM_RC Serialize_TPMI_DH_OBJECT(
1952     const TPMI_DH_OBJECT& value,
1953     std::string* buffer);
1954 
1955 TRUNKS_EXPORT TPM_RC Parse_TPMI_DH_OBJECT(
1956     std::string* buffer,
1957     TPMI_DH_OBJECT* value,
1958     std::string* value_bytes);
1959 
1960 TRUNKS_EXPORT TPM_RC Serialize_TPMI_DH_PERSISTENT(
1961     const TPMI_DH_PERSISTENT& value,
1962     std::string* buffer);
1963 
1964 TRUNKS_EXPORT TPM_RC Parse_TPMI_DH_PERSISTENT(
1965     std::string* buffer,
1966     TPMI_DH_PERSISTENT* value,
1967     std::string* value_bytes);
1968 
1969 TRUNKS_EXPORT TPM_RC Serialize_TPMI_DH_ENTITY(
1970     const TPMI_DH_ENTITY& value,
1971     std::string* buffer);
1972 
1973 TRUNKS_EXPORT TPM_RC Parse_TPMI_DH_ENTITY(
1974     std::string* buffer,
1975     TPMI_DH_ENTITY* value,
1976     std::string* value_bytes);
1977 
1978 TRUNKS_EXPORT TPM_RC Serialize_TPMI_DH_PCR(
1979     const TPMI_DH_PCR& value,
1980     std::string* buffer);
1981 
1982 TRUNKS_EXPORT TPM_RC Parse_TPMI_DH_PCR(
1983     std::string* buffer,
1984     TPMI_DH_PCR* value,
1985     std::string* value_bytes);
1986 
1987 TRUNKS_EXPORT TPM_RC Serialize_TPMI_SH_AUTH_SESSION(
1988     const TPMI_SH_AUTH_SESSION& value,
1989     std::string* buffer);
1990 
1991 TRUNKS_EXPORT TPM_RC Parse_TPMI_SH_AUTH_SESSION(
1992     std::string* buffer,
1993     TPMI_SH_AUTH_SESSION* value,
1994     std::string* value_bytes);
1995 
1996 TRUNKS_EXPORT TPM_RC Serialize_TPMI_SH_HMAC(
1997     const TPMI_SH_HMAC& value,
1998     std::string* buffer);
1999 
2000 TRUNKS_EXPORT TPM_RC Parse_TPMI_SH_HMAC(
2001     std::string* buffer,
2002     TPMI_SH_HMAC* value,
2003     std::string* value_bytes);
2004 
2005 TRUNKS_EXPORT TPM_RC Serialize_TPMI_SH_POLICY(
2006     const TPMI_SH_POLICY& value,
2007     std::string* buffer);
2008 
2009 TRUNKS_EXPORT TPM_RC Parse_TPMI_SH_POLICY(
2010     std::string* buffer,
2011     TPMI_SH_POLICY* value,
2012     std::string* value_bytes);
2013 
2014 TRUNKS_EXPORT TPM_RC Serialize_TPMI_DH_CONTEXT(
2015     const TPMI_DH_CONTEXT& value,
2016     std::string* buffer);
2017 
2018 TRUNKS_EXPORT TPM_RC Parse_TPMI_DH_CONTEXT(
2019     std::string* buffer,
2020     TPMI_DH_CONTEXT* value,
2021     std::string* value_bytes);
2022 
2023 TRUNKS_EXPORT TPM_RC Serialize_TPMI_RH_HIERARCHY(
2024     const TPMI_RH_HIERARCHY& value,
2025     std::string* buffer);
2026 
2027 TRUNKS_EXPORT TPM_RC Parse_TPMI_RH_HIERARCHY(
2028     std::string* buffer,
2029     TPMI_RH_HIERARCHY* value,
2030     std::string* value_bytes);
2031 
2032 TRUNKS_EXPORT TPM_RC Serialize_TPMI_RH_ENABLES(
2033     const TPMI_RH_ENABLES& value,
2034     std::string* buffer);
2035 
2036 TRUNKS_EXPORT TPM_RC Parse_TPMI_RH_ENABLES(
2037     std::string* buffer,
2038     TPMI_RH_ENABLES* value,
2039     std::string* value_bytes);
2040 
2041 TRUNKS_EXPORT TPM_RC Serialize_TPMI_RH_HIERARCHY_AUTH(
2042     const TPMI_RH_HIERARCHY_AUTH& value,
2043     std::string* buffer);
2044 
2045 TRUNKS_EXPORT TPM_RC Parse_TPMI_RH_HIERARCHY_AUTH(
2046     std::string* buffer,
2047     TPMI_RH_HIERARCHY_AUTH* value,
2048     std::string* value_bytes);
2049 
2050 TRUNKS_EXPORT TPM_RC Serialize_TPMI_RH_PLATFORM(
2051     const TPMI_RH_PLATFORM& value,
2052     std::string* buffer);
2053 
2054 TRUNKS_EXPORT TPM_RC Parse_TPMI_RH_PLATFORM(
2055     std::string* buffer,
2056     TPMI_RH_PLATFORM* value,
2057     std::string* value_bytes);
2058 
2059 TRUNKS_EXPORT TPM_RC Serialize_TPMI_RH_OWNER(
2060     const TPMI_RH_OWNER& value,
2061     std::string* buffer);
2062 
2063 TRUNKS_EXPORT TPM_RC Parse_TPMI_RH_OWNER(
2064     std::string* buffer,
2065     TPMI_RH_OWNER* value,
2066     std::string* value_bytes);
2067 
2068 TRUNKS_EXPORT TPM_RC Serialize_TPMI_RH_ENDORSEMENT(
2069     const TPMI_RH_ENDORSEMENT& value,
2070     std::string* buffer);
2071 
2072 TRUNKS_EXPORT TPM_RC Parse_TPMI_RH_ENDORSEMENT(
2073     std::string* buffer,
2074     TPMI_RH_ENDORSEMENT* value,
2075     std::string* value_bytes);
2076 
2077 TRUNKS_EXPORT TPM_RC Serialize_TPMI_RH_PROVISION(
2078     const TPMI_RH_PROVISION& value,
2079     std::string* buffer);
2080 
2081 TRUNKS_EXPORT TPM_RC Parse_TPMI_RH_PROVISION(
2082     std::string* buffer,
2083     TPMI_RH_PROVISION* value,
2084     std::string* value_bytes);
2085 
2086 TRUNKS_EXPORT TPM_RC Serialize_TPMI_RH_CLEAR(
2087     const TPMI_RH_CLEAR& value,
2088     std::string* buffer);
2089 
2090 TRUNKS_EXPORT TPM_RC Parse_TPMI_RH_CLEAR(
2091     std::string* buffer,
2092     TPMI_RH_CLEAR* value,
2093     std::string* value_bytes);
2094 
2095 TRUNKS_EXPORT TPM_RC Serialize_TPMI_RH_NV_AUTH(
2096     const TPMI_RH_NV_AUTH& value,
2097     std::string* buffer);
2098 
2099 TRUNKS_EXPORT TPM_RC Parse_TPMI_RH_NV_AUTH(
2100     std::string* buffer,
2101     TPMI_RH_NV_AUTH* value,
2102     std::string* value_bytes);
2103 
2104 TRUNKS_EXPORT TPM_RC Serialize_TPMI_RH_LOCKOUT(
2105     const TPMI_RH_LOCKOUT& value,
2106     std::string* buffer);
2107 
2108 TRUNKS_EXPORT TPM_RC Parse_TPMI_RH_LOCKOUT(
2109     std::string* buffer,
2110     TPMI_RH_LOCKOUT* value,
2111     std::string* value_bytes);
2112 
2113 TRUNKS_EXPORT TPM_RC Serialize_TPMI_RH_NV_INDEX(
2114     const TPMI_RH_NV_INDEX& value,
2115     std::string* buffer);
2116 
2117 TRUNKS_EXPORT TPM_RC Parse_TPMI_RH_NV_INDEX(
2118     std::string* buffer,
2119     TPMI_RH_NV_INDEX* value,
2120     std::string* value_bytes);
2121 
2122 TRUNKS_EXPORT TPM_RC Serialize_TPMI_ALG_HASH(
2123     const TPMI_ALG_HASH& value,
2124     std::string* buffer);
2125 
2126 TRUNKS_EXPORT TPM_RC Parse_TPMI_ALG_HASH(
2127     std::string* buffer,
2128     TPMI_ALG_HASH* value,
2129     std::string* value_bytes);
2130 
2131 TRUNKS_EXPORT TPM_RC Serialize_TPMI_ALG_ASYM(
2132     const TPMI_ALG_ASYM& value,
2133     std::string* buffer);
2134 
2135 TRUNKS_EXPORT TPM_RC Parse_TPMI_ALG_ASYM(
2136     std::string* buffer,
2137     TPMI_ALG_ASYM* value,
2138     std::string* value_bytes);
2139 
2140 TRUNKS_EXPORT TPM_RC Serialize_TPMI_ALG_SYM(
2141     const TPMI_ALG_SYM& value,
2142     std::string* buffer);
2143 
2144 TRUNKS_EXPORT TPM_RC Parse_TPMI_ALG_SYM(
2145     std::string* buffer,
2146     TPMI_ALG_SYM* value,
2147     std::string* value_bytes);
2148 
2149 TRUNKS_EXPORT TPM_RC Serialize_TPMI_ALG_SYM_OBJECT(
2150     const TPMI_ALG_SYM_OBJECT& value,
2151     std::string* buffer);
2152 
2153 TRUNKS_EXPORT TPM_RC Parse_TPMI_ALG_SYM_OBJECT(
2154     std::string* buffer,
2155     TPMI_ALG_SYM_OBJECT* value,
2156     std::string* value_bytes);
2157 
2158 TRUNKS_EXPORT TPM_RC Serialize_TPMI_ALG_SYM_MODE(
2159     const TPMI_ALG_SYM_MODE& value,
2160     std::string* buffer);
2161 
2162 TRUNKS_EXPORT TPM_RC Parse_TPMI_ALG_SYM_MODE(
2163     std::string* buffer,
2164     TPMI_ALG_SYM_MODE* value,
2165     std::string* value_bytes);
2166 
2167 TRUNKS_EXPORT TPM_RC Serialize_TPMI_ALG_KDF(
2168     const TPMI_ALG_KDF& value,
2169     std::string* buffer);
2170 
2171 TRUNKS_EXPORT TPM_RC Parse_TPMI_ALG_KDF(
2172     std::string* buffer,
2173     TPMI_ALG_KDF* value,
2174     std::string* value_bytes);
2175 
2176 TRUNKS_EXPORT TPM_RC Serialize_TPMI_ALG_SIG_SCHEME(
2177     const TPMI_ALG_SIG_SCHEME& value,
2178     std::string* buffer);
2179 
2180 TRUNKS_EXPORT TPM_RC Parse_TPMI_ALG_SIG_SCHEME(
2181     std::string* buffer,
2182     TPMI_ALG_SIG_SCHEME* value,
2183     std::string* value_bytes);
2184 
2185 TRUNKS_EXPORT TPM_RC Serialize_TPMI_ECC_KEY_EXCHANGE(
2186     const TPMI_ECC_KEY_EXCHANGE& value,
2187     std::string* buffer);
2188 
2189 TRUNKS_EXPORT TPM_RC Parse_TPMI_ECC_KEY_EXCHANGE(
2190     std::string* buffer,
2191     TPMI_ECC_KEY_EXCHANGE* value,
2192     std::string* value_bytes);
2193 
2194 TRUNKS_EXPORT TPM_RC Serialize_TPMI_ST_COMMAND_TAG(
2195     const TPMI_ST_COMMAND_TAG& value,
2196     std::string* buffer);
2197 
2198 TRUNKS_EXPORT TPM_RC Parse_TPMI_ST_COMMAND_TAG(
2199     std::string* buffer,
2200     TPMI_ST_COMMAND_TAG* value,
2201     std::string* value_bytes);
2202 
2203 TRUNKS_EXPORT TPM_RC Serialize_TPMI_ST_ATTEST(
2204     const TPMI_ST_ATTEST& value,
2205     std::string* buffer);
2206 
2207 TRUNKS_EXPORT TPM_RC Parse_TPMI_ST_ATTEST(
2208     std::string* buffer,
2209     TPMI_ST_ATTEST* value,
2210     std::string* value_bytes);
2211 
2212 TRUNKS_EXPORT TPM_RC Serialize_TPMI_AES_KEY_BITS(
2213     const TPMI_AES_KEY_BITS& value,
2214     std::string* buffer);
2215 
2216 TRUNKS_EXPORT TPM_RC Parse_TPMI_AES_KEY_BITS(
2217     std::string* buffer,
2218     TPMI_AES_KEY_BITS* value,
2219     std::string* value_bytes);
2220 
2221 TRUNKS_EXPORT TPM_RC Serialize_TPMI_SM4_KEY_BITS(
2222     const TPMI_SM4_KEY_BITS& value,
2223     std::string* buffer);
2224 
2225 TRUNKS_EXPORT TPM_RC Parse_TPMI_SM4_KEY_BITS(
2226     std::string* buffer,
2227     TPMI_SM4_KEY_BITS* value,
2228     std::string* value_bytes);
2229 
2230 TRUNKS_EXPORT TPM_RC Serialize_TPMI_ALG_KEYEDHASH_SCHEME(
2231     const TPMI_ALG_KEYEDHASH_SCHEME& value,
2232     std::string* buffer);
2233 
2234 TRUNKS_EXPORT TPM_RC Parse_TPMI_ALG_KEYEDHASH_SCHEME(
2235     std::string* buffer,
2236     TPMI_ALG_KEYEDHASH_SCHEME* value,
2237     std::string* value_bytes);
2238 
2239 TRUNKS_EXPORT TPM_RC Serialize_TPMI_ALG_ASYM_SCHEME(
2240     const TPMI_ALG_ASYM_SCHEME& value,
2241     std::string* buffer);
2242 
2243 TRUNKS_EXPORT TPM_RC Parse_TPMI_ALG_ASYM_SCHEME(
2244     std::string* buffer,
2245     TPMI_ALG_ASYM_SCHEME* value,
2246     std::string* value_bytes);
2247 
2248 TRUNKS_EXPORT TPM_RC Serialize_TPMI_ALG_RSA_SCHEME(
2249     const TPMI_ALG_RSA_SCHEME& value,
2250     std::string* buffer);
2251 
2252 TRUNKS_EXPORT TPM_RC Parse_TPMI_ALG_RSA_SCHEME(
2253     std::string* buffer,
2254     TPMI_ALG_RSA_SCHEME* value,
2255     std::string* value_bytes);
2256 
2257 TRUNKS_EXPORT TPM_RC Serialize_TPMI_ALG_RSA_DECRYPT(
2258     const TPMI_ALG_RSA_DECRYPT& value,
2259     std::string* buffer);
2260 
2261 TRUNKS_EXPORT TPM_RC Parse_TPMI_ALG_RSA_DECRYPT(
2262     std::string* buffer,
2263     TPMI_ALG_RSA_DECRYPT* value,
2264     std::string* value_bytes);
2265 
2266 TRUNKS_EXPORT TPM_RC Serialize_TPMI_RSA_KEY_BITS(
2267     const TPMI_RSA_KEY_BITS& value,
2268     std::string* buffer);
2269 
2270 TRUNKS_EXPORT TPM_RC Parse_TPMI_RSA_KEY_BITS(
2271     std::string* buffer,
2272     TPMI_RSA_KEY_BITS* value,
2273     std::string* value_bytes);
2274 
2275 TRUNKS_EXPORT TPM_RC Serialize_TPMI_ALG_ECC_SCHEME(
2276     const TPMI_ALG_ECC_SCHEME& value,
2277     std::string* buffer);
2278 
2279 TRUNKS_EXPORT TPM_RC Parse_TPMI_ALG_ECC_SCHEME(
2280     std::string* buffer,
2281     TPMI_ALG_ECC_SCHEME* value,
2282     std::string* value_bytes);
2283 
2284 TRUNKS_EXPORT TPM_RC Serialize_TPMI_ECC_CURVE(
2285     const TPMI_ECC_CURVE& value,
2286     std::string* buffer);
2287 
2288 TRUNKS_EXPORT TPM_RC Parse_TPMI_ECC_CURVE(
2289     std::string* buffer,
2290     TPMI_ECC_CURVE* value,
2291     std::string* value_bytes);
2292 
2293 TRUNKS_EXPORT TPM_RC Serialize_TPMI_ALG_PUBLIC(
2294     const TPMI_ALG_PUBLIC& value,
2295     std::string* buffer);
2296 
2297 TRUNKS_EXPORT TPM_RC Parse_TPMI_ALG_PUBLIC(
2298     std::string* buffer,
2299     TPMI_ALG_PUBLIC* value,
2300     std::string* value_bytes);
2301 
2302 TRUNKS_EXPORT TPM_RC Serialize_TPMA_ALGORITHM(
2303     const TPMA_ALGORITHM& value,
2304     std::string* buffer);
2305 
2306 TRUNKS_EXPORT TPM_RC Parse_TPMA_ALGORITHM(
2307     std::string* buffer,
2308     TPMA_ALGORITHM* value,
2309     std::string* value_bytes);
2310 
2311 TRUNKS_EXPORT TPM_RC Serialize_TPMA_OBJECT(
2312     const TPMA_OBJECT& value,
2313     std::string* buffer);
2314 
2315 TRUNKS_EXPORT TPM_RC Parse_TPMA_OBJECT(
2316     std::string* buffer,
2317     TPMA_OBJECT* value,
2318     std::string* value_bytes);
2319 
2320 TRUNKS_EXPORT TPM_RC Serialize_TPMA_SESSION(
2321     const TPMA_SESSION& value,
2322     std::string* buffer);
2323 
2324 TRUNKS_EXPORT TPM_RC Parse_TPMA_SESSION(
2325     std::string* buffer,
2326     TPMA_SESSION* value,
2327     std::string* value_bytes);
2328 
2329 TRUNKS_EXPORT TPM_RC Serialize_TPMA_LOCALITY(
2330     const TPMA_LOCALITY& value,
2331     std::string* buffer);
2332 
2333 TRUNKS_EXPORT TPM_RC Parse_TPMA_LOCALITY(
2334     std::string* buffer,
2335     TPMA_LOCALITY* value,
2336     std::string* value_bytes);
2337 
2338 TRUNKS_EXPORT TPM_RC Serialize_TPMA_PERMANENT(
2339     const TPMA_PERMANENT& value,
2340     std::string* buffer);
2341 
2342 TRUNKS_EXPORT TPM_RC Parse_TPMA_PERMANENT(
2343     std::string* buffer,
2344     TPMA_PERMANENT* value,
2345     std::string* value_bytes);
2346 
2347 TRUNKS_EXPORT TPM_RC Serialize_TPMA_STARTUP_CLEAR(
2348     const TPMA_STARTUP_CLEAR& value,
2349     std::string* buffer);
2350 
2351 TRUNKS_EXPORT TPM_RC Parse_TPMA_STARTUP_CLEAR(
2352     std::string* buffer,
2353     TPMA_STARTUP_CLEAR* value,
2354     std::string* value_bytes);
2355 
2356 TRUNKS_EXPORT TPM_RC Serialize_TPMA_MEMORY(
2357     const TPMA_MEMORY& value,
2358     std::string* buffer);
2359 
2360 TRUNKS_EXPORT TPM_RC Parse_TPMA_MEMORY(
2361     std::string* buffer,
2362     TPMA_MEMORY* value,
2363     std::string* value_bytes);
2364 
2365 TRUNKS_EXPORT TPM_RC Serialize_TPMA_CC(
2366     const TPMA_CC& value,
2367     std::string* buffer);
2368 
2369 TRUNKS_EXPORT TPM_RC Parse_TPMA_CC(
2370     std::string* buffer,
2371     TPMA_CC* value,
2372     std::string* value_bytes);
2373 
2374 TRUNKS_EXPORT TPM_RC Serialize_TPM_NV_INDEX(
2375     const TPM_NV_INDEX& value,
2376     std::string* buffer);
2377 
2378 TRUNKS_EXPORT TPM_RC Parse_TPM_NV_INDEX(
2379     std::string* buffer,
2380     TPM_NV_INDEX* value,
2381     std::string* value_bytes);
2382 
2383 TRUNKS_EXPORT TPM_RC Serialize_TPMA_NV(
2384     const TPMA_NV& value,
2385     std::string* buffer);
2386 
2387 TRUNKS_EXPORT TPM_RC Parse_TPMA_NV(
2388     std::string* buffer,
2389     TPMA_NV* value,
2390     std::string* value_bytes);
2391 
2392 TRUNKS_EXPORT TPM_RC Serialize_TPM_SPEC(
2393     const TPM_SPEC& value,
2394     std::string* buffer);
2395 
2396 TRUNKS_EXPORT TPM_RC Parse_TPM_SPEC(
2397     std::string* buffer,
2398     TPM_SPEC* value,
2399     std::string* value_bytes);
2400 
2401 TRUNKS_EXPORT TPM_RC Serialize_TPM_GENERATED(
2402     const TPM_GENERATED& value,
2403     std::string* buffer);
2404 
2405 TRUNKS_EXPORT TPM_RC Parse_TPM_GENERATED(
2406     std::string* buffer,
2407     TPM_GENERATED* value,
2408     std::string* value_bytes);
2409 
2410 TRUNKS_EXPORT TPM_RC Serialize_TPM_ALG_ID(
2411     const TPM_ALG_ID& value,
2412     std::string* buffer);
2413 
2414 TRUNKS_EXPORT TPM_RC Parse_TPM_ALG_ID(
2415     std::string* buffer,
2416     TPM_ALG_ID* value,
2417     std::string* value_bytes);
2418 
2419 TRUNKS_EXPORT TPM_RC Serialize_TPM_ECC_CURVE(
2420     const TPM_ECC_CURVE& value,
2421     std::string* buffer);
2422 
2423 TRUNKS_EXPORT TPM_RC Parse_TPM_ECC_CURVE(
2424     std::string* buffer,
2425     TPM_ECC_CURVE* value,
2426     std::string* value_bytes);
2427 
2428 TRUNKS_EXPORT TPM_RC Serialize_TPM_CC(
2429     const TPM_CC& value,
2430     std::string* buffer);
2431 
2432 TRUNKS_EXPORT TPM_RC Parse_TPM_CC(
2433     std::string* buffer,
2434     TPM_CC* value,
2435     std::string* value_bytes);
2436 
2437 TRUNKS_EXPORT TPM_RC Serialize_TPM_RC(
2438     const TPM_RC& value,
2439     std::string* buffer);
2440 
2441 TRUNKS_EXPORT TPM_RC Parse_TPM_RC(
2442     std::string* buffer,
2443     TPM_RC* value,
2444     std::string* value_bytes);
2445 
2446 TRUNKS_EXPORT TPM_RC Serialize_TPM_CLOCK_ADJUST(
2447     const TPM_CLOCK_ADJUST& value,
2448     std::string* buffer);
2449 
2450 TRUNKS_EXPORT TPM_RC Parse_TPM_CLOCK_ADJUST(
2451     std::string* buffer,
2452     TPM_CLOCK_ADJUST* value,
2453     std::string* value_bytes);
2454 
2455 TRUNKS_EXPORT TPM_RC Serialize_TPM_EO(
2456     const TPM_EO& value,
2457     std::string* buffer);
2458 
2459 TRUNKS_EXPORT TPM_RC Parse_TPM_EO(
2460     std::string* buffer,
2461     TPM_EO* value,
2462     std::string* value_bytes);
2463 
2464 TRUNKS_EXPORT TPM_RC Serialize_TPM_ST(
2465     const TPM_ST& value,
2466     std::string* buffer);
2467 
2468 TRUNKS_EXPORT TPM_RC Parse_TPM_ST(
2469     std::string* buffer,
2470     TPM_ST* value,
2471     std::string* value_bytes);
2472 
2473 TRUNKS_EXPORT TPM_RC Serialize_TPM_SU(
2474     const TPM_SU& value,
2475     std::string* buffer);
2476 
2477 TRUNKS_EXPORT TPM_RC Parse_TPM_SU(
2478     std::string* buffer,
2479     TPM_SU* value,
2480     std::string* value_bytes);
2481 
2482 TRUNKS_EXPORT TPM_RC Serialize_TPM_SE(
2483     const TPM_SE& value,
2484     std::string* buffer);
2485 
2486 TRUNKS_EXPORT TPM_RC Parse_TPM_SE(
2487     std::string* buffer,
2488     TPM_SE* value,
2489     std::string* value_bytes);
2490 
2491 TRUNKS_EXPORT TPM_RC Serialize_TPM_CAP(
2492     const TPM_CAP& value,
2493     std::string* buffer);
2494 
2495 TRUNKS_EXPORT TPM_RC Parse_TPM_CAP(
2496     std::string* buffer,
2497     TPM_CAP* value,
2498     std::string* value_bytes);
2499 
2500 TRUNKS_EXPORT TPM_RC Serialize_TPM_PT(
2501     const TPM_PT& value,
2502     std::string* buffer);
2503 
2504 TRUNKS_EXPORT TPM_RC Parse_TPM_PT(
2505     std::string* buffer,
2506     TPM_PT* value,
2507     std::string* value_bytes);
2508 
2509 TRUNKS_EXPORT TPM_RC Serialize_TPM_PT_PCR(
2510     const TPM_PT_PCR& value,
2511     std::string* buffer);
2512 
2513 TRUNKS_EXPORT TPM_RC Parse_TPM_PT_PCR(
2514     std::string* buffer,
2515     TPM_PT_PCR* value,
2516     std::string* value_bytes);
2517 
2518 TRUNKS_EXPORT TPM_RC Serialize_TPM_PS(
2519     const TPM_PS& value,
2520     std::string* buffer);
2521 
2522 TRUNKS_EXPORT TPM_RC Parse_TPM_PS(
2523     std::string* buffer,
2524     TPM_PS* value,
2525     std::string* value_bytes);
2526 
2527 TRUNKS_EXPORT TPM_RC Serialize_TPM_HT(
2528     const TPM_HT& value,
2529     std::string* buffer);
2530 
2531 TRUNKS_EXPORT TPM_RC Parse_TPM_HT(
2532     std::string* buffer,
2533     TPM_HT* value,
2534     std::string* value_bytes);
2535 
2536 TRUNKS_EXPORT TPM_RC Serialize_TPM_RH(
2537     const TPM_RH& value,
2538     std::string* buffer);
2539 
2540 TRUNKS_EXPORT TPM_RC Parse_TPM_RH(
2541     std::string* buffer,
2542     TPM_RH* value,
2543     std::string* value_bytes);
2544 
2545 TRUNKS_EXPORT TPM_RC Serialize_TPM_HC(
2546     const TPM_HC& value,
2547     std::string* buffer);
2548 
2549 TRUNKS_EXPORT TPM_RC Parse_TPM_HC(
2550     std::string* buffer,
2551     TPM_HC* value,
2552     std::string* value_bytes);
2553 
2554 TRUNKS_EXPORT TPM_RC Serialize_TPMS_ALGORITHM_DESCRIPTION(
2555     const TPMS_ALGORITHM_DESCRIPTION& value,
2556     std::string* buffer);
2557 
2558 TRUNKS_EXPORT TPM_RC Parse_TPMS_ALGORITHM_DESCRIPTION(
2559     std::string* buffer,
2560     TPMS_ALGORITHM_DESCRIPTION* value,
2561     std::string* value_bytes);
2562 
2563 TRUNKS_EXPORT TPM_RC Serialize_TPMT_HA(
2564     const TPMT_HA& value,
2565     std::string* buffer);
2566 
2567 TRUNKS_EXPORT TPM_RC Parse_TPMT_HA(
2568     std::string* buffer,
2569     TPMT_HA* value,
2570     std::string* value_bytes);
2571 
2572 TRUNKS_EXPORT TPM_RC Serialize_TPM2B_DIGEST(
2573     const TPM2B_DIGEST& value,
2574     std::string* buffer);
2575 
2576 TRUNKS_EXPORT TPM_RC Parse_TPM2B_DIGEST(
2577     std::string* buffer,
2578     TPM2B_DIGEST* value,
2579     std::string* value_bytes);
2580 
2581 TRUNKS_EXPORT TPM2B_DIGEST Make_TPM2B_DIGEST(
2582     const std::string& bytes);
2583 TRUNKS_EXPORT std::string StringFrom_TPM2B_DIGEST(
2584     const TPM2B_DIGEST& tpm2b);
2585 
2586 TRUNKS_EXPORT TPM_RC Serialize_TPM2B_DATA(
2587     const TPM2B_DATA& value,
2588     std::string* buffer);
2589 
2590 TRUNKS_EXPORT TPM_RC Parse_TPM2B_DATA(
2591     std::string* buffer,
2592     TPM2B_DATA* value,
2593     std::string* value_bytes);
2594 
2595 TRUNKS_EXPORT TPM2B_DATA Make_TPM2B_DATA(
2596     const std::string& bytes);
2597 TRUNKS_EXPORT std::string StringFrom_TPM2B_DATA(
2598     const TPM2B_DATA& tpm2b);
2599 
2600 TRUNKS_EXPORT TPM_RC Serialize_TPM2B_EVENT(
2601     const TPM2B_EVENT& value,
2602     std::string* buffer);
2603 
2604 TRUNKS_EXPORT TPM_RC Parse_TPM2B_EVENT(
2605     std::string* buffer,
2606     TPM2B_EVENT* value,
2607     std::string* value_bytes);
2608 
2609 TRUNKS_EXPORT TPM2B_EVENT Make_TPM2B_EVENT(
2610     const std::string& bytes);
2611 TRUNKS_EXPORT std::string StringFrom_TPM2B_EVENT(
2612     const TPM2B_EVENT& tpm2b);
2613 
2614 TRUNKS_EXPORT TPM_RC Serialize_TPM2B_MAX_BUFFER(
2615     const TPM2B_MAX_BUFFER& value,
2616     std::string* buffer);
2617 
2618 TRUNKS_EXPORT TPM_RC Parse_TPM2B_MAX_BUFFER(
2619     std::string* buffer,
2620     TPM2B_MAX_BUFFER* value,
2621     std::string* value_bytes);
2622 
2623 TRUNKS_EXPORT TPM2B_MAX_BUFFER Make_TPM2B_MAX_BUFFER(
2624     const std::string& bytes);
2625 TRUNKS_EXPORT std::string StringFrom_TPM2B_MAX_BUFFER(
2626     const TPM2B_MAX_BUFFER& tpm2b);
2627 
2628 TRUNKS_EXPORT TPM_RC Serialize_TPM2B_MAX_NV_BUFFER(
2629     const TPM2B_MAX_NV_BUFFER& value,
2630     std::string* buffer);
2631 
2632 TRUNKS_EXPORT TPM_RC Parse_TPM2B_MAX_NV_BUFFER(
2633     std::string* buffer,
2634     TPM2B_MAX_NV_BUFFER* value,
2635     std::string* value_bytes);
2636 
2637 TRUNKS_EXPORT TPM2B_MAX_NV_BUFFER Make_TPM2B_MAX_NV_BUFFER(
2638     const std::string& bytes);
2639 TRUNKS_EXPORT std::string StringFrom_TPM2B_MAX_NV_BUFFER(
2640     const TPM2B_MAX_NV_BUFFER& tpm2b);
2641 
2642 TRUNKS_EXPORT TPM_RC Serialize_TPM2B_TIMEOUT(
2643     const TPM2B_TIMEOUT& value,
2644     std::string* buffer);
2645 
2646 TRUNKS_EXPORT TPM_RC Parse_TPM2B_TIMEOUT(
2647     std::string* buffer,
2648     TPM2B_TIMEOUT* value,
2649     std::string* value_bytes);
2650 
2651 TRUNKS_EXPORT TPM2B_TIMEOUT Make_TPM2B_TIMEOUT(
2652     const std::string& bytes);
2653 TRUNKS_EXPORT std::string StringFrom_TPM2B_TIMEOUT(
2654     const TPM2B_TIMEOUT& tpm2b);
2655 
2656 TRUNKS_EXPORT TPM_RC Serialize_TPM2B_IV(
2657     const TPM2B_IV& value,
2658     std::string* buffer);
2659 
2660 TRUNKS_EXPORT TPM_RC Parse_TPM2B_IV(
2661     std::string* buffer,
2662     TPM2B_IV* value,
2663     std::string* value_bytes);
2664 
2665 TRUNKS_EXPORT TPM2B_IV Make_TPM2B_IV(
2666     const std::string& bytes);
2667 TRUNKS_EXPORT std::string StringFrom_TPM2B_IV(
2668     const TPM2B_IV& tpm2b);
2669 
2670 TRUNKS_EXPORT TPM_RC Serialize_TPM2B_NAME(
2671     const TPM2B_NAME& value,
2672     std::string* buffer);
2673 
2674 TRUNKS_EXPORT TPM_RC Parse_TPM2B_NAME(
2675     std::string* buffer,
2676     TPM2B_NAME* value,
2677     std::string* value_bytes);
2678 
2679 TRUNKS_EXPORT TPM2B_NAME Make_TPM2B_NAME(
2680     const std::string& bytes);
2681 TRUNKS_EXPORT std::string StringFrom_TPM2B_NAME(
2682     const TPM2B_NAME& tpm2b);
2683 
2684 TRUNKS_EXPORT TPM_RC Serialize_TPMS_PCR_SELECT(
2685     const TPMS_PCR_SELECT& value,
2686     std::string* buffer);
2687 
2688 TRUNKS_EXPORT TPM_RC Parse_TPMS_PCR_SELECT(
2689     std::string* buffer,
2690     TPMS_PCR_SELECT* value,
2691     std::string* value_bytes);
2692 
2693 TRUNKS_EXPORT TPM_RC Serialize_TPMS_PCR_SELECTION(
2694     const TPMS_PCR_SELECTION& value,
2695     std::string* buffer);
2696 
2697 TRUNKS_EXPORT TPM_RC Parse_TPMS_PCR_SELECTION(
2698     std::string* buffer,
2699     TPMS_PCR_SELECTION* value,
2700     std::string* value_bytes);
2701 
2702 TRUNKS_EXPORT TPM_RC Serialize_TPMT_TK_CREATION(
2703     const TPMT_TK_CREATION& value,
2704     std::string* buffer);
2705 
2706 TRUNKS_EXPORT TPM_RC Parse_TPMT_TK_CREATION(
2707     std::string* buffer,
2708     TPMT_TK_CREATION* value,
2709     std::string* value_bytes);
2710 
2711 TRUNKS_EXPORT TPM_RC Serialize_TPMT_TK_VERIFIED(
2712     const TPMT_TK_VERIFIED& value,
2713     std::string* buffer);
2714 
2715 TRUNKS_EXPORT TPM_RC Parse_TPMT_TK_VERIFIED(
2716     std::string* buffer,
2717     TPMT_TK_VERIFIED* value,
2718     std::string* value_bytes);
2719 
2720 TRUNKS_EXPORT TPM_RC Serialize_TPMT_TK_AUTH(
2721     const TPMT_TK_AUTH& value,
2722     std::string* buffer);
2723 
2724 TRUNKS_EXPORT TPM_RC Parse_TPMT_TK_AUTH(
2725     std::string* buffer,
2726     TPMT_TK_AUTH* value,
2727     std::string* value_bytes);
2728 
2729 TRUNKS_EXPORT TPM_RC Serialize_TPMT_TK_HASHCHECK(
2730     const TPMT_TK_HASHCHECK& value,
2731     std::string* buffer);
2732 
2733 TRUNKS_EXPORT TPM_RC Parse_TPMT_TK_HASHCHECK(
2734     std::string* buffer,
2735     TPMT_TK_HASHCHECK* value,
2736     std::string* value_bytes);
2737 
2738 TRUNKS_EXPORT TPM_RC Serialize_TPMS_ALG_PROPERTY(
2739     const TPMS_ALG_PROPERTY& value,
2740     std::string* buffer);
2741 
2742 TRUNKS_EXPORT TPM_RC Parse_TPMS_ALG_PROPERTY(
2743     std::string* buffer,
2744     TPMS_ALG_PROPERTY* value,
2745     std::string* value_bytes);
2746 
2747 TRUNKS_EXPORT TPM_RC Serialize_TPMS_TAGGED_PROPERTY(
2748     const TPMS_TAGGED_PROPERTY& value,
2749     std::string* buffer);
2750 
2751 TRUNKS_EXPORT TPM_RC Parse_TPMS_TAGGED_PROPERTY(
2752     std::string* buffer,
2753     TPMS_TAGGED_PROPERTY* value,
2754     std::string* value_bytes);
2755 
2756 TRUNKS_EXPORT TPM_RC Serialize_TPMS_TAGGED_PCR_SELECT(
2757     const TPMS_TAGGED_PCR_SELECT& value,
2758     std::string* buffer);
2759 
2760 TRUNKS_EXPORT TPM_RC Parse_TPMS_TAGGED_PCR_SELECT(
2761     std::string* buffer,
2762     TPMS_TAGGED_PCR_SELECT* value,
2763     std::string* value_bytes);
2764 
2765 TRUNKS_EXPORT TPM_RC Serialize_TPML_CC(
2766     const TPML_CC& value,
2767     std::string* buffer);
2768 
2769 TRUNKS_EXPORT TPM_RC Parse_TPML_CC(
2770     std::string* buffer,
2771     TPML_CC* value,
2772     std::string* value_bytes);
2773 
2774 TRUNKS_EXPORT TPM_RC Serialize_TPML_CCA(
2775     const TPML_CCA& value,
2776     std::string* buffer);
2777 
2778 TRUNKS_EXPORT TPM_RC Parse_TPML_CCA(
2779     std::string* buffer,
2780     TPML_CCA* value,
2781     std::string* value_bytes);
2782 
2783 TRUNKS_EXPORT TPM_RC Serialize_TPML_ALG(
2784     const TPML_ALG& value,
2785     std::string* buffer);
2786 
2787 TRUNKS_EXPORT TPM_RC Parse_TPML_ALG(
2788     std::string* buffer,
2789     TPML_ALG* value,
2790     std::string* value_bytes);
2791 
2792 TRUNKS_EXPORT TPM_RC Serialize_TPML_HANDLE(
2793     const TPML_HANDLE& value,
2794     std::string* buffer);
2795 
2796 TRUNKS_EXPORT TPM_RC Parse_TPML_HANDLE(
2797     std::string* buffer,
2798     TPML_HANDLE* value,
2799     std::string* value_bytes);
2800 
2801 TRUNKS_EXPORT TPM_RC Serialize_TPML_DIGEST(
2802     const TPML_DIGEST& value,
2803     std::string* buffer);
2804 
2805 TRUNKS_EXPORT TPM_RC Parse_TPML_DIGEST(
2806     std::string* buffer,
2807     TPML_DIGEST* value,
2808     std::string* value_bytes);
2809 
2810 TRUNKS_EXPORT TPM_RC Serialize_TPML_DIGEST_VALUES(
2811     const TPML_DIGEST_VALUES& value,
2812     std::string* buffer);
2813 
2814 TRUNKS_EXPORT TPM_RC Parse_TPML_DIGEST_VALUES(
2815     std::string* buffer,
2816     TPML_DIGEST_VALUES* value,
2817     std::string* value_bytes);
2818 
2819 TRUNKS_EXPORT TPM_RC Serialize_TPM2B_DIGEST_VALUES(
2820     const TPM2B_DIGEST_VALUES& value,
2821     std::string* buffer);
2822 
2823 TRUNKS_EXPORT TPM_RC Parse_TPM2B_DIGEST_VALUES(
2824     std::string* buffer,
2825     TPM2B_DIGEST_VALUES* value,
2826     std::string* value_bytes);
2827 
2828 TRUNKS_EXPORT TPM2B_DIGEST_VALUES Make_TPM2B_DIGEST_VALUES(
2829     const std::string& bytes);
2830 TRUNKS_EXPORT std::string StringFrom_TPM2B_DIGEST_VALUES(
2831     const TPM2B_DIGEST_VALUES& tpm2b);
2832 
2833 TRUNKS_EXPORT TPM_RC Serialize_TPML_PCR_SELECTION(
2834     const TPML_PCR_SELECTION& value,
2835     std::string* buffer);
2836 
2837 TRUNKS_EXPORT TPM_RC Parse_TPML_PCR_SELECTION(
2838     std::string* buffer,
2839     TPML_PCR_SELECTION* value,
2840     std::string* value_bytes);
2841 
2842 TRUNKS_EXPORT TPM_RC Serialize_TPML_ALG_PROPERTY(
2843     const TPML_ALG_PROPERTY& value,
2844     std::string* buffer);
2845 
2846 TRUNKS_EXPORT TPM_RC Parse_TPML_ALG_PROPERTY(
2847     std::string* buffer,
2848     TPML_ALG_PROPERTY* value,
2849     std::string* value_bytes);
2850 
2851 TRUNKS_EXPORT TPM_RC Serialize_TPML_TAGGED_TPM_PROPERTY(
2852     const TPML_TAGGED_TPM_PROPERTY& value,
2853     std::string* buffer);
2854 
2855 TRUNKS_EXPORT TPM_RC Parse_TPML_TAGGED_TPM_PROPERTY(
2856     std::string* buffer,
2857     TPML_TAGGED_TPM_PROPERTY* value,
2858     std::string* value_bytes);
2859 
2860 TRUNKS_EXPORT TPM_RC Serialize_TPML_TAGGED_PCR_PROPERTY(
2861     const TPML_TAGGED_PCR_PROPERTY& value,
2862     std::string* buffer);
2863 
2864 TRUNKS_EXPORT TPM_RC Parse_TPML_TAGGED_PCR_PROPERTY(
2865     std::string* buffer,
2866     TPML_TAGGED_PCR_PROPERTY* value,
2867     std::string* value_bytes);
2868 
2869 TRUNKS_EXPORT TPM_RC Serialize_TPML_ECC_CURVE(
2870     const TPML_ECC_CURVE& value,
2871     std::string* buffer);
2872 
2873 TRUNKS_EXPORT TPM_RC Parse_TPML_ECC_CURVE(
2874     std::string* buffer,
2875     TPML_ECC_CURVE* value,
2876     std::string* value_bytes);
2877 
2878 TRUNKS_EXPORT TPM_RC Serialize_TPMS_CAPABILITY_DATA(
2879     const TPMS_CAPABILITY_DATA& value,
2880     std::string* buffer);
2881 
2882 TRUNKS_EXPORT TPM_RC Parse_TPMS_CAPABILITY_DATA(
2883     std::string* buffer,
2884     TPMS_CAPABILITY_DATA* value,
2885     std::string* value_bytes);
2886 
2887 TRUNKS_EXPORT TPM_RC Serialize_TPMS_CLOCK_INFO(
2888     const TPMS_CLOCK_INFO& value,
2889     std::string* buffer);
2890 
2891 TRUNKS_EXPORT TPM_RC Parse_TPMS_CLOCK_INFO(
2892     std::string* buffer,
2893     TPMS_CLOCK_INFO* value,
2894     std::string* value_bytes);
2895 
2896 TRUNKS_EXPORT TPM_RC Serialize_TPMS_TIME_INFO(
2897     const TPMS_TIME_INFO& value,
2898     std::string* buffer);
2899 
2900 TRUNKS_EXPORT TPM_RC Parse_TPMS_TIME_INFO(
2901     std::string* buffer,
2902     TPMS_TIME_INFO* value,
2903     std::string* value_bytes);
2904 
2905 TRUNKS_EXPORT TPM_RC Serialize_TPMS_TIME_ATTEST_INFO(
2906     const TPMS_TIME_ATTEST_INFO& value,
2907     std::string* buffer);
2908 
2909 TRUNKS_EXPORT TPM_RC Parse_TPMS_TIME_ATTEST_INFO(
2910     std::string* buffer,
2911     TPMS_TIME_ATTEST_INFO* value,
2912     std::string* value_bytes);
2913 
2914 TRUNKS_EXPORT TPM_RC Serialize_TPMS_CERTIFY_INFO(
2915     const TPMS_CERTIFY_INFO& value,
2916     std::string* buffer);
2917 
2918 TRUNKS_EXPORT TPM_RC Parse_TPMS_CERTIFY_INFO(
2919     std::string* buffer,
2920     TPMS_CERTIFY_INFO* value,
2921     std::string* value_bytes);
2922 
2923 TRUNKS_EXPORT TPM_RC Serialize_TPMS_QUOTE_INFO(
2924     const TPMS_QUOTE_INFO& value,
2925     std::string* buffer);
2926 
2927 TRUNKS_EXPORT TPM_RC Parse_TPMS_QUOTE_INFO(
2928     std::string* buffer,
2929     TPMS_QUOTE_INFO* value,
2930     std::string* value_bytes);
2931 
2932 TRUNKS_EXPORT TPM_RC Serialize_TPMS_COMMAND_AUDIT_INFO(
2933     const TPMS_COMMAND_AUDIT_INFO& value,
2934     std::string* buffer);
2935 
2936 TRUNKS_EXPORT TPM_RC Parse_TPMS_COMMAND_AUDIT_INFO(
2937     std::string* buffer,
2938     TPMS_COMMAND_AUDIT_INFO* value,
2939     std::string* value_bytes);
2940 
2941 TRUNKS_EXPORT TPM_RC Serialize_TPMS_SESSION_AUDIT_INFO(
2942     const TPMS_SESSION_AUDIT_INFO& value,
2943     std::string* buffer);
2944 
2945 TRUNKS_EXPORT TPM_RC Parse_TPMS_SESSION_AUDIT_INFO(
2946     std::string* buffer,
2947     TPMS_SESSION_AUDIT_INFO* value,
2948     std::string* value_bytes);
2949 
2950 TRUNKS_EXPORT TPM_RC Serialize_TPMS_CREATION_INFO(
2951     const TPMS_CREATION_INFO& value,
2952     std::string* buffer);
2953 
2954 TRUNKS_EXPORT TPM_RC Parse_TPMS_CREATION_INFO(
2955     std::string* buffer,
2956     TPMS_CREATION_INFO* value,
2957     std::string* value_bytes);
2958 
2959 TRUNKS_EXPORT TPM_RC Serialize_TPMS_NV_CERTIFY_INFO(
2960     const TPMS_NV_CERTIFY_INFO& value,
2961     std::string* buffer);
2962 
2963 TRUNKS_EXPORT TPM_RC Parse_TPMS_NV_CERTIFY_INFO(
2964     std::string* buffer,
2965     TPMS_NV_CERTIFY_INFO* value,
2966     std::string* value_bytes);
2967 
2968 TRUNKS_EXPORT TPM_RC Serialize_TPMS_ATTEST(
2969     const TPMS_ATTEST& value,
2970     std::string* buffer);
2971 
2972 TRUNKS_EXPORT TPM_RC Parse_TPMS_ATTEST(
2973     std::string* buffer,
2974     TPMS_ATTEST* value,
2975     std::string* value_bytes);
2976 
2977 TRUNKS_EXPORT TPM_RC Serialize_TPM2B_ATTEST(
2978     const TPM2B_ATTEST& value,
2979     std::string* buffer);
2980 
2981 TRUNKS_EXPORT TPM_RC Parse_TPM2B_ATTEST(
2982     std::string* buffer,
2983     TPM2B_ATTEST* value,
2984     std::string* value_bytes);
2985 
2986 TRUNKS_EXPORT TPM2B_ATTEST Make_TPM2B_ATTEST(
2987     const std::string& bytes);
2988 TRUNKS_EXPORT std::string StringFrom_TPM2B_ATTEST(
2989     const TPM2B_ATTEST& tpm2b);
2990 
2991 TRUNKS_EXPORT TPM_RC Serialize_TPMS_AUTH_COMMAND(
2992     const TPMS_AUTH_COMMAND& value,
2993     std::string* buffer);
2994 
2995 TRUNKS_EXPORT TPM_RC Parse_TPMS_AUTH_COMMAND(
2996     std::string* buffer,
2997     TPMS_AUTH_COMMAND* value,
2998     std::string* value_bytes);
2999 
3000 TRUNKS_EXPORT TPM_RC Serialize_TPMS_AUTH_RESPONSE(
3001     const TPMS_AUTH_RESPONSE& value,
3002     std::string* buffer);
3003 
3004 TRUNKS_EXPORT TPM_RC Parse_TPMS_AUTH_RESPONSE(
3005     std::string* buffer,
3006     TPMS_AUTH_RESPONSE* value,
3007     std::string* value_bytes);
3008 
3009 TRUNKS_EXPORT TPM_RC Serialize_TPMT_SYM_DEF(
3010     const TPMT_SYM_DEF& value,
3011     std::string* buffer);
3012 
3013 TRUNKS_EXPORT TPM_RC Parse_TPMT_SYM_DEF(
3014     std::string* buffer,
3015     TPMT_SYM_DEF* value,
3016     std::string* value_bytes);
3017 
3018 TRUNKS_EXPORT TPM_RC Serialize_TPMT_SYM_DEF_OBJECT(
3019     const TPMT_SYM_DEF_OBJECT& value,
3020     std::string* buffer);
3021 
3022 TRUNKS_EXPORT TPM_RC Parse_TPMT_SYM_DEF_OBJECT(
3023     std::string* buffer,
3024     TPMT_SYM_DEF_OBJECT* value,
3025     std::string* value_bytes);
3026 
3027 TRUNKS_EXPORT TPM_RC Serialize_TPM2B_SYM_KEY(
3028     const TPM2B_SYM_KEY& value,
3029     std::string* buffer);
3030 
3031 TRUNKS_EXPORT TPM_RC Parse_TPM2B_SYM_KEY(
3032     std::string* buffer,
3033     TPM2B_SYM_KEY* value,
3034     std::string* value_bytes);
3035 
3036 TRUNKS_EXPORT TPM2B_SYM_KEY Make_TPM2B_SYM_KEY(
3037     const std::string& bytes);
3038 TRUNKS_EXPORT std::string StringFrom_TPM2B_SYM_KEY(
3039     const TPM2B_SYM_KEY& tpm2b);
3040 
3041 TRUNKS_EXPORT TPM_RC Serialize_TPMS_SYMCIPHER_PARMS(
3042     const TPMS_SYMCIPHER_PARMS& value,
3043     std::string* buffer);
3044 
3045 TRUNKS_EXPORT TPM_RC Parse_TPMS_SYMCIPHER_PARMS(
3046     std::string* buffer,
3047     TPMS_SYMCIPHER_PARMS* value,
3048     std::string* value_bytes);
3049 
3050 TRUNKS_EXPORT TPM_RC Serialize_TPM2B_SENSITIVE_DATA(
3051     const TPM2B_SENSITIVE_DATA& value,
3052     std::string* buffer);
3053 
3054 TRUNKS_EXPORT TPM_RC Parse_TPM2B_SENSITIVE_DATA(
3055     std::string* buffer,
3056     TPM2B_SENSITIVE_DATA* value,
3057     std::string* value_bytes);
3058 
3059 TRUNKS_EXPORT TPM2B_SENSITIVE_DATA Make_TPM2B_SENSITIVE_DATA(
3060     const std::string& bytes);
3061 TRUNKS_EXPORT std::string StringFrom_TPM2B_SENSITIVE_DATA(
3062     const TPM2B_SENSITIVE_DATA& tpm2b);
3063 
3064 TRUNKS_EXPORT TPM_RC Serialize_TPMS_SENSITIVE_CREATE(
3065     const TPMS_SENSITIVE_CREATE& value,
3066     std::string* buffer);
3067 
3068 TRUNKS_EXPORT TPM_RC Parse_TPMS_SENSITIVE_CREATE(
3069     std::string* buffer,
3070     TPMS_SENSITIVE_CREATE* value,
3071     std::string* value_bytes);
3072 
3073 TRUNKS_EXPORT TPM_RC Serialize_TPM2B_SENSITIVE_CREATE(
3074     const TPM2B_SENSITIVE_CREATE& value,
3075     std::string* buffer);
3076 
3077 TRUNKS_EXPORT TPM_RC Parse_TPM2B_SENSITIVE_CREATE(
3078     std::string* buffer,
3079     TPM2B_SENSITIVE_CREATE* value,
3080     std::string* value_bytes);
3081 
3082 TRUNKS_EXPORT TPM2B_SENSITIVE_CREATE Make_TPM2B_SENSITIVE_CREATE(
3083     const TPMS_SENSITIVE_CREATE& inner);
3084 
3085 TRUNKS_EXPORT TPM_RC Serialize_TPMS_SCHEME_SIGHASH(
3086     const TPMS_SCHEME_SIGHASH& value,
3087     std::string* buffer);
3088 
3089 TRUNKS_EXPORT TPM_RC Parse_TPMS_SCHEME_SIGHASH(
3090     std::string* buffer,
3091     TPMS_SCHEME_SIGHASH* value,
3092     std::string* value_bytes);
3093 
3094 TRUNKS_EXPORT TPM_RC Serialize_TPMS_SCHEME_XOR(
3095     const TPMS_SCHEME_XOR& value,
3096     std::string* buffer);
3097 
3098 TRUNKS_EXPORT TPM_RC Parse_TPMS_SCHEME_XOR(
3099     std::string* buffer,
3100     TPMS_SCHEME_XOR* value,
3101     std::string* value_bytes);
3102 
3103 TRUNKS_EXPORT TPM_RC Serialize_TPMT_KEYEDHASH_SCHEME(
3104     const TPMT_KEYEDHASH_SCHEME& value,
3105     std::string* buffer);
3106 
3107 TRUNKS_EXPORT TPM_RC Parse_TPMT_KEYEDHASH_SCHEME(
3108     std::string* buffer,
3109     TPMT_KEYEDHASH_SCHEME* value,
3110     std::string* value_bytes);
3111 
3112 TRUNKS_EXPORT TPM_RC Serialize_TPMS_SCHEME_ECDAA(
3113     const TPMS_SCHEME_ECDAA& value,
3114     std::string* buffer);
3115 
3116 TRUNKS_EXPORT TPM_RC Parse_TPMS_SCHEME_ECDAA(
3117     std::string* buffer,
3118     TPMS_SCHEME_ECDAA* value,
3119     std::string* value_bytes);
3120 
3121 TRUNKS_EXPORT TPM_RC Serialize_TPMT_SIG_SCHEME(
3122     const TPMT_SIG_SCHEME& value,
3123     std::string* buffer);
3124 
3125 TRUNKS_EXPORT TPM_RC Parse_TPMT_SIG_SCHEME(
3126     std::string* buffer,
3127     TPMT_SIG_SCHEME* value,
3128     std::string* value_bytes);
3129 
3130 TRUNKS_EXPORT TPM_RC Serialize_TPMS_SCHEME_OAEP(
3131     const TPMS_SCHEME_OAEP& value,
3132     std::string* buffer);
3133 
3134 TRUNKS_EXPORT TPM_RC Parse_TPMS_SCHEME_OAEP(
3135     std::string* buffer,
3136     TPMS_SCHEME_OAEP* value,
3137     std::string* value_bytes);
3138 
3139 TRUNKS_EXPORT TPM_RC Serialize_TPMS_SCHEME_ECDH(
3140     const TPMS_SCHEME_ECDH& value,
3141     std::string* buffer);
3142 
3143 TRUNKS_EXPORT TPM_RC Parse_TPMS_SCHEME_ECDH(
3144     std::string* buffer,
3145     TPMS_SCHEME_ECDH* value,
3146     std::string* value_bytes);
3147 
3148 TRUNKS_EXPORT TPM_RC Serialize_TPMS_SCHEME_MGF1(
3149     const TPMS_SCHEME_MGF1& value,
3150     std::string* buffer);
3151 
3152 TRUNKS_EXPORT TPM_RC Parse_TPMS_SCHEME_MGF1(
3153     std::string* buffer,
3154     TPMS_SCHEME_MGF1* value,
3155     std::string* value_bytes);
3156 
3157 TRUNKS_EXPORT TPM_RC Serialize_TPMS_SCHEME_KDF1_SP800_56a(
3158     const TPMS_SCHEME_KDF1_SP800_56a& value,
3159     std::string* buffer);
3160 
3161 TRUNKS_EXPORT TPM_RC Parse_TPMS_SCHEME_KDF1_SP800_56a(
3162     std::string* buffer,
3163     TPMS_SCHEME_KDF1_SP800_56a* value,
3164     std::string* value_bytes);
3165 
3166 TRUNKS_EXPORT TPM_RC Serialize_TPMS_SCHEME_KDF2(
3167     const TPMS_SCHEME_KDF2& value,
3168     std::string* buffer);
3169 
3170 TRUNKS_EXPORT TPM_RC Parse_TPMS_SCHEME_KDF2(
3171     std::string* buffer,
3172     TPMS_SCHEME_KDF2* value,
3173     std::string* value_bytes);
3174 
3175 TRUNKS_EXPORT TPM_RC Serialize_TPMS_SCHEME_KDF1_SP800_108(
3176     const TPMS_SCHEME_KDF1_SP800_108& value,
3177     std::string* buffer);
3178 
3179 TRUNKS_EXPORT TPM_RC Parse_TPMS_SCHEME_KDF1_SP800_108(
3180     std::string* buffer,
3181     TPMS_SCHEME_KDF1_SP800_108* value,
3182     std::string* value_bytes);
3183 
3184 TRUNKS_EXPORT TPM_RC Serialize_TPMT_KDF_SCHEME(
3185     const TPMT_KDF_SCHEME& value,
3186     std::string* buffer);
3187 
3188 TRUNKS_EXPORT TPM_RC Parse_TPMT_KDF_SCHEME(
3189     std::string* buffer,
3190     TPMT_KDF_SCHEME* value,
3191     std::string* value_bytes);
3192 
3193 TRUNKS_EXPORT TPM_RC Serialize_TPMT_ASYM_SCHEME(
3194     const TPMT_ASYM_SCHEME& value,
3195     std::string* buffer);
3196 
3197 TRUNKS_EXPORT TPM_RC Parse_TPMT_ASYM_SCHEME(
3198     std::string* buffer,
3199     TPMT_ASYM_SCHEME* value,
3200     std::string* value_bytes);
3201 
3202 TRUNKS_EXPORT TPM_RC Serialize_TPMT_RSA_SCHEME(
3203     const TPMT_RSA_SCHEME& value,
3204     std::string* buffer);
3205 
3206 TRUNKS_EXPORT TPM_RC Parse_TPMT_RSA_SCHEME(
3207     std::string* buffer,
3208     TPMT_RSA_SCHEME* value,
3209     std::string* value_bytes);
3210 
3211 TRUNKS_EXPORT TPM_RC Serialize_TPMT_RSA_DECRYPT(
3212     const TPMT_RSA_DECRYPT& value,
3213     std::string* buffer);
3214 
3215 TRUNKS_EXPORT TPM_RC Parse_TPMT_RSA_DECRYPT(
3216     std::string* buffer,
3217     TPMT_RSA_DECRYPT* value,
3218     std::string* value_bytes);
3219 
3220 TRUNKS_EXPORT TPM_RC Serialize_TPM2B_PUBLIC_KEY_RSA(
3221     const TPM2B_PUBLIC_KEY_RSA& value,
3222     std::string* buffer);
3223 
3224 TRUNKS_EXPORT TPM_RC Parse_TPM2B_PUBLIC_KEY_RSA(
3225     std::string* buffer,
3226     TPM2B_PUBLIC_KEY_RSA* value,
3227     std::string* value_bytes);
3228 
3229 TRUNKS_EXPORT TPM2B_PUBLIC_KEY_RSA Make_TPM2B_PUBLIC_KEY_RSA(
3230     const std::string& bytes);
3231 TRUNKS_EXPORT std::string StringFrom_TPM2B_PUBLIC_KEY_RSA(
3232     const TPM2B_PUBLIC_KEY_RSA& tpm2b);
3233 
3234 TRUNKS_EXPORT TPM_RC Serialize_TPM2B_PRIVATE_KEY_RSA(
3235     const TPM2B_PRIVATE_KEY_RSA& value,
3236     std::string* buffer);
3237 
3238 TRUNKS_EXPORT TPM_RC Parse_TPM2B_PRIVATE_KEY_RSA(
3239     std::string* buffer,
3240     TPM2B_PRIVATE_KEY_RSA* value,
3241     std::string* value_bytes);
3242 
3243 TRUNKS_EXPORT TPM2B_PRIVATE_KEY_RSA Make_TPM2B_PRIVATE_KEY_RSA(
3244     const std::string& bytes);
3245 TRUNKS_EXPORT std::string StringFrom_TPM2B_PRIVATE_KEY_RSA(
3246     const TPM2B_PRIVATE_KEY_RSA& tpm2b);
3247 
3248 TRUNKS_EXPORT TPM_RC Serialize_TPM2B_ECC_PARAMETER(
3249     const TPM2B_ECC_PARAMETER& value,
3250     std::string* buffer);
3251 
3252 TRUNKS_EXPORT TPM_RC Parse_TPM2B_ECC_PARAMETER(
3253     std::string* buffer,
3254     TPM2B_ECC_PARAMETER* value,
3255     std::string* value_bytes);
3256 
3257 TRUNKS_EXPORT TPM2B_ECC_PARAMETER Make_TPM2B_ECC_PARAMETER(
3258     const std::string& bytes);
3259 TRUNKS_EXPORT std::string StringFrom_TPM2B_ECC_PARAMETER(
3260     const TPM2B_ECC_PARAMETER& tpm2b);
3261 
3262 TRUNKS_EXPORT TPM_RC Serialize_TPMS_ECC_POINT(
3263     const TPMS_ECC_POINT& value,
3264     std::string* buffer);
3265 
3266 TRUNKS_EXPORT TPM_RC Parse_TPMS_ECC_POINT(
3267     std::string* buffer,
3268     TPMS_ECC_POINT* value,
3269     std::string* value_bytes);
3270 
3271 TRUNKS_EXPORT TPM_RC Serialize_TPM2B_ECC_POINT(
3272     const TPM2B_ECC_POINT& value,
3273     std::string* buffer);
3274 
3275 TRUNKS_EXPORT TPM_RC Parse_TPM2B_ECC_POINT(
3276     std::string* buffer,
3277     TPM2B_ECC_POINT* value,
3278     std::string* value_bytes);
3279 
3280 TRUNKS_EXPORT TPM2B_ECC_POINT Make_TPM2B_ECC_POINT(
3281     const TPMS_ECC_POINT& inner);
3282 
3283 TRUNKS_EXPORT TPM_RC Serialize_TPMT_ECC_SCHEME(
3284     const TPMT_ECC_SCHEME& value,
3285     std::string* buffer);
3286 
3287 TRUNKS_EXPORT TPM_RC Parse_TPMT_ECC_SCHEME(
3288     std::string* buffer,
3289     TPMT_ECC_SCHEME* value,
3290     std::string* value_bytes);
3291 
3292 TRUNKS_EXPORT TPM_RC Serialize_TPMS_ALGORITHM_DETAIL_ECC(
3293     const TPMS_ALGORITHM_DETAIL_ECC& value,
3294     std::string* buffer);
3295 
3296 TRUNKS_EXPORT TPM_RC Parse_TPMS_ALGORITHM_DETAIL_ECC(
3297     std::string* buffer,
3298     TPMS_ALGORITHM_DETAIL_ECC* value,
3299     std::string* value_bytes);
3300 
3301 TRUNKS_EXPORT TPM_RC Serialize_TPMS_SIGNATURE_RSASSA(
3302     const TPMS_SIGNATURE_RSASSA& value,
3303     std::string* buffer);
3304 
3305 TRUNKS_EXPORT TPM_RC Parse_TPMS_SIGNATURE_RSASSA(
3306     std::string* buffer,
3307     TPMS_SIGNATURE_RSASSA* value,
3308     std::string* value_bytes);
3309 
3310 TRUNKS_EXPORT TPM_RC Serialize_TPMS_SIGNATURE_RSAPSS(
3311     const TPMS_SIGNATURE_RSAPSS& value,
3312     std::string* buffer);
3313 
3314 TRUNKS_EXPORT TPM_RC Parse_TPMS_SIGNATURE_RSAPSS(
3315     std::string* buffer,
3316     TPMS_SIGNATURE_RSAPSS* value,
3317     std::string* value_bytes);
3318 
3319 TRUNKS_EXPORT TPM_RC Serialize_TPMS_SIGNATURE_ECDSA(
3320     const TPMS_SIGNATURE_ECDSA& value,
3321     std::string* buffer);
3322 
3323 TRUNKS_EXPORT TPM_RC Parse_TPMS_SIGNATURE_ECDSA(
3324     std::string* buffer,
3325     TPMS_SIGNATURE_ECDSA* value,
3326     std::string* value_bytes);
3327 
3328 TRUNKS_EXPORT TPM_RC Serialize_TPMT_SIGNATURE(
3329     const TPMT_SIGNATURE& value,
3330     std::string* buffer);
3331 
3332 TRUNKS_EXPORT TPM_RC Parse_TPMT_SIGNATURE(
3333     std::string* buffer,
3334     TPMT_SIGNATURE* value,
3335     std::string* value_bytes);
3336 
3337 TRUNKS_EXPORT TPM_RC Serialize_TPM2B_ENCRYPTED_SECRET(
3338     const TPM2B_ENCRYPTED_SECRET& value,
3339     std::string* buffer);
3340 
3341 TRUNKS_EXPORT TPM_RC Parse_TPM2B_ENCRYPTED_SECRET(
3342     std::string* buffer,
3343     TPM2B_ENCRYPTED_SECRET* value,
3344     std::string* value_bytes);
3345 
3346 TRUNKS_EXPORT TPM2B_ENCRYPTED_SECRET Make_TPM2B_ENCRYPTED_SECRET(
3347     const std::string& bytes);
3348 TRUNKS_EXPORT std::string StringFrom_TPM2B_ENCRYPTED_SECRET(
3349     const TPM2B_ENCRYPTED_SECRET& tpm2b);
3350 
3351 TRUNKS_EXPORT TPM_RC Serialize_TPMS_KEYEDHASH_PARMS(
3352     const TPMS_KEYEDHASH_PARMS& value,
3353     std::string* buffer);
3354 
3355 TRUNKS_EXPORT TPM_RC Parse_TPMS_KEYEDHASH_PARMS(
3356     std::string* buffer,
3357     TPMS_KEYEDHASH_PARMS* value,
3358     std::string* value_bytes);
3359 
3360 TRUNKS_EXPORT TPM_RC Serialize_TPMS_ASYM_PARMS(
3361     const TPMS_ASYM_PARMS& value,
3362     std::string* buffer);
3363 
3364 TRUNKS_EXPORT TPM_RC Parse_TPMS_ASYM_PARMS(
3365     std::string* buffer,
3366     TPMS_ASYM_PARMS* value,
3367     std::string* value_bytes);
3368 
3369 TRUNKS_EXPORT TPM_RC Serialize_TPMS_RSA_PARMS(
3370     const TPMS_RSA_PARMS& value,
3371     std::string* buffer);
3372 
3373 TRUNKS_EXPORT TPM_RC Parse_TPMS_RSA_PARMS(
3374     std::string* buffer,
3375     TPMS_RSA_PARMS* value,
3376     std::string* value_bytes);
3377 
3378 TRUNKS_EXPORT TPM_RC Serialize_TPMS_ECC_PARMS(
3379     const TPMS_ECC_PARMS& value,
3380     std::string* buffer);
3381 
3382 TRUNKS_EXPORT TPM_RC Parse_TPMS_ECC_PARMS(
3383     std::string* buffer,
3384     TPMS_ECC_PARMS* value,
3385     std::string* value_bytes);
3386 
3387 TRUNKS_EXPORT TPM_RC Serialize_TPMT_PUBLIC_PARMS(
3388     const TPMT_PUBLIC_PARMS& value,
3389     std::string* buffer);
3390 
3391 TRUNKS_EXPORT TPM_RC Parse_TPMT_PUBLIC_PARMS(
3392     std::string* buffer,
3393     TPMT_PUBLIC_PARMS* value,
3394     std::string* value_bytes);
3395 
3396 TRUNKS_EXPORT TPM_RC Serialize_TPMT_PUBLIC(
3397     const TPMT_PUBLIC& value,
3398     std::string* buffer);
3399 
3400 TRUNKS_EXPORT TPM_RC Parse_TPMT_PUBLIC(
3401     std::string* buffer,
3402     TPMT_PUBLIC* value,
3403     std::string* value_bytes);
3404 
3405 TRUNKS_EXPORT TPM_RC Serialize_TPM2B_PUBLIC(
3406     const TPM2B_PUBLIC& value,
3407     std::string* buffer);
3408 
3409 TRUNKS_EXPORT TPM_RC Parse_TPM2B_PUBLIC(
3410     std::string* buffer,
3411     TPM2B_PUBLIC* value,
3412     std::string* value_bytes);
3413 
3414 TRUNKS_EXPORT TPM2B_PUBLIC Make_TPM2B_PUBLIC(
3415     const TPMT_PUBLIC& inner);
3416 
3417 TRUNKS_EXPORT TPM_RC Serialize_TPM2B_PRIVATE_VENDOR_SPECIFIC(
3418     const TPM2B_PRIVATE_VENDOR_SPECIFIC& value,
3419     std::string* buffer);
3420 
3421 TRUNKS_EXPORT TPM_RC Parse_TPM2B_PRIVATE_VENDOR_SPECIFIC(
3422     std::string* buffer,
3423     TPM2B_PRIVATE_VENDOR_SPECIFIC* value,
3424     std::string* value_bytes);
3425 
3426 TRUNKS_EXPORT TPM2B_PRIVATE_VENDOR_SPECIFIC Make_TPM2B_PRIVATE_VENDOR_SPECIFIC(
3427     const std::string& bytes);
3428 TRUNKS_EXPORT std::string StringFrom_TPM2B_PRIVATE_VENDOR_SPECIFIC(
3429     const TPM2B_PRIVATE_VENDOR_SPECIFIC& tpm2b);
3430 
3431 TRUNKS_EXPORT TPM_RC Serialize_TPMT_SENSITIVE(
3432     const TPMT_SENSITIVE& value,
3433     std::string* buffer);
3434 
3435 TRUNKS_EXPORT TPM_RC Parse_TPMT_SENSITIVE(
3436     std::string* buffer,
3437     TPMT_SENSITIVE* value,
3438     std::string* value_bytes);
3439 
3440 TRUNKS_EXPORT TPM_RC Serialize_TPM2B_SENSITIVE(
3441     const TPM2B_SENSITIVE& value,
3442     std::string* buffer);
3443 
3444 TRUNKS_EXPORT TPM_RC Parse_TPM2B_SENSITIVE(
3445     std::string* buffer,
3446     TPM2B_SENSITIVE* value,
3447     std::string* value_bytes);
3448 
3449 TRUNKS_EXPORT TPM2B_SENSITIVE Make_TPM2B_SENSITIVE(
3450     const TPMT_SENSITIVE& inner);
3451 
3452 TRUNKS_EXPORT TPM_RC Serialize__PRIVATE(
3453     const _PRIVATE& value,
3454     std::string* buffer);
3455 
3456 TRUNKS_EXPORT TPM_RC Parse__PRIVATE(
3457     std::string* buffer,
3458     _PRIVATE* value,
3459     std::string* value_bytes);
3460 
3461 TRUNKS_EXPORT TPM_RC Serialize_TPM2B_PRIVATE(
3462     const TPM2B_PRIVATE& value,
3463     std::string* buffer);
3464 
3465 TRUNKS_EXPORT TPM_RC Parse_TPM2B_PRIVATE(
3466     std::string* buffer,
3467     TPM2B_PRIVATE* value,
3468     std::string* value_bytes);
3469 
3470 TRUNKS_EXPORT TPM2B_PRIVATE Make_TPM2B_PRIVATE(
3471     const std::string& bytes);
3472 TRUNKS_EXPORT std::string StringFrom_TPM2B_PRIVATE(
3473     const TPM2B_PRIVATE& tpm2b);
3474 
3475 TRUNKS_EXPORT TPM_RC Serialize__ID_OBJECT(
3476     const _ID_OBJECT& value,
3477     std::string* buffer);
3478 
3479 TRUNKS_EXPORT TPM_RC Parse__ID_OBJECT(
3480     std::string* buffer,
3481     _ID_OBJECT* value,
3482     std::string* value_bytes);
3483 
3484 TRUNKS_EXPORT TPM_RC Serialize_TPM2B_ID_OBJECT(
3485     const TPM2B_ID_OBJECT& value,
3486     std::string* buffer);
3487 
3488 TRUNKS_EXPORT TPM_RC Parse_TPM2B_ID_OBJECT(
3489     std::string* buffer,
3490     TPM2B_ID_OBJECT* value,
3491     std::string* value_bytes);
3492 
3493 TRUNKS_EXPORT TPM2B_ID_OBJECT Make_TPM2B_ID_OBJECT(
3494     const std::string& bytes);
3495 TRUNKS_EXPORT std::string StringFrom_TPM2B_ID_OBJECT(
3496     const TPM2B_ID_OBJECT& tpm2b);
3497 
3498 TRUNKS_EXPORT TPM_RC Serialize_TPMS_NV_PUBLIC(
3499     const TPMS_NV_PUBLIC& value,
3500     std::string* buffer);
3501 
3502 TRUNKS_EXPORT TPM_RC Parse_TPMS_NV_PUBLIC(
3503     std::string* buffer,
3504     TPMS_NV_PUBLIC* value,
3505     std::string* value_bytes);
3506 
3507 TRUNKS_EXPORT TPM_RC Serialize_TPM2B_NV_PUBLIC(
3508     const TPM2B_NV_PUBLIC& value,
3509     std::string* buffer);
3510 
3511 TRUNKS_EXPORT TPM_RC Parse_TPM2B_NV_PUBLIC(
3512     std::string* buffer,
3513     TPM2B_NV_PUBLIC* value,
3514     std::string* value_bytes);
3515 
3516 TRUNKS_EXPORT TPM2B_NV_PUBLIC Make_TPM2B_NV_PUBLIC(
3517     const TPMS_NV_PUBLIC& inner);
3518 
3519 TRUNKS_EXPORT TPM_RC Serialize_TPM2B_CONTEXT_SENSITIVE(
3520     const TPM2B_CONTEXT_SENSITIVE& value,
3521     std::string* buffer);
3522 
3523 TRUNKS_EXPORT TPM_RC Parse_TPM2B_CONTEXT_SENSITIVE(
3524     std::string* buffer,
3525     TPM2B_CONTEXT_SENSITIVE* value,
3526     std::string* value_bytes);
3527 
3528 TRUNKS_EXPORT TPM2B_CONTEXT_SENSITIVE Make_TPM2B_CONTEXT_SENSITIVE(
3529     const std::string& bytes);
3530 TRUNKS_EXPORT std::string StringFrom_TPM2B_CONTEXT_SENSITIVE(
3531     const TPM2B_CONTEXT_SENSITIVE& tpm2b);
3532 
3533 TRUNKS_EXPORT TPM_RC Serialize_TPMS_CONTEXT_DATA(
3534     const TPMS_CONTEXT_DATA& value,
3535     std::string* buffer);
3536 
3537 TRUNKS_EXPORT TPM_RC Parse_TPMS_CONTEXT_DATA(
3538     std::string* buffer,
3539     TPMS_CONTEXT_DATA* value,
3540     std::string* value_bytes);
3541 
3542 TRUNKS_EXPORT TPM_RC Serialize_TPM2B_CONTEXT_DATA(
3543     const TPM2B_CONTEXT_DATA& value,
3544     std::string* buffer);
3545 
3546 TRUNKS_EXPORT TPM_RC Parse_TPM2B_CONTEXT_DATA(
3547     std::string* buffer,
3548     TPM2B_CONTEXT_DATA* value,
3549     std::string* value_bytes);
3550 
3551 TRUNKS_EXPORT TPM2B_CONTEXT_DATA Make_TPM2B_CONTEXT_DATA(
3552     const std::string& bytes);
3553 TRUNKS_EXPORT std::string StringFrom_TPM2B_CONTEXT_DATA(
3554     const TPM2B_CONTEXT_DATA& tpm2b);
3555 
3556 TRUNKS_EXPORT TPM_RC Serialize_TPMS_CONTEXT(
3557     const TPMS_CONTEXT& value,
3558     std::string* buffer);
3559 
3560 TRUNKS_EXPORT TPM_RC Parse_TPMS_CONTEXT(
3561     std::string* buffer,
3562     TPMS_CONTEXT* value,
3563     std::string* value_bytes);
3564 
3565 TRUNKS_EXPORT TPM_RC Serialize_TPMS_CREATION_DATA(
3566     const TPMS_CREATION_DATA& value,
3567     std::string* buffer);
3568 
3569 TRUNKS_EXPORT TPM_RC Parse_TPMS_CREATION_DATA(
3570     std::string* buffer,
3571     TPMS_CREATION_DATA* value,
3572     std::string* value_bytes);
3573 
3574 TRUNKS_EXPORT TPM_RC Serialize_TPM2B_CREATION_DATA(
3575     const TPM2B_CREATION_DATA& value,
3576     std::string* buffer);
3577 
3578 TRUNKS_EXPORT TPM_RC Parse_TPM2B_CREATION_DATA(
3579     std::string* buffer,
3580     TPM2B_CREATION_DATA* value,
3581     std::string* value_bytes);
3582 
3583 TRUNKS_EXPORT TPM2B_CREATION_DATA Make_TPM2B_CREATION_DATA(
3584     const TPMS_CREATION_DATA& inner);
3585 
3586 TRUNKS_EXPORT TPM_RC Serialize_TPMU_HA(
3587     const TPMU_HA& value,
3588     std::string* buffer);
3589 
3590 TRUNKS_EXPORT TPM_RC Parse_TPMU_HA(
3591     std::string* buffer,
3592     TPMU_HA* value,
3593     std::string* value_bytes);
3594 
3595 TRUNKS_EXPORT TPM_RC Serialize_TPMU_NAME(
3596     const TPMU_NAME& value,
3597     std::string* buffer);
3598 
3599 TRUNKS_EXPORT TPM_RC Parse_TPMU_NAME(
3600     std::string* buffer,
3601     TPMU_NAME* value,
3602     std::string* value_bytes);
3603 
3604 TRUNKS_EXPORT TPM_RC Serialize_TPMU_CAPABILITIES(
3605     const TPMU_CAPABILITIES& value,
3606     std::string* buffer);
3607 
3608 TRUNKS_EXPORT TPM_RC Parse_TPMU_CAPABILITIES(
3609     std::string* buffer,
3610     TPMU_CAPABILITIES* value,
3611     std::string* value_bytes);
3612 
3613 TRUNKS_EXPORT TPM_RC Serialize_TPMU_ATTEST(
3614     const TPMU_ATTEST& value,
3615     std::string* buffer);
3616 
3617 TRUNKS_EXPORT TPM_RC Parse_TPMU_ATTEST(
3618     std::string* buffer,
3619     TPMU_ATTEST* value,
3620     std::string* value_bytes);
3621 
3622 TRUNKS_EXPORT TPM_RC Serialize_TPMU_SYM_KEY_BITS(
3623     const TPMU_SYM_KEY_BITS& value,
3624     std::string* buffer);
3625 
3626 TRUNKS_EXPORT TPM_RC Parse_TPMU_SYM_KEY_BITS(
3627     std::string* buffer,
3628     TPMU_SYM_KEY_BITS* value,
3629     std::string* value_bytes);
3630 
3631 TRUNKS_EXPORT TPM_RC Serialize_TPMU_SYM_MODE(
3632     const TPMU_SYM_MODE& value,
3633     std::string* buffer);
3634 
3635 TRUNKS_EXPORT TPM_RC Parse_TPMU_SYM_MODE(
3636     std::string* buffer,
3637     TPMU_SYM_MODE* value,
3638     std::string* value_bytes);
3639 
3640 TRUNKS_EXPORT TPM_RC Serialize_TPMU_SCHEME_KEYEDHASH(
3641     const TPMU_SCHEME_KEYEDHASH& value,
3642     std::string* buffer);
3643 
3644 TRUNKS_EXPORT TPM_RC Parse_TPMU_SCHEME_KEYEDHASH(
3645     std::string* buffer,
3646     TPMU_SCHEME_KEYEDHASH* value,
3647     std::string* value_bytes);
3648 
3649 TRUNKS_EXPORT TPM_RC Serialize_TPMU_SIG_SCHEME(
3650     const TPMU_SIG_SCHEME& value,
3651     std::string* buffer);
3652 
3653 TRUNKS_EXPORT TPM_RC Parse_TPMU_SIG_SCHEME(
3654     std::string* buffer,
3655     TPMU_SIG_SCHEME* value,
3656     std::string* value_bytes);
3657 
3658 TRUNKS_EXPORT TPM_RC Serialize_TPMU_KDF_SCHEME(
3659     const TPMU_KDF_SCHEME& value,
3660     std::string* buffer);
3661 
3662 TRUNKS_EXPORT TPM_RC Parse_TPMU_KDF_SCHEME(
3663     std::string* buffer,
3664     TPMU_KDF_SCHEME* value,
3665     std::string* value_bytes);
3666 
3667 TRUNKS_EXPORT TPM_RC Serialize_TPMU_ASYM_SCHEME(
3668     const TPMU_ASYM_SCHEME& value,
3669     std::string* buffer);
3670 
3671 TRUNKS_EXPORT TPM_RC Parse_TPMU_ASYM_SCHEME(
3672     std::string* buffer,
3673     TPMU_ASYM_SCHEME* value,
3674     std::string* value_bytes);
3675 
3676 TRUNKS_EXPORT TPM_RC Serialize_TPMU_SIGNATURE(
3677     const TPMU_SIGNATURE& value,
3678     std::string* buffer);
3679 
3680 TRUNKS_EXPORT TPM_RC Parse_TPMU_SIGNATURE(
3681     std::string* buffer,
3682     TPMU_SIGNATURE* value,
3683     std::string* value_bytes);
3684 
3685 TRUNKS_EXPORT TPM_RC Serialize_TPMU_ENCRYPTED_SECRET(
3686     const TPMU_ENCRYPTED_SECRET& value,
3687     std::string* buffer);
3688 
3689 TRUNKS_EXPORT TPM_RC Parse_TPMU_ENCRYPTED_SECRET(
3690     std::string* buffer,
3691     TPMU_ENCRYPTED_SECRET* value,
3692     std::string* value_bytes);
3693 
3694 TRUNKS_EXPORT TPM_RC Serialize_TPMU_PUBLIC_ID(
3695     const TPMU_PUBLIC_ID& value,
3696     std::string* buffer);
3697 
3698 TRUNKS_EXPORT TPM_RC Parse_TPMU_PUBLIC_ID(
3699     std::string* buffer,
3700     TPMU_PUBLIC_ID* value,
3701     std::string* value_bytes);
3702 
3703 TRUNKS_EXPORT TPM_RC Serialize_TPMU_PUBLIC_PARMS(
3704     const TPMU_PUBLIC_PARMS& value,
3705     std::string* buffer);
3706 
3707 TRUNKS_EXPORT TPM_RC Parse_TPMU_PUBLIC_PARMS(
3708     std::string* buffer,
3709     TPMU_PUBLIC_PARMS* value,
3710     std::string* value_bytes);
3711 
3712 TRUNKS_EXPORT TPM_RC Serialize_TPMU_SENSITIVE_COMPOSITE(
3713     const TPMU_SENSITIVE_COMPOSITE& value,
3714     std::string* buffer);
3715 
3716 TRUNKS_EXPORT TPM_RC Parse_TPMU_SENSITIVE_COMPOSITE(
3717     std::string* buffer,
3718     TPMU_SENSITIVE_COMPOSITE* value,
3719     std::string* value_bytes);
3720 
3721 TRUNKS_EXPORT TPM_RC Serialize_TPMU_SYM_DETAILS(
3722     const TPMU_SYM_DETAILS& value,
3723     std::string* buffer);
3724 
3725 TRUNKS_EXPORT TPM_RC Parse_TPMU_SYM_DETAILS(
3726     std::string* buffer,
3727     TPMU_SYM_DETAILS* value,
3728     std::string* value_bytes);
3729 
3730 class TRUNKS_EXPORT Tpm {
3731  public:
3732   // Does not take ownership of |transceiver|.
Tpm(CommandTransceiver * transceiver)3733   explicit Tpm(CommandTransceiver* transceiver) : transceiver_(transceiver) {}
~Tpm()3734   virtual ~Tpm() {}
3735 
3736   typedef base::Callback<void(
3737       TPM_RC response_code)> StartupResponse;
3738   static TPM_RC SerializeCommand_Startup(
3739       const TPM_SU& startup_type,
3740       std::string* serialized_command,
3741       AuthorizationDelegate* authorization_delegate);
3742   static TPM_RC ParseResponse_Startup(
3743       const std::string& response,
3744       AuthorizationDelegate* authorization_delegate);
3745   virtual void Startup(
3746       const TPM_SU& startup_type,
3747       AuthorizationDelegate* authorization_delegate,
3748       const StartupResponse& callback);
3749   virtual TPM_RC StartupSync(
3750       const TPM_SU& startup_type,
3751       AuthorizationDelegate* authorization_delegate);
3752   typedef base::Callback<void(
3753       TPM_RC response_code)> ShutdownResponse;
3754   static TPM_RC SerializeCommand_Shutdown(
3755       const TPM_SU& shutdown_type,
3756       std::string* serialized_command,
3757       AuthorizationDelegate* authorization_delegate);
3758   static TPM_RC ParseResponse_Shutdown(
3759       const std::string& response,
3760       AuthorizationDelegate* authorization_delegate);
3761   virtual void Shutdown(
3762       const TPM_SU& shutdown_type,
3763       AuthorizationDelegate* authorization_delegate,
3764       const ShutdownResponse& callback);
3765   virtual TPM_RC ShutdownSync(
3766       const TPM_SU& shutdown_type,
3767       AuthorizationDelegate* authorization_delegate);
3768   typedef base::Callback<void(
3769       TPM_RC response_code)> SelfTestResponse;
3770   static TPM_RC SerializeCommand_SelfTest(
3771       const TPMI_YES_NO& full_test,
3772       std::string* serialized_command,
3773       AuthorizationDelegate* authorization_delegate);
3774   static TPM_RC ParseResponse_SelfTest(
3775       const std::string& response,
3776       AuthorizationDelegate* authorization_delegate);
3777   virtual void SelfTest(
3778       const TPMI_YES_NO& full_test,
3779       AuthorizationDelegate* authorization_delegate,
3780       const SelfTestResponse& callback);
3781   virtual TPM_RC SelfTestSync(
3782       const TPMI_YES_NO& full_test,
3783       AuthorizationDelegate* authorization_delegate);
3784   typedef base::Callback<void(
3785       TPM_RC response_code,
3786       const TPML_ALG& to_do_list)> IncrementalSelfTestResponse;
3787   static TPM_RC SerializeCommand_IncrementalSelfTest(
3788       const TPML_ALG& to_test,
3789       std::string* serialized_command,
3790       AuthorizationDelegate* authorization_delegate);
3791   static TPM_RC ParseResponse_IncrementalSelfTest(
3792       const std::string& response,
3793       TPML_ALG* to_do_list,
3794       AuthorizationDelegate* authorization_delegate);
3795   virtual void IncrementalSelfTest(
3796       const TPML_ALG& to_test,
3797       AuthorizationDelegate* authorization_delegate,
3798       const IncrementalSelfTestResponse& callback);
3799   virtual TPM_RC IncrementalSelfTestSync(
3800       const TPML_ALG& to_test,
3801       TPML_ALG* to_do_list,
3802       AuthorizationDelegate* authorization_delegate);
3803   typedef base::Callback<void(
3804       TPM_RC response_code,
3805       const TPM2B_MAX_BUFFER& out_data,
3806       const TPM_RC& test_result)> GetTestResultResponse;
3807   static TPM_RC SerializeCommand_GetTestResult(
3808       std::string* serialized_command,
3809       AuthorizationDelegate* authorization_delegate);
3810   static TPM_RC ParseResponse_GetTestResult(
3811       const std::string& response,
3812       TPM2B_MAX_BUFFER* out_data,
3813       TPM_RC* test_result,
3814       AuthorizationDelegate* authorization_delegate);
3815   virtual void GetTestResult(
3816       AuthorizationDelegate* authorization_delegate,
3817       const GetTestResultResponse& callback);
3818   virtual TPM_RC GetTestResultSync(
3819       TPM2B_MAX_BUFFER* out_data,
3820       TPM_RC* test_result,
3821       AuthorizationDelegate* authorization_delegate);
3822   typedef base::Callback<void(
3823       TPM_RC response_code,
3824       const TPMI_SH_AUTH_SESSION& session_handle,
3825       const TPM2B_NONCE& nonce_tpm)> StartAuthSessionResponse;
3826   static TPM_RC SerializeCommand_StartAuthSession(
3827       const TPMI_DH_OBJECT& tpm_key,
3828       const std::string& tpm_key_name,
3829       const TPMI_DH_ENTITY& bind,
3830       const std::string& bind_name,
3831       const TPM2B_NONCE& nonce_caller,
3832       const TPM2B_ENCRYPTED_SECRET& encrypted_salt,
3833       const TPM_SE& session_type,
3834       const TPMT_SYM_DEF& symmetric,
3835       const TPMI_ALG_HASH& auth_hash,
3836       std::string* serialized_command,
3837       AuthorizationDelegate* authorization_delegate);
3838   static TPM_RC ParseResponse_StartAuthSession(
3839       const std::string& response,
3840       TPMI_SH_AUTH_SESSION* session_handle,
3841       TPM2B_NONCE* nonce_tpm,
3842       AuthorizationDelegate* authorization_delegate);
3843   virtual void StartAuthSession(
3844       const TPMI_DH_OBJECT& tpm_key,
3845       const std::string& tpm_key_name,
3846       const TPMI_DH_ENTITY& bind,
3847       const std::string& bind_name,
3848       const TPM2B_NONCE& nonce_caller,
3849       const TPM2B_ENCRYPTED_SECRET& encrypted_salt,
3850       const TPM_SE& session_type,
3851       const TPMT_SYM_DEF& symmetric,
3852       const TPMI_ALG_HASH& auth_hash,
3853       AuthorizationDelegate* authorization_delegate,
3854       const StartAuthSessionResponse& callback);
3855   virtual TPM_RC StartAuthSessionSync(
3856       const TPMI_DH_OBJECT& tpm_key,
3857       const std::string& tpm_key_name,
3858       const TPMI_DH_ENTITY& bind,
3859       const std::string& bind_name,
3860       const TPM2B_NONCE& nonce_caller,
3861       const TPM2B_ENCRYPTED_SECRET& encrypted_salt,
3862       const TPM_SE& session_type,
3863       const TPMT_SYM_DEF& symmetric,
3864       const TPMI_ALG_HASH& auth_hash,
3865       TPMI_SH_AUTH_SESSION* session_handle,
3866       TPM2B_NONCE* nonce_tpm,
3867       AuthorizationDelegate* authorization_delegate);
3868   typedef base::Callback<void(
3869       TPM_RC response_code)> PolicyRestartResponse;
3870   static TPM_RC SerializeCommand_PolicyRestart(
3871       const TPMI_SH_POLICY& session_handle,
3872       const std::string& session_handle_name,
3873       std::string* serialized_command,
3874       AuthorizationDelegate* authorization_delegate);
3875   static TPM_RC ParseResponse_PolicyRestart(
3876       const std::string& response,
3877       AuthorizationDelegate* authorization_delegate);
3878   virtual void PolicyRestart(
3879       const TPMI_SH_POLICY& session_handle,
3880       const std::string& session_handle_name,
3881       AuthorizationDelegate* authorization_delegate,
3882       const PolicyRestartResponse& callback);
3883   virtual TPM_RC PolicyRestartSync(
3884       const TPMI_SH_POLICY& session_handle,
3885       const std::string& session_handle_name,
3886       AuthorizationDelegate* authorization_delegate);
3887   typedef base::Callback<void(
3888       TPM_RC response_code,
3889       const TPM2B_PRIVATE& out_private,
3890       const TPM2B_PUBLIC& out_public,
3891       const TPM2B_CREATION_DATA& creation_data,
3892       const TPM2B_DIGEST& creation_hash,
3893       const TPMT_TK_CREATION& creation_ticket)> CreateResponse;
3894   static TPM_RC SerializeCommand_Create(
3895       const TPMI_DH_OBJECT& parent_handle,
3896       const std::string& parent_handle_name,
3897       const TPM2B_SENSITIVE_CREATE& in_sensitive,
3898       const TPM2B_PUBLIC& in_public,
3899       const TPM2B_DATA& outside_info,
3900       const TPML_PCR_SELECTION& creation_pcr,
3901       std::string* serialized_command,
3902       AuthorizationDelegate* authorization_delegate);
3903   static TPM_RC ParseResponse_Create(
3904       const std::string& response,
3905       TPM2B_PRIVATE* out_private,
3906       TPM2B_PUBLIC* out_public,
3907       TPM2B_CREATION_DATA* creation_data,
3908       TPM2B_DIGEST* creation_hash,
3909       TPMT_TK_CREATION* creation_ticket,
3910       AuthorizationDelegate* authorization_delegate);
3911   virtual void Create(
3912       const TPMI_DH_OBJECT& parent_handle,
3913       const std::string& parent_handle_name,
3914       const TPM2B_SENSITIVE_CREATE& in_sensitive,
3915       const TPM2B_PUBLIC& in_public,
3916       const TPM2B_DATA& outside_info,
3917       const TPML_PCR_SELECTION& creation_pcr,
3918       AuthorizationDelegate* authorization_delegate,
3919       const CreateResponse& callback);
3920   virtual TPM_RC CreateSync(
3921       const TPMI_DH_OBJECT& parent_handle,
3922       const std::string& parent_handle_name,
3923       const TPM2B_SENSITIVE_CREATE& in_sensitive,
3924       const TPM2B_PUBLIC& in_public,
3925       const TPM2B_DATA& outside_info,
3926       const TPML_PCR_SELECTION& creation_pcr,
3927       TPM2B_PRIVATE* out_private,
3928       TPM2B_PUBLIC* out_public,
3929       TPM2B_CREATION_DATA* creation_data,
3930       TPM2B_DIGEST* creation_hash,
3931       TPMT_TK_CREATION* creation_ticket,
3932       AuthorizationDelegate* authorization_delegate);
3933   typedef base::Callback<void(
3934       TPM_RC response_code,
3935       const TPM_HANDLE& object_handle,
3936       const TPM2B_NAME& name)> LoadResponse;
3937   static TPM_RC SerializeCommand_Load(
3938       const TPMI_DH_OBJECT& parent_handle,
3939       const std::string& parent_handle_name,
3940       const TPM2B_PRIVATE& in_private,
3941       const TPM2B_PUBLIC& in_public,
3942       std::string* serialized_command,
3943       AuthorizationDelegate* authorization_delegate);
3944   static TPM_RC ParseResponse_Load(
3945       const std::string& response,
3946       TPM_HANDLE* object_handle,
3947       TPM2B_NAME* name,
3948       AuthorizationDelegate* authorization_delegate);
3949   virtual void Load(
3950       const TPMI_DH_OBJECT& parent_handle,
3951       const std::string& parent_handle_name,
3952       const TPM2B_PRIVATE& in_private,
3953       const TPM2B_PUBLIC& in_public,
3954       AuthorizationDelegate* authorization_delegate,
3955       const LoadResponse& callback);
3956   virtual TPM_RC LoadSync(
3957       const TPMI_DH_OBJECT& parent_handle,
3958       const std::string& parent_handle_name,
3959       const TPM2B_PRIVATE& in_private,
3960       const TPM2B_PUBLIC& in_public,
3961       TPM_HANDLE* object_handle,
3962       TPM2B_NAME* name,
3963       AuthorizationDelegate* authorization_delegate);
3964   typedef base::Callback<void(
3965       TPM_RC response_code,
3966       const TPM_HANDLE& object_handle,
3967       const TPM2B_NAME& name)> LoadExternalResponse;
3968   static TPM_RC SerializeCommand_LoadExternal(
3969       const TPM2B_SENSITIVE& in_private,
3970       const TPM2B_PUBLIC& in_public,
3971       const TPMI_RH_HIERARCHY& hierarchy,
3972       std::string* serialized_command,
3973       AuthorizationDelegate* authorization_delegate);
3974   static TPM_RC ParseResponse_LoadExternal(
3975       const std::string& response,
3976       TPM_HANDLE* object_handle,
3977       TPM2B_NAME* name,
3978       AuthorizationDelegate* authorization_delegate);
3979   virtual void LoadExternal(
3980       const TPM2B_SENSITIVE& in_private,
3981       const TPM2B_PUBLIC& in_public,
3982       const TPMI_RH_HIERARCHY& hierarchy,
3983       AuthorizationDelegate* authorization_delegate,
3984       const LoadExternalResponse& callback);
3985   virtual TPM_RC LoadExternalSync(
3986       const TPM2B_SENSITIVE& in_private,
3987       const TPM2B_PUBLIC& in_public,
3988       const TPMI_RH_HIERARCHY& hierarchy,
3989       TPM_HANDLE* object_handle,
3990       TPM2B_NAME* name,
3991       AuthorizationDelegate* authorization_delegate);
3992   typedef base::Callback<void(
3993       TPM_RC response_code,
3994       const TPM2B_PUBLIC& out_public,
3995       const TPM2B_NAME& name,
3996       const TPM2B_NAME& qualified_name)> ReadPublicResponse;
3997   static TPM_RC SerializeCommand_ReadPublic(
3998       const TPMI_DH_OBJECT& object_handle,
3999       const std::string& object_handle_name,
4000       std::string* serialized_command,
4001       AuthorizationDelegate* authorization_delegate);
4002   static TPM_RC ParseResponse_ReadPublic(
4003       const std::string& response,
4004       TPM2B_PUBLIC* out_public,
4005       TPM2B_NAME* name,
4006       TPM2B_NAME* qualified_name,
4007       AuthorizationDelegate* authorization_delegate);
4008   virtual void ReadPublic(
4009       const TPMI_DH_OBJECT& object_handle,
4010       const std::string& object_handle_name,
4011       AuthorizationDelegate* authorization_delegate,
4012       const ReadPublicResponse& callback);
4013   virtual TPM_RC ReadPublicSync(
4014       const TPMI_DH_OBJECT& object_handle,
4015       const std::string& object_handle_name,
4016       TPM2B_PUBLIC* out_public,
4017       TPM2B_NAME* name,
4018       TPM2B_NAME* qualified_name,
4019       AuthorizationDelegate* authorization_delegate);
4020   typedef base::Callback<void(
4021       TPM_RC response_code,
4022       const TPM2B_DIGEST& cert_info)> ActivateCredentialResponse;
4023   static TPM_RC SerializeCommand_ActivateCredential(
4024       const TPMI_DH_OBJECT& activate_handle,
4025       const std::string& activate_handle_name,
4026       const TPMI_DH_OBJECT& key_handle,
4027       const std::string& key_handle_name,
4028       const TPM2B_ID_OBJECT& credential_blob,
4029       const TPM2B_ENCRYPTED_SECRET& secret,
4030       std::string* serialized_command,
4031       AuthorizationDelegate* authorization_delegate);
4032   static TPM_RC ParseResponse_ActivateCredential(
4033       const std::string& response,
4034       TPM2B_DIGEST* cert_info,
4035       AuthorizationDelegate* authorization_delegate);
4036   virtual void ActivateCredential(
4037       const TPMI_DH_OBJECT& activate_handle,
4038       const std::string& activate_handle_name,
4039       const TPMI_DH_OBJECT& key_handle,
4040       const std::string& key_handle_name,
4041       const TPM2B_ID_OBJECT& credential_blob,
4042       const TPM2B_ENCRYPTED_SECRET& secret,
4043       AuthorizationDelegate* authorization_delegate,
4044       const ActivateCredentialResponse& callback);
4045   virtual TPM_RC ActivateCredentialSync(
4046       const TPMI_DH_OBJECT& activate_handle,
4047       const std::string& activate_handle_name,
4048       const TPMI_DH_OBJECT& key_handle,
4049       const std::string& key_handle_name,
4050       const TPM2B_ID_OBJECT& credential_blob,
4051       const TPM2B_ENCRYPTED_SECRET& secret,
4052       TPM2B_DIGEST* cert_info,
4053       AuthorizationDelegate* authorization_delegate);
4054   typedef base::Callback<void(
4055       TPM_RC response_code,
4056       const TPM2B_ID_OBJECT& credential_blob,
4057       const TPM2B_ENCRYPTED_SECRET& secret)> MakeCredentialResponse;
4058   static TPM_RC SerializeCommand_MakeCredential(
4059       const TPMI_DH_OBJECT& handle,
4060       const std::string& handle_name,
4061       const TPM2B_DIGEST& credential,
4062       const TPM2B_NAME& object_name,
4063       std::string* serialized_command,
4064       AuthorizationDelegate* authorization_delegate);
4065   static TPM_RC ParseResponse_MakeCredential(
4066       const std::string& response,
4067       TPM2B_ID_OBJECT* credential_blob,
4068       TPM2B_ENCRYPTED_SECRET* secret,
4069       AuthorizationDelegate* authorization_delegate);
4070   virtual void MakeCredential(
4071       const TPMI_DH_OBJECT& handle,
4072       const std::string& handle_name,
4073       const TPM2B_DIGEST& credential,
4074       const TPM2B_NAME& object_name,
4075       AuthorizationDelegate* authorization_delegate,
4076       const MakeCredentialResponse& callback);
4077   virtual TPM_RC MakeCredentialSync(
4078       const TPMI_DH_OBJECT& handle,
4079       const std::string& handle_name,
4080       const TPM2B_DIGEST& credential,
4081       const TPM2B_NAME& object_name,
4082       TPM2B_ID_OBJECT* credential_blob,
4083       TPM2B_ENCRYPTED_SECRET* secret,
4084       AuthorizationDelegate* authorization_delegate);
4085   typedef base::Callback<void(
4086       TPM_RC response_code,
4087       const TPM2B_SENSITIVE_DATA& out_data)> UnsealResponse;
4088   static TPM_RC SerializeCommand_Unseal(
4089       const TPMI_DH_OBJECT& item_handle,
4090       const std::string& item_handle_name,
4091       std::string* serialized_command,
4092       AuthorizationDelegate* authorization_delegate);
4093   static TPM_RC ParseResponse_Unseal(
4094       const std::string& response,
4095       TPM2B_SENSITIVE_DATA* out_data,
4096       AuthorizationDelegate* authorization_delegate);
4097   virtual void Unseal(
4098       const TPMI_DH_OBJECT& item_handle,
4099       const std::string& item_handle_name,
4100       AuthorizationDelegate* authorization_delegate,
4101       const UnsealResponse& callback);
4102   virtual TPM_RC UnsealSync(
4103       const TPMI_DH_OBJECT& item_handle,
4104       const std::string& item_handle_name,
4105       TPM2B_SENSITIVE_DATA* out_data,
4106       AuthorizationDelegate* authorization_delegate);
4107   typedef base::Callback<void(
4108       TPM_RC response_code,
4109       const TPM2B_PRIVATE& out_private)> ObjectChangeAuthResponse;
4110   static TPM_RC SerializeCommand_ObjectChangeAuth(
4111       const TPMI_DH_OBJECT& object_handle,
4112       const std::string& object_handle_name,
4113       const TPMI_DH_OBJECT& parent_handle,
4114       const std::string& parent_handle_name,
4115       const TPM2B_AUTH& new_auth,
4116       std::string* serialized_command,
4117       AuthorizationDelegate* authorization_delegate);
4118   static TPM_RC ParseResponse_ObjectChangeAuth(
4119       const std::string& response,
4120       TPM2B_PRIVATE* out_private,
4121       AuthorizationDelegate* authorization_delegate);
4122   virtual void ObjectChangeAuth(
4123       const TPMI_DH_OBJECT& object_handle,
4124       const std::string& object_handle_name,
4125       const TPMI_DH_OBJECT& parent_handle,
4126       const std::string& parent_handle_name,
4127       const TPM2B_AUTH& new_auth,
4128       AuthorizationDelegate* authorization_delegate,
4129       const ObjectChangeAuthResponse& callback);
4130   virtual TPM_RC ObjectChangeAuthSync(
4131       const TPMI_DH_OBJECT& object_handle,
4132       const std::string& object_handle_name,
4133       const TPMI_DH_OBJECT& parent_handle,
4134       const std::string& parent_handle_name,
4135       const TPM2B_AUTH& new_auth,
4136       TPM2B_PRIVATE* out_private,
4137       AuthorizationDelegate* authorization_delegate);
4138   typedef base::Callback<void(
4139       TPM_RC response_code,
4140       const TPM2B_DATA& encryption_key_out,
4141       const TPM2B_PRIVATE& duplicate,
4142       const TPM2B_ENCRYPTED_SECRET& out_sym_seed)> DuplicateResponse;
4143   static TPM_RC SerializeCommand_Duplicate(
4144       const TPMI_DH_OBJECT& object_handle,
4145       const std::string& object_handle_name,
4146       const TPMI_DH_OBJECT& new_parent_handle,
4147       const std::string& new_parent_handle_name,
4148       const TPM2B_DATA& encryption_key_in,
4149       const TPMT_SYM_DEF_OBJECT& symmetric_alg,
4150       std::string* serialized_command,
4151       AuthorizationDelegate* authorization_delegate);
4152   static TPM_RC ParseResponse_Duplicate(
4153       const std::string& response,
4154       TPM2B_DATA* encryption_key_out,
4155       TPM2B_PRIVATE* duplicate,
4156       TPM2B_ENCRYPTED_SECRET* out_sym_seed,
4157       AuthorizationDelegate* authorization_delegate);
4158   virtual void Duplicate(
4159       const TPMI_DH_OBJECT& object_handle,
4160       const std::string& object_handle_name,
4161       const TPMI_DH_OBJECT& new_parent_handle,
4162       const std::string& new_parent_handle_name,
4163       const TPM2B_DATA& encryption_key_in,
4164       const TPMT_SYM_DEF_OBJECT& symmetric_alg,
4165       AuthorizationDelegate* authorization_delegate,
4166       const DuplicateResponse& callback);
4167   virtual TPM_RC DuplicateSync(
4168       const TPMI_DH_OBJECT& object_handle,
4169       const std::string& object_handle_name,
4170       const TPMI_DH_OBJECT& new_parent_handle,
4171       const std::string& new_parent_handle_name,
4172       const TPM2B_DATA& encryption_key_in,
4173       const TPMT_SYM_DEF_OBJECT& symmetric_alg,
4174       TPM2B_DATA* encryption_key_out,
4175       TPM2B_PRIVATE* duplicate,
4176       TPM2B_ENCRYPTED_SECRET* out_sym_seed,
4177       AuthorizationDelegate* authorization_delegate);
4178   typedef base::Callback<void(
4179       TPM_RC response_code,
4180       const TPM2B_PRIVATE& out_duplicate,
4181       const TPM2B_ENCRYPTED_SECRET& out_sym_seed)> RewrapResponse;
4182   static TPM_RC SerializeCommand_Rewrap(
4183       const TPMI_DH_OBJECT& old_parent,
4184       const std::string& old_parent_name,
4185       const TPMI_DH_OBJECT& new_parent,
4186       const std::string& new_parent_name,
4187       const TPM2B_PRIVATE& in_duplicate,
4188       const TPM2B_NAME& name,
4189       const TPM2B_ENCRYPTED_SECRET& in_sym_seed,
4190       std::string* serialized_command,
4191       AuthorizationDelegate* authorization_delegate);
4192   static TPM_RC ParseResponse_Rewrap(
4193       const std::string& response,
4194       TPM2B_PRIVATE* out_duplicate,
4195       TPM2B_ENCRYPTED_SECRET* out_sym_seed,
4196       AuthorizationDelegate* authorization_delegate);
4197   virtual void Rewrap(
4198       const TPMI_DH_OBJECT& old_parent,
4199       const std::string& old_parent_name,
4200       const TPMI_DH_OBJECT& new_parent,
4201       const std::string& new_parent_name,
4202       const TPM2B_PRIVATE& in_duplicate,
4203       const TPM2B_NAME& name,
4204       const TPM2B_ENCRYPTED_SECRET& in_sym_seed,
4205       AuthorizationDelegate* authorization_delegate,
4206       const RewrapResponse& callback);
4207   virtual TPM_RC RewrapSync(
4208       const TPMI_DH_OBJECT& old_parent,
4209       const std::string& old_parent_name,
4210       const TPMI_DH_OBJECT& new_parent,
4211       const std::string& new_parent_name,
4212       const TPM2B_PRIVATE& in_duplicate,
4213       const TPM2B_NAME& name,
4214       const TPM2B_ENCRYPTED_SECRET& in_sym_seed,
4215       TPM2B_PRIVATE* out_duplicate,
4216       TPM2B_ENCRYPTED_SECRET* out_sym_seed,
4217       AuthorizationDelegate* authorization_delegate);
4218   typedef base::Callback<void(
4219       TPM_RC response_code,
4220       const TPM2B_PRIVATE& out_private)> ImportResponse;
4221   static TPM_RC SerializeCommand_Import(
4222       const TPMI_DH_OBJECT& parent_handle,
4223       const std::string& parent_handle_name,
4224       const TPM2B_DATA& encryption_key,
4225       const TPM2B_PUBLIC& object_public,
4226       const TPM2B_PRIVATE& duplicate,
4227       const TPM2B_ENCRYPTED_SECRET& in_sym_seed,
4228       const TPMT_SYM_DEF_OBJECT& symmetric_alg,
4229       std::string* serialized_command,
4230       AuthorizationDelegate* authorization_delegate);
4231   static TPM_RC ParseResponse_Import(
4232       const std::string& response,
4233       TPM2B_PRIVATE* out_private,
4234       AuthorizationDelegate* authorization_delegate);
4235   virtual void Import(
4236       const TPMI_DH_OBJECT& parent_handle,
4237       const std::string& parent_handle_name,
4238       const TPM2B_DATA& encryption_key,
4239       const TPM2B_PUBLIC& object_public,
4240       const TPM2B_PRIVATE& duplicate,
4241       const TPM2B_ENCRYPTED_SECRET& in_sym_seed,
4242       const TPMT_SYM_DEF_OBJECT& symmetric_alg,
4243       AuthorizationDelegate* authorization_delegate,
4244       const ImportResponse& callback);
4245   virtual TPM_RC ImportSync(
4246       const TPMI_DH_OBJECT& parent_handle,
4247       const std::string& parent_handle_name,
4248       const TPM2B_DATA& encryption_key,
4249       const TPM2B_PUBLIC& object_public,
4250       const TPM2B_PRIVATE& duplicate,
4251       const TPM2B_ENCRYPTED_SECRET& in_sym_seed,
4252       const TPMT_SYM_DEF_OBJECT& symmetric_alg,
4253       TPM2B_PRIVATE* out_private,
4254       AuthorizationDelegate* authorization_delegate);
4255   typedef base::Callback<void(
4256       TPM_RC response_code,
4257       const TPM2B_PUBLIC_KEY_RSA& out_data)> RSA_EncryptResponse;
4258   static TPM_RC SerializeCommand_RSA_Encrypt(
4259       const TPMI_DH_OBJECT& key_handle,
4260       const std::string& key_handle_name,
4261       const TPM2B_PUBLIC_KEY_RSA& message,
4262       const TPMT_RSA_DECRYPT& in_scheme,
4263       const TPM2B_DATA& label,
4264       std::string* serialized_command,
4265       AuthorizationDelegate* authorization_delegate);
4266   static TPM_RC ParseResponse_RSA_Encrypt(
4267       const std::string& response,
4268       TPM2B_PUBLIC_KEY_RSA* out_data,
4269       AuthorizationDelegate* authorization_delegate);
4270   virtual void RSA_Encrypt(
4271       const TPMI_DH_OBJECT& key_handle,
4272       const std::string& key_handle_name,
4273       const TPM2B_PUBLIC_KEY_RSA& message,
4274       const TPMT_RSA_DECRYPT& in_scheme,
4275       const TPM2B_DATA& label,
4276       AuthorizationDelegate* authorization_delegate,
4277       const RSA_EncryptResponse& callback);
4278   virtual TPM_RC RSA_EncryptSync(
4279       const TPMI_DH_OBJECT& key_handle,
4280       const std::string& key_handle_name,
4281       const TPM2B_PUBLIC_KEY_RSA& message,
4282       const TPMT_RSA_DECRYPT& in_scheme,
4283       const TPM2B_DATA& label,
4284       TPM2B_PUBLIC_KEY_RSA* out_data,
4285       AuthorizationDelegate* authorization_delegate);
4286   typedef base::Callback<void(
4287       TPM_RC response_code,
4288       const TPM2B_PUBLIC_KEY_RSA& message)> RSA_DecryptResponse;
4289   static TPM_RC SerializeCommand_RSA_Decrypt(
4290       const TPMI_DH_OBJECT& key_handle,
4291       const std::string& key_handle_name,
4292       const TPM2B_PUBLIC_KEY_RSA& cipher_text,
4293       const TPMT_RSA_DECRYPT& in_scheme,
4294       const TPM2B_DATA& label,
4295       std::string* serialized_command,
4296       AuthorizationDelegate* authorization_delegate);
4297   static TPM_RC ParseResponse_RSA_Decrypt(
4298       const std::string& response,
4299       TPM2B_PUBLIC_KEY_RSA* message,
4300       AuthorizationDelegate* authorization_delegate);
4301   virtual void RSA_Decrypt(
4302       const TPMI_DH_OBJECT& key_handle,
4303       const std::string& key_handle_name,
4304       const TPM2B_PUBLIC_KEY_RSA& cipher_text,
4305       const TPMT_RSA_DECRYPT& in_scheme,
4306       const TPM2B_DATA& label,
4307       AuthorizationDelegate* authorization_delegate,
4308       const RSA_DecryptResponse& callback);
4309   virtual TPM_RC RSA_DecryptSync(
4310       const TPMI_DH_OBJECT& key_handle,
4311       const std::string& key_handle_name,
4312       const TPM2B_PUBLIC_KEY_RSA& cipher_text,
4313       const TPMT_RSA_DECRYPT& in_scheme,
4314       const TPM2B_DATA& label,
4315       TPM2B_PUBLIC_KEY_RSA* message,
4316       AuthorizationDelegate* authorization_delegate);
4317   typedef base::Callback<void(
4318       TPM_RC response_code,
4319       const TPM2B_ECC_POINT& z_point,
4320       const TPM2B_ECC_POINT& pub_point)> ECDH_KeyGenResponse;
4321   static TPM_RC SerializeCommand_ECDH_KeyGen(
4322       const TPMI_DH_OBJECT& key_handle,
4323       const std::string& key_handle_name,
4324       std::string* serialized_command,
4325       AuthorizationDelegate* authorization_delegate);
4326   static TPM_RC ParseResponse_ECDH_KeyGen(
4327       const std::string& response,
4328       TPM2B_ECC_POINT* z_point,
4329       TPM2B_ECC_POINT* pub_point,
4330       AuthorizationDelegate* authorization_delegate);
4331   virtual void ECDH_KeyGen(
4332       const TPMI_DH_OBJECT& key_handle,
4333       const std::string& key_handle_name,
4334       AuthorizationDelegate* authorization_delegate,
4335       const ECDH_KeyGenResponse& callback);
4336   virtual TPM_RC ECDH_KeyGenSync(
4337       const TPMI_DH_OBJECT& key_handle,
4338       const std::string& key_handle_name,
4339       TPM2B_ECC_POINT* z_point,
4340       TPM2B_ECC_POINT* pub_point,
4341       AuthorizationDelegate* authorization_delegate);
4342   typedef base::Callback<void(
4343       TPM_RC response_code,
4344       const TPM2B_ECC_POINT& out_point)> ECDH_ZGenResponse;
4345   static TPM_RC SerializeCommand_ECDH_ZGen(
4346       const TPMI_DH_OBJECT& key_handle,
4347       const std::string& key_handle_name,
4348       const TPM2B_ECC_POINT& in_point,
4349       std::string* serialized_command,
4350       AuthorizationDelegate* authorization_delegate);
4351   static TPM_RC ParseResponse_ECDH_ZGen(
4352       const std::string& response,
4353       TPM2B_ECC_POINT* out_point,
4354       AuthorizationDelegate* authorization_delegate);
4355   virtual void ECDH_ZGen(
4356       const TPMI_DH_OBJECT& key_handle,
4357       const std::string& key_handle_name,
4358       const TPM2B_ECC_POINT& in_point,
4359       AuthorizationDelegate* authorization_delegate,
4360       const ECDH_ZGenResponse& callback);
4361   virtual TPM_RC ECDH_ZGenSync(
4362       const TPMI_DH_OBJECT& key_handle,
4363       const std::string& key_handle_name,
4364       const TPM2B_ECC_POINT& in_point,
4365       TPM2B_ECC_POINT* out_point,
4366       AuthorizationDelegate* authorization_delegate);
4367   typedef base::Callback<void(
4368       TPM_RC response_code,
4369       const TPMS_ALGORITHM_DETAIL_ECC& parameters)> ECC_ParametersResponse;
4370   static TPM_RC SerializeCommand_ECC_Parameters(
4371       const TPMI_ECC_CURVE& curve_id,
4372       std::string* serialized_command,
4373       AuthorizationDelegate* authorization_delegate);
4374   static TPM_RC ParseResponse_ECC_Parameters(
4375       const std::string& response,
4376       TPMS_ALGORITHM_DETAIL_ECC* parameters,
4377       AuthorizationDelegate* authorization_delegate);
4378   virtual void ECC_Parameters(
4379       const TPMI_ECC_CURVE& curve_id,
4380       AuthorizationDelegate* authorization_delegate,
4381       const ECC_ParametersResponse& callback);
4382   virtual TPM_RC ECC_ParametersSync(
4383       const TPMI_ECC_CURVE& curve_id,
4384       TPMS_ALGORITHM_DETAIL_ECC* parameters,
4385       AuthorizationDelegate* authorization_delegate);
4386   typedef base::Callback<void(
4387       TPM_RC response_code,
4388       const TPM2B_ECC_POINT& out_z1,
4389       const TPM2B_ECC_POINT& out_z2)> ZGen_2PhaseResponse;
4390   static TPM_RC SerializeCommand_ZGen_2Phase(
4391       const TPMI_DH_OBJECT& key_a,
4392       const std::string& key_a_name,
4393       const TPM2B_ECC_POINT& in_qs_b,
4394       const TPM2B_ECC_POINT& in_qe_b,
4395       const TPMI_ECC_KEY_EXCHANGE& in_scheme,
4396       const UINT16& counter,
4397       std::string* serialized_command,
4398       AuthorizationDelegate* authorization_delegate);
4399   static TPM_RC ParseResponse_ZGen_2Phase(
4400       const std::string& response,
4401       TPM2B_ECC_POINT* out_z1,
4402       TPM2B_ECC_POINT* out_z2,
4403       AuthorizationDelegate* authorization_delegate);
4404   virtual void ZGen_2Phase(
4405       const TPMI_DH_OBJECT& key_a,
4406       const std::string& key_a_name,
4407       const TPM2B_ECC_POINT& in_qs_b,
4408       const TPM2B_ECC_POINT& in_qe_b,
4409       const TPMI_ECC_KEY_EXCHANGE& in_scheme,
4410       const UINT16& counter,
4411       AuthorizationDelegate* authorization_delegate,
4412       const ZGen_2PhaseResponse& callback);
4413   virtual TPM_RC ZGen_2PhaseSync(
4414       const TPMI_DH_OBJECT& key_a,
4415       const std::string& key_a_name,
4416       const TPM2B_ECC_POINT& in_qs_b,
4417       const TPM2B_ECC_POINT& in_qe_b,
4418       const TPMI_ECC_KEY_EXCHANGE& in_scheme,
4419       const UINT16& counter,
4420       TPM2B_ECC_POINT* out_z1,
4421       TPM2B_ECC_POINT* out_z2,
4422       AuthorizationDelegate* authorization_delegate);
4423   typedef base::Callback<void(
4424       TPM_RC response_code,
4425       const TPM2B_MAX_BUFFER& out_data,
4426       const TPM2B_IV& iv_out)> EncryptDecryptResponse;
4427   static TPM_RC SerializeCommand_EncryptDecrypt(
4428       const TPMI_DH_OBJECT& key_handle,
4429       const std::string& key_handle_name,
4430       const TPMI_YES_NO& decrypt,
4431       const TPMI_ALG_SYM_MODE& mode,
4432       const TPM2B_IV& iv_in,
4433       const TPM2B_MAX_BUFFER& in_data,
4434       std::string* serialized_command,
4435       AuthorizationDelegate* authorization_delegate);
4436   static TPM_RC ParseResponse_EncryptDecrypt(
4437       const std::string& response,
4438       TPM2B_MAX_BUFFER* out_data,
4439       TPM2B_IV* iv_out,
4440       AuthorizationDelegate* authorization_delegate);
4441   virtual void EncryptDecrypt(
4442       const TPMI_DH_OBJECT& key_handle,
4443       const std::string& key_handle_name,
4444       const TPMI_YES_NO& decrypt,
4445       const TPMI_ALG_SYM_MODE& mode,
4446       const TPM2B_IV& iv_in,
4447       const TPM2B_MAX_BUFFER& in_data,
4448       AuthorizationDelegate* authorization_delegate,
4449       const EncryptDecryptResponse& callback);
4450   virtual TPM_RC EncryptDecryptSync(
4451       const TPMI_DH_OBJECT& key_handle,
4452       const std::string& key_handle_name,
4453       const TPMI_YES_NO& decrypt,
4454       const TPMI_ALG_SYM_MODE& mode,
4455       const TPM2B_IV& iv_in,
4456       const TPM2B_MAX_BUFFER& in_data,
4457       TPM2B_MAX_BUFFER* out_data,
4458       TPM2B_IV* iv_out,
4459       AuthorizationDelegate* authorization_delegate);
4460   typedef base::Callback<void(
4461       TPM_RC response_code,
4462       const TPM2B_DIGEST& out_hash,
4463       const TPMT_TK_HASHCHECK& validation)> HashResponse;
4464   static TPM_RC SerializeCommand_Hash(
4465       const TPM2B_MAX_BUFFER& data,
4466       const TPMI_ALG_HASH& hash_alg,
4467       const TPMI_RH_HIERARCHY& hierarchy,
4468       std::string* serialized_command,
4469       AuthorizationDelegate* authorization_delegate);
4470   static TPM_RC ParseResponse_Hash(
4471       const std::string& response,
4472       TPM2B_DIGEST* out_hash,
4473       TPMT_TK_HASHCHECK* validation,
4474       AuthorizationDelegate* authorization_delegate);
4475   virtual void Hash(
4476       const TPM2B_MAX_BUFFER& data,
4477       const TPMI_ALG_HASH& hash_alg,
4478       const TPMI_RH_HIERARCHY& hierarchy,
4479       AuthorizationDelegate* authorization_delegate,
4480       const HashResponse& callback);
4481   virtual TPM_RC HashSync(
4482       const TPM2B_MAX_BUFFER& data,
4483       const TPMI_ALG_HASH& hash_alg,
4484       const TPMI_RH_HIERARCHY& hierarchy,
4485       TPM2B_DIGEST* out_hash,
4486       TPMT_TK_HASHCHECK* validation,
4487       AuthorizationDelegate* authorization_delegate);
4488   typedef base::Callback<void(
4489       TPM_RC response_code,
4490       const TPM2B_DIGEST& out_hmac)> HMACResponse;
4491   static TPM_RC SerializeCommand_HMAC(
4492       const TPMI_DH_OBJECT& handle,
4493       const std::string& handle_name,
4494       const TPM2B_MAX_BUFFER& buffer,
4495       const TPMI_ALG_HASH& hash_alg,
4496       std::string* serialized_command,
4497       AuthorizationDelegate* authorization_delegate);
4498   static TPM_RC ParseResponse_HMAC(
4499       const std::string& response,
4500       TPM2B_DIGEST* out_hmac,
4501       AuthorizationDelegate* authorization_delegate);
4502   virtual void HMAC(
4503       const TPMI_DH_OBJECT& handle,
4504       const std::string& handle_name,
4505       const TPM2B_MAX_BUFFER& buffer,
4506       const TPMI_ALG_HASH& hash_alg,
4507       AuthorizationDelegate* authorization_delegate,
4508       const HMACResponse& callback);
4509   virtual TPM_RC HMACSync(
4510       const TPMI_DH_OBJECT& handle,
4511       const std::string& handle_name,
4512       const TPM2B_MAX_BUFFER& buffer,
4513       const TPMI_ALG_HASH& hash_alg,
4514       TPM2B_DIGEST* out_hmac,
4515       AuthorizationDelegate* authorization_delegate);
4516   typedef base::Callback<void(
4517       TPM_RC response_code,
4518       const TPM2B_DIGEST& random_bytes)> GetRandomResponse;
4519   static TPM_RC SerializeCommand_GetRandom(
4520       const UINT16& bytes_requested,
4521       std::string* serialized_command,
4522       AuthorizationDelegate* authorization_delegate);
4523   static TPM_RC ParseResponse_GetRandom(
4524       const std::string& response,
4525       TPM2B_DIGEST* random_bytes,
4526       AuthorizationDelegate* authorization_delegate);
4527   virtual void GetRandom(
4528       const UINT16& bytes_requested,
4529       AuthorizationDelegate* authorization_delegate,
4530       const GetRandomResponse& callback);
4531   virtual TPM_RC GetRandomSync(
4532       const UINT16& bytes_requested,
4533       TPM2B_DIGEST* random_bytes,
4534       AuthorizationDelegate* authorization_delegate);
4535   typedef base::Callback<void(
4536       TPM_RC response_code)> StirRandomResponse;
4537   static TPM_RC SerializeCommand_StirRandom(
4538       const TPM2B_SENSITIVE_DATA& in_data,
4539       std::string* serialized_command,
4540       AuthorizationDelegate* authorization_delegate);
4541   static TPM_RC ParseResponse_StirRandom(
4542       const std::string& response,
4543       AuthorizationDelegate* authorization_delegate);
4544   virtual void StirRandom(
4545       const TPM2B_SENSITIVE_DATA& in_data,
4546       AuthorizationDelegate* authorization_delegate,
4547       const StirRandomResponse& callback);
4548   virtual TPM_RC StirRandomSync(
4549       const TPM2B_SENSITIVE_DATA& in_data,
4550       AuthorizationDelegate* authorization_delegate);
4551   typedef base::Callback<void(
4552       TPM_RC response_code,
4553       const TPMI_DH_OBJECT& sequence_handle)> HMAC_StartResponse;
4554   static TPM_RC SerializeCommand_HMAC_Start(
4555       const TPMI_DH_OBJECT& handle,
4556       const std::string& handle_name,
4557       const TPM2B_AUTH& auth,
4558       const TPMI_ALG_HASH& hash_alg,
4559       std::string* serialized_command,
4560       AuthorizationDelegate* authorization_delegate);
4561   static TPM_RC ParseResponse_HMAC_Start(
4562       const std::string& response,
4563       TPMI_DH_OBJECT* sequence_handle,
4564       AuthorizationDelegate* authorization_delegate);
4565   virtual void HMAC_Start(
4566       const TPMI_DH_OBJECT& handle,
4567       const std::string& handle_name,
4568       const TPM2B_AUTH& auth,
4569       const TPMI_ALG_HASH& hash_alg,
4570       AuthorizationDelegate* authorization_delegate,
4571       const HMAC_StartResponse& callback);
4572   virtual TPM_RC HMAC_StartSync(
4573       const TPMI_DH_OBJECT& handle,
4574       const std::string& handle_name,
4575       const TPM2B_AUTH& auth,
4576       const TPMI_ALG_HASH& hash_alg,
4577       TPMI_DH_OBJECT* sequence_handle,
4578       AuthorizationDelegate* authorization_delegate);
4579   typedef base::Callback<void(
4580       TPM_RC response_code,
4581       const TPMI_DH_OBJECT& sequence_handle)> HashSequenceStartResponse;
4582   static TPM_RC SerializeCommand_HashSequenceStart(
4583       const TPM2B_AUTH& auth,
4584       const TPMI_ALG_HASH& hash_alg,
4585       std::string* serialized_command,
4586       AuthorizationDelegate* authorization_delegate);
4587   static TPM_RC ParseResponse_HashSequenceStart(
4588       const std::string& response,
4589       TPMI_DH_OBJECT* sequence_handle,
4590       AuthorizationDelegate* authorization_delegate);
4591   virtual void HashSequenceStart(
4592       const TPM2B_AUTH& auth,
4593       const TPMI_ALG_HASH& hash_alg,
4594       AuthorizationDelegate* authorization_delegate,
4595       const HashSequenceStartResponse& callback);
4596   virtual TPM_RC HashSequenceStartSync(
4597       const TPM2B_AUTH& auth,
4598       const TPMI_ALG_HASH& hash_alg,
4599       TPMI_DH_OBJECT* sequence_handle,
4600       AuthorizationDelegate* authorization_delegate);
4601   typedef base::Callback<void(
4602       TPM_RC response_code)> SequenceUpdateResponse;
4603   static TPM_RC SerializeCommand_SequenceUpdate(
4604       const TPMI_DH_OBJECT& sequence_handle,
4605       const std::string& sequence_handle_name,
4606       const TPM2B_MAX_BUFFER& buffer,
4607       std::string* serialized_command,
4608       AuthorizationDelegate* authorization_delegate);
4609   static TPM_RC ParseResponse_SequenceUpdate(
4610       const std::string& response,
4611       AuthorizationDelegate* authorization_delegate);
4612   virtual void SequenceUpdate(
4613       const TPMI_DH_OBJECT& sequence_handle,
4614       const std::string& sequence_handle_name,
4615       const TPM2B_MAX_BUFFER& buffer,
4616       AuthorizationDelegate* authorization_delegate,
4617       const SequenceUpdateResponse& callback);
4618   virtual TPM_RC SequenceUpdateSync(
4619       const TPMI_DH_OBJECT& sequence_handle,
4620       const std::string& sequence_handle_name,
4621       const TPM2B_MAX_BUFFER& buffer,
4622       AuthorizationDelegate* authorization_delegate);
4623   typedef base::Callback<void(
4624       TPM_RC response_code,
4625       const TPM2B_DIGEST& result,
4626       const TPMT_TK_HASHCHECK& validation)> SequenceCompleteResponse;
4627   static TPM_RC SerializeCommand_SequenceComplete(
4628       const TPMI_DH_OBJECT& sequence_handle,
4629       const std::string& sequence_handle_name,
4630       const TPM2B_MAX_BUFFER& buffer,
4631       const TPMI_RH_HIERARCHY& hierarchy,
4632       std::string* serialized_command,
4633       AuthorizationDelegate* authorization_delegate);
4634   static TPM_RC ParseResponse_SequenceComplete(
4635       const std::string& response,
4636       TPM2B_DIGEST* result,
4637       TPMT_TK_HASHCHECK* validation,
4638       AuthorizationDelegate* authorization_delegate);
4639   virtual void SequenceComplete(
4640       const TPMI_DH_OBJECT& sequence_handle,
4641       const std::string& sequence_handle_name,
4642       const TPM2B_MAX_BUFFER& buffer,
4643       const TPMI_RH_HIERARCHY& hierarchy,
4644       AuthorizationDelegate* authorization_delegate,
4645       const SequenceCompleteResponse& callback);
4646   virtual TPM_RC SequenceCompleteSync(
4647       const TPMI_DH_OBJECT& sequence_handle,
4648       const std::string& sequence_handle_name,
4649       const TPM2B_MAX_BUFFER& buffer,
4650       const TPMI_RH_HIERARCHY& hierarchy,
4651       TPM2B_DIGEST* result,
4652       TPMT_TK_HASHCHECK* validation,
4653       AuthorizationDelegate* authorization_delegate);
4654   typedef base::Callback<void(
4655       TPM_RC response_code,
4656       const TPML_DIGEST_VALUES& results)> EventSequenceCompleteResponse;
4657   static TPM_RC SerializeCommand_EventSequenceComplete(
4658       const TPMI_DH_PCR& pcr_handle,
4659       const std::string& pcr_handle_name,
4660       const TPMI_DH_OBJECT& sequence_handle,
4661       const std::string& sequence_handle_name,
4662       const TPM2B_MAX_BUFFER& buffer,
4663       std::string* serialized_command,
4664       AuthorizationDelegate* authorization_delegate);
4665   static TPM_RC ParseResponse_EventSequenceComplete(
4666       const std::string& response,
4667       TPML_DIGEST_VALUES* results,
4668       AuthorizationDelegate* authorization_delegate);
4669   virtual void EventSequenceComplete(
4670       const TPMI_DH_PCR& pcr_handle,
4671       const std::string& pcr_handle_name,
4672       const TPMI_DH_OBJECT& sequence_handle,
4673       const std::string& sequence_handle_name,
4674       const TPM2B_MAX_BUFFER& buffer,
4675       AuthorizationDelegate* authorization_delegate,
4676       const EventSequenceCompleteResponse& callback);
4677   virtual TPM_RC EventSequenceCompleteSync(
4678       const TPMI_DH_PCR& pcr_handle,
4679       const std::string& pcr_handle_name,
4680       const TPMI_DH_OBJECT& sequence_handle,
4681       const std::string& sequence_handle_name,
4682       const TPM2B_MAX_BUFFER& buffer,
4683       TPML_DIGEST_VALUES* results,
4684       AuthorizationDelegate* authorization_delegate);
4685   typedef base::Callback<void(
4686       TPM_RC response_code,
4687       const TPM2B_ATTEST& certify_info,
4688       const TPMT_SIGNATURE& signature)> CertifyResponse;
4689   static TPM_RC SerializeCommand_Certify(
4690       const TPMI_DH_OBJECT& object_handle,
4691       const std::string& object_handle_name,
4692       const TPMI_DH_OBJECT& sign_handle,
4693       const std::string& sign_handle_name,
4694       const TPM2B_DATA& qualifying_data,
4695       const TPMT_SIG_SCHEME& in_scheme,
4696       std::string* serialized_command,
4697       AuthorizationDelegate* authorization_delegate);
4698   static TPM_RC ParseResponse_Certify(
4699       const std::string& response,
4700       TPM2B_ATTEST* certify_info,
4701       TPMT_SIGNATURE* signature,
4702       AuthorizationDelegate* authorization_delegate);
4703   virtual void Certify(
4704       const TPMI_DH_OBJECT& object_handle,
4705       const std::string& object_handle_name,
4706       const TPMI_DH_OBJECT& sign_handle,
4707       const std::string& sign_handle_name,
4708       const TPM2B_DATA& qualifying_data,
4709       const TPMT_SIG_SCHEME& in_scheme,
4710       AuthorizationDelegate* authorization_delegate,
4711       const CertifyResponse& callback);
4712   virtual TPM_RC CertifySync(
4713       const TPMI_DH_OBJECT& object_handle,
4714       const std::string& object_handle_name,
4715       const TPMI_DH_OBJECT& sign_handle,
4716       const std::string& sign_handle_name,
4717       const TPM2B_DATA& qualifying_data,
4718       const TPMT_SIG_SCHEME& in_scheme,
4719       TPM2B_ATTEST* certify_info,
4720       TPMT_SIGNATURE* signature,
4721       AuthorizationDelegate* authorization_delegate);
4722   typedef base::Callback<void(
4723       TPM_RC response_code,
4724       const TPM2B_ATTEST& certify_info,
4725       const TPMT_SIGNATURE& signature)> CertifyCreationResponse;
4726   static TPM_RC SerializeCommand_CertifyCreation(
4727       const TPMI_DH_OBJECT& sign_handle,
4728       const std::string& sign_handle_name,
4729       const TPMI_DH_OBJECT& object_handle,
4730       const std::string& object_handle_name,
4731       const TPM2B_DATA& qualifying_data,
4732       const TPM2B_DIGEST& creation_hash,
4733       const TPMT_SIG_SCHEME& in_scheme,
4734       const TPMT_TK_CREATION& creation_ticket,
4735       std::string* serialized_command,
4736       AuthorizationDelegate* authorization_delegate);
4737   static TPM_RC ParseResponse_CertifyCreation(
4738       const std::string& response,
4739       TPM2B_ATTEST* certify_info,
4740       TPMT_SIGNATURE* signature,
4741       AuthorizationDelegate* authorization_delegate);
4742   virtual void CertifyCreation(
4743       const TPMI_DH_OBJECT& sign_handle,
4744       const std::string& sign_handle_name,
4745       const TPMI_DH_OBJECT& object_handle,
4746       const std::string& object_handle_name,
4747       const TPM2B_DATA& qualifying_data,
4748       const TPM2B_DIGEST& creation_hash,
4749       const TPMT_SIG_SCHEME& in_scheme,
4750       const TPMT_TK_CREATION& creation_ticket,
4751       AuthorizationDelegate* authorization_delegate,
4752       const CertifyCreationResponse& callback);
4753   virtual TPM_RC CertifyCreationSync(
4754       const TPMI_DH_OBJECT& sign_handle,
4755       const std::string& sign_handle_name,
4756       const TPMI_DH_OBJECT& object_handle,
4757       const std::string& object_handle_name,
4758       const TPM2B_DATA& qualifying_data,
4759       const TPM2B_DIGEST& creation_hash,
4760       const TPMT_SIG_SCHEME& in_scheme,
4761       const TPMT_TK_CREATION& creation_ticket,
4762       TPM2B_ATTEST* certify_info,
4763       TPMT_SIGNATURE* signature,
4764       AuthorizationDelegate* authorization_delegate);
4765   typedef base::Callback<void(
4766       TPM_RC response_code,
4767       const TPM2B_ATTEST& quoted,
4768       const TPMT_SIGNATURE& signature)> QuoteResponse;
4769   static TPM_RC SerializeCommand_Quote(
4770       const TPMI_DH_OBJECT& sign_handle,
4771       const std::string& sign_handle_name,
4772       const TPM2B_DATA& qualifying_data,
4773       const TPMT_SIG_SCHEME& in_scheme,
4774       const TPML_PCR_SELECTION& pcrselect,
4775       std::string* serialized_command,
4776       AuthorizationDelegate* authorization_delegate);
4777   static TPM_RC ParseResponse_Quote(
4778       const std::string& response,
4779       TPM2B_ATTEST* quoted,
4780       TPMT_SIGNATURE* signature,
4781       AuthorizationDelegate* authorization_delegate);
4782   virtual void Quote(
4783       const TPMI_DH_OBJECT& sign_handle,
4784       const std::string& sign_handle_name,
4785       const TPM2B_DATA& qualifying_data,
4786       const TPMT_SIG_SCHEME& in_scheme,
4787       const TPML_PCR_SELECTION& pcrselect,
4788       AuthorizationDelegate* authorization_delegate,
4789       const QuoteResponse& callback);
4790   virtual TPM_RC QuoteSync(
4791       const TPMI_DH_OBJECT& sign_handle,
4792       const std::string& sign_handle_name,
4793       const TPM2B_DATA& qualifying_data,
4794       const TPMT_SIG_SCHEME& in_scheme,
4795       const TPML_PCR_SELECTION& pcrselect,
4796       TPM2B_ATTEST* quoted,
4797       TPMT_SIGNATURE* signature,
4798       AuthorizationDelegate* authorization_delegate);
4799   typedef base::Callback<void(
4800       TPM_RC response_code,
4801       const TPM2B_ATTEST& audit_info,
4802       const TPMT_SIGNATURE& signature)> GetSessionAuditDigestResponse;
4803   static TPM_RC SerializeCommand_GetSessionAuditDigest(
4804       const TPMI_RH_ENDORSEMENT& privacy_admin_handle,
4805       const std::string& privacy_admin_handle_name,
4806       const TPMI_DH_OBJECT& sign_handle,
4807       const std::string& sign_handle_name,
4808       const TPMI_SH_HMAC& session_handle,
4809       const std::string& session_handle_name,
4810       const TPM2B_DATA& qualifying_data,
4811       const TPMT_SIG_SCHEME& in_scheme,
4812       std::string* serialized_command,
4813       AuthorizationDelegate* authorization_delegate);
4814   static TPM_RC ParseResponse_GetSessionAuditDigest(
4815       const std::string& response,
4816       TPM2B_ATTEST* audit_info,
4817       TPMT_SIGNATURE* signature,
4818       AuthorizationDelegate* authorization_delegate);
4819   virtual void GetSessionAuditDigest(
4820       const TPMI_RH_ENDORSEMENT& privacy_admin_handle,
4821       const std::string& privacy_admin_handle_name,
4822       const TPMI_DH_OBJECT& sign_handle,
4823       const std::string& sign_handle_name,
4824       const TPMI_SH_HMAC& session_handle,
4825       const std::string& session_handle_name,
4826       const TPM2B_DATA& qualifying_data,
4827       const TPMT_SIG_SCHEME& in_scheme,
4828       AuthorizationDelegate* authorization_delegate,
4829       const GetSessionAuditDigestResponse& callback);
4830   virtual TPM_RC GetSessionAuditDigestSync(
4831       const TPMI_RH_ENDORSEMENT& privacy_admin_handle,
4832       const std::string& privacy_admin_handle_name,
4833       const TPMI_DH_OBJECT& sign_handle,
4834       const std::string& sign_handle_name,
4835       const TPMI_SH_HMAC& session_handle,
4836       const std::string& session_handle_name,
4837       const TPM2B_DATA& qualifying_data,
4838       const TPMT_SIG_SCHEME& in_scheme,
4839       TPM2B_ATTEST* audit_info,
4840       TPMT_SIGNATURE* signature,
4841       AuthorizationDelegate* authorization_delegate);
4842   typedef base::Callback<void(
4843       TPM_RC response_code,
4844       const TPM2B_ATTEST& audit_info,
4845       const TPMT_SIGNATURE& signature)> GetCommandAuditDigestResponse;
4846   static TPM_RC SerializeCommand_GetCommandAuditDigest(
4847       const TPMI_RH_ENDORSEMENT& privacy_handle,
4848       const std::string& privacy_handle_name,
4849       const TPMI_DH_OBJECT& sign_handle,
4850       const std::string& sign_handle_name,
4851       const TPM2B_DATA& qualifying_data,
4852       const TPMT_SIG_SCHEME& in_scheme,
4853       std::string* serialized_command,
4854       AuthorizationDelegate* authorization_delegate);
4855   static TPM_RC ParseResponse_GetCommandAuditDigest(
4856       const std::string& response,
4857       TPM2B_ATTEST* audit_info,
4858       TPMT_SIGNATURE* signature,
4859       AuthorizationDelegate* authorization_delegate);
4860   virtual void GetCommandAuditDigest(
4861       const TPMI_RH_ENDORSEMENT& privacy_handle,
4862       const std::string& privacy_handle_name,
4863       const TPMI_DH_OBJECT& sign_handle,
4864       const std::string& sign_handle_name,
4865       const TPM2B_DATA& qualifying_data,
4866       const TPMT_SIG_SCHEME& in_scheme,
4867       AuthorizationDelegate* authorization_delegate,
4868       const GetCommandAuditDigestResponse& callback);
4869   virtual TPM_RC GetCommandAuditDigestSync(
4870       const TPMI_RH_ENDORSEMENT& privacy_handle,
4871       const std::string& privacy_handle_name,
4872       const TPMI_DH_OBJECT& sign_handle,
4873       const std::string& sign_handle_name,
4874       const TPM2B_DATA& qualifying_data,
4875       const TPMT_SIG_SCHEME& in_scheme,
4876       TPM2B_ATTEST* audit_info,
4877       TPMT_SIGNATURE* signature,
4878       AuthorizationDelegate* authorization_delegate);
4879   typedef base::Callback<void(
4880       TPM_RC response_code,
4881       const TPM2B_ATTEST& time_info,
4882       const TPMT_SIGNATURE& signature)> GetTimeResponse;
4883   static TPM_RC SerializeCommand_GetTime(
4884       const TPMI_RH_ENDORSEMENT& privacy_admin_handle,
4885       const std::string& privacy_admin_handle_name,
4886       const TPMI_DH_OBJECT& sign_handle,
4887       const std::string& sign_handle_name,
4888       const TPM2B_DATA& qualifying_data,
4889       const TPMT_SIG_SCHEME& in_scheme,
4890       std::string* serialized_command,
4891       AuthorizationDelegate* authorization_delegate);
4892   static TPM_RC ParseResponse_GetTime(
4893       const std::string& response,
4894       TPM2B_ATTEST* time_info,
4895       TPMT_SIGNATURE* signature,
4896       AuthorizationDelegate* authorization_delegate);
4897   virtual void GetTime(
4898       const TPMI_RH_ENDORSEMENT& privacy_admin_handle,
4899       const std::string& privacy_admin_handle_name,
4900       const TPMI_DH_OBJECT& sign_handle,
4901       const std::string& sign_handle_name,
4902       const TPM2B_DATA& qualifying_data,
4903       const TPMT_SIG_SCHEME& in_scheme,
4904       AuthorizationDelegate* authorization_delegate,
4905       const GetTimeResponse& callback);
4906   virtual TPM_RC GetTimeSync(
4907       const TPMI_RH_ENDORSEMENT& privacy_admin_handle,
4908       const std::string& privacy_admin_handle_name,
4909       const TPMI_DH_OBJECT& sign_handle,
4910       const std::string& sign_handle_name,
4911       const TPM2B_DATA& qualifying_data,
4912       const TPMT_SIG_SCHEME& in_scheme,
4913       TPM2B_ATTEST* time_info,
4914       TPMT_SIGNATURE* signature,
4915       AuthorizationDelegate* authorization_delegate);
4916   typedef base::Callback<void(
4917       TPM_RC response_code,
4918       const UINT32& param_size_out,
4919       const TPM2B_ECC_POINT& k,
4920       const TPM2B_ECC_POINT& l,
4921       const TPM2B_ECC_POINT& e,
4922       const UINT16& counter)> CommitResponse;
4923   static TPM_RC SerializeCommand_Commit(
4924       const TPMI_DH_OBJECT& sign_handle,
4925       const std::string& sign_handle_name,
4926       const UINT32& param_size,
4927       const TPM2B_ECC_POINT& p1,
4928       const TPM2B_SENSITIVE_DATA& s2,
4929       const TPM2B_ECC_PARAMETER& y2,
4930       std::string* serialized_command,
4931       AuthorizationDelegate* authorization_delegate);
4932   static TPM_RC ParseResponse_Commit(
4933       const std::string& response,
4934       UINT32* param_size_out,
4935       TPM2B_ECC_POINT* k,
4936       TPM2B_ECC_POINT* l,
4937       TPM2B_ECC_POINT* e,
4938       UINT16* counter,
4939       AuthorizationDelegate* authorization_delegate);
4940   virtual void Commit(
4941       const TPMI_DH_OBJECT& sign_handle,
4942       const std::string& sign_handle_name,
4943       const UINT32& param_size,
4944       const TPM2B_ECC_POINT& p1,
4945       const TPM2B_SENSITIVE_DATA& s2,
4946       const TPM2B_ECC_PARAMETER& y2,
4947       AuthorizationDelegate* authorization_delegate,
4948       const CommitResponse& callback);
4949   virtual TPM_RC CommitSync(
4950       const TPMI_DH_OBJECT& sign_handle,
4951       const std::string& sign_handle_name,
4952       const UINT32& param_size,
4953       const TPM2B_ECC_POINT& p1,
4954       const TPM2B_SENSITIVE_DATA& s2,
4955       const TPM2B_ECC_PARAMETER& y2,
4956       UINT32* param_size_out,
4957       TPM2B_ECC_POINT* k,
4958       TPM2B_ECC_POINT* l,
4959       TPM2B_ECC_POINT* e,
4960       UINT16* counter,
4961       AuthorizationDelegate* authorization_delegate);
4962   typedef base::Callback<void(
4963       TPM_RC response_code,
4964       const UINT32& param_size_out,
4965       const TPM2B_ECC_POINT& q,
4966       const UINT16& counter)> EC_EphemeralResponse;
4967   static TPM_RC SerializeCommand_EC_Ephemeral(
4968       const UINT32& param_size,
4969       const TPMI_ECC_CURVE& curve_id,
4970       std::string* serialized_command,
4971       AuthorizationDelegate* authorization_delegate);
4972   static TPM_RC ParseResponse_EC_Ephemeral(
4973       const std::string& response,
4974       UINT32* param_size_out,
4975       TPM2B_ECC_POINT* q,
4976       UINT16* counter,
4977       AuthorizationDelegate* authorization_delegate);
4978   virtual void EC_Ephemeral(
4979       const UINT32& param_size,
4980       const TPMI_ECC_CURVE& curve_id,
4981       AuthorizationDelegate* authorization_delegate,
4982       const EC_EphemeralResponse& callback);
4983   virtual TPM_RC EC_EphemeralSync(
4984       const UINT32& param_size,
4985       const TPMI_ECC_CURVE& curve_id,
4986       UINT32* param_size_out,
4987       TPM2B_ECC_POINT* q,
4988       UINT16* counter,
4989       AuthorizationDelegate* authorization_delegate);
4990   typedef base::Callback<void(
4991       TPM_RC response_code,
4992       const TPMT_TK_VERIFIED& validation)> VerifySignatureResponse;
4993   static TPM_RC SerializeCommand_VerifySignature(
4994       const TPMI_DH_OBJECT& key_handle,
4995       const std::string& key_handle_name,
4996       const TPM2B_DIGEST& digest,
4997       const TPMT_SIGNATURE& signature,
4998       std::string* serialized_command,
4999       AuthorizationDelegate* authorization_delegate);
5000   static TPM_RC ParseResponse_VerifySignature(
5001       const std::string& response,
5002       TPMT_TK_VERIFIED* validation,
5003       AuthorizationDelegate* authorization_delegate);
5004   virtual void VerifySignature(
5005       const TPMI_DH_OBJECT& key_handle,
5006       const std::string& key_handle_name,
5007       const TPM2B_DIGEST& digest,
5008       const TPMT_SIGNATURE& signature,
5009       AuthorizationDelegate* authorization_delegate,
5010       const VerifySignatureResponse& callback);
5011   virtual TPM_RC VerifySignatureSync(
5012       const TPMI_DH_OBJECT& key_handle,
5013       const std::string& key_handle_name,
5014       const TPM2B_DIGEST& digest,
5015       const TPMT_SIGNATURE& signature,
5016       TPMT_TK_VERIFIED* validation,
5017       AuthorizationDelegate* authorization_delegate);
5018   typedef base::Callback<void(
5019       TPM_RC response_code,
5020       const TPMT_SIGNATURE& signature)> SignResponse;
5021   static TPM_RC SerializeCommand_Sign(
5022       const TPMI_DH_OBJECT& key_handle,
5023       const std::string& key_handle_name,
5024       const TPM2B_DIGEST& digest,
5025       const TPMT_SIG_SCHEME& in_scheme,
5026       const TPMT_TK_HASHCHECK& validation,
5027       std::string* serialized_command,
5028       AuthorizationDelegate* authorization_delegate);
5029   static TPM_RC ParseResponse_Sign(
5030       const std::string& response,
5031       TPMT_SIGNATURE* signature,
5032       AuthorizationDelegate* authorization_delegate);
5033   virtual void Sign(
5034       const TPMI_DH_OBJECT& key_handle,
5035       const std::string& key_handle_name,
5036       const TPM2B_DIGEST& digest,
5037       const TPMT_SIG_SCHEME& in_scheme,
5038       const TPMT_TK_HASHCHECK& validation,
5039       AuthorizationDelegate* authorization_delegate,
5040       const SignResponse& callback);
5041   virtual TPM_RC SignSync(
5042       const TPMI_DH_OBJECT& key_handle,
5043       const std::string& key_handle_name,
5044       const TPM2B_DIGEST& digest,
5045       const TPMT_SIG_SCHEME& in_scheme,
5046       const TPMT_TK_HASHCHECK& validation,
5047       TPMT_SIGNATURE* signature,
5048       AuthorizationDelegate* authorization_delegate);
5049   typedef base::Callback<void(
5050       TPM_RC response_code)> SetCommandCodeAuditStatusResponse;
5051   static TPM_RC SerializeCommand_SetCommandCodeAuditStatus(
5052       const TPMI_RH_PROVISION& auth,
5053       const std::string& auth_name,
5054       const TPMI_ALG_HASH& audit_alg,
5055       const TPML_CC& set_list,
5056       const TPML_CC& clear_list,
5057       std::string* serialized_command,
5058       AuthorizationDelegate* authorization_delegate);
5059   static TPM_RC ParseResponse_SetCommandCodeAuditStatus(
5060       const std::string& response,
5061       AuthorizationDelegate* authorization_delegate);
5062   virtual void SetCommandCodeAuditStatus(
5063       const TPMI_RH_PROVISION& auth,
5064       const std::string& auth_name,
5065       const TPMI_ALG_HASH& audit_alg,
5066       const TPML_CC& set_list,
5067       const TPML_CC& clear_list,
5068       AuthorizationDelegate* authorization_delegate,
5069       const SetCommandCodeAuditStatusResponse& callback);
5070   virtual TPM_RC SetCommandCodeAuditStatusSync(
5071       const TPMI_RH_PROVISION& auth,
5072       const std::string& auth_name,
5073       const TPMI_ALG_HASH& audit_alg,
5074       const TPML_CC& set_list,
5075       const TPML_CC& clear_list,
5076       AuthorizationDelegate* authorization_delegate);
5077   typedef base::Callback<void(
5078       TPM_RC response_code)> PCR_ExtendResponse;
5079   static TPM_RC SerializeCommand_PCR_Extend(
5080       const TPMI_DH_PCR& pcr_handle,
5081       const std::string& pcr_handle_name,
5082       const TPML_DIGEST_VALUES& digests,
5083       std::string* serialized_command,
5084       AuthorizationDelegate* authorization_delegate);
5085   static TPM_RC ParseResponse_PCR_Extend(
5086       const std::string& response,
5087       AuthorizationDelegate* authorization_delegate);
5088   virtual void PCR_Extend(
5089       const TPMI_DH_PCR& pcr_handle,
5090       const std::string& pcr_handle_name,
5091       const TPML_DIGEST_VALUES& digests,
5092       AuthorizationDelegate* authorization_delegate,
5093       const PCR_ExtendResponse& callback);
5094   virtual TPM_RC PCR_ExtendSync(
5095       const TPMI_DH_PCR& pcr_handle,
5096       const std::string& pcr_handle_name,
5097       const TPML_DIGEST_VALUES& digests,
5098       AuthorizationDelegate* authorization_delegate);
5099   typedef base::Callback<void(
5100       TPM_RC response_code,
5101       const TPML_DIGEST_VALUES& digests)> PCR_EventResponse;
5102   static TPM_RC SerializeCommand_PCR_Event(
5103       const TPMI_DH_PCR& pcr_handle,
5104       const std::string& pcr_handle_name,
5105       const TPM2B_EVENT& event_data,
5106       std::string* serialized_command,
5107       AuthorizationDelegate* authorization_delegate);
5108   static TPM_RC ParseResponse_PCR_Event(
5109       const std::string& response,
5110       TPML_DIGEST_VALUES* digests,
5111       AuthorizationDelegate* authorization_delegate);
5112   virtual void PCR_Event(
5113       const TPMI_DH_PCR& pcr_handle,
5114       const std::string& pcr_handle_name,
5115       const TPM2B_EVENT& event_data,
5116       AuthorizationDelegate* authorization_delegate,
5117       const PCR_EventResponse& callback);
5118   virtual TPM_RC PCR_EventSync(
5119       const TPMI_DH_PCR& pcr_handle,
5120       const std::string& pcr_handle_name,
5121       const TPM2B_EVENT& event_data,
5122       TPML_DIGEST_VALUES* digests,
5123       AuthorizationDelegate* authorization_delegate);
5124   typedef base::Callback<void(
5125       TPM_RC response_code,
5126       const UINT32& pcr_update_counter,
5127       const TPML_PCR_SELECTION& pcr_selection_out,
5128       const TPML_DIGEST& pcr_values)> PCR_ReadResponse;
5129   static TPM_RC SerializeCommand_PCR_Read(
5130       const TPML_PCR_SELECTION& pcr_selection_in,
5131       std::string* serialized_command,
5132       AuthorizationDelegate* authorization_delegate);
5133   static TPM_RC ParseResponse_PCR_Read(
5134       const std::string& response,
5135       UINT32* pcr_update_counter,
5136       TPML_PCR_SELECTION* pcr_selection_out,
5137       TPML_DIGEST* pcr_values,
5138       AuthorizationDelegate* authorization_delegate);
5139   virtual void PCR_Read(
5140       const TPML_PCR_SELECTION& pcr_selection_in,
5141       AuthorizationDelegate* authorization_delegate,
5142       const PCR_ReadResponse& callback);
5143   virtual TPM_RC PCR_ReadSync(
5144       const TPML_PCR_SELECTION& pcr_selection_in,
5145       UINT32* pcr_update_counter,
5146       TPML_PCR_SELECTION* pcr_selection_out,
5147       TPML_DIGEST* pcr_values,
5148       AuthorizationDelegate* authorization_delegate);
5149   typedef base::Callback<void(
5150       TPM_RC response_code,
5151       const TPMI_YES_NO& allocation_success,
5152       const UINT32& max_pcr,
5153       const UINT32& size_needed,
5154       const UINT32& size_available)> PCR_AllocateResponse;
5155   static TPM_RC SerializeCommand_PCR_Allocate(
5156       const TPMI_RH_PLATFORM& auth_handle,
5157       const std::string& auth_handle_name,
5158       const TPML_PCR_SELECTION& pcr_allocation,
5159       std::string* serialized_command,
5160       AuthorizationDelegate* authorization_delegate);
5161   static TPM_RC ParseResponse_PCR_Allocate(
5162       const std::string& response,
5163       TPMI_YES_NO* allocation_success,
5164       UINT32* max_pcr,
5165       UINT32* size_needed,
5166       UINT32* size_available,
5167       AuthorizationDelegate* authorization_delegate);
5168   virtual void PCR_Allocate(
5169       const TPMI_RH_PLATFORM& auth_handle,
5170       const std::string& auth_handle_name,
5171       const TPML_PCR_SELECTION& pcr_allocation,
5172       AuthorizationDelegate* authorization_delegate,
5173       const PCR_AllocateResponse& callback);
5174   virtual TPM_RC PCR_AllocateSync(
5175       const TPMI_RH_PLATFORM& auth_handle,
5176       const std::string& auth_handle_name,
5177       const TPML_PCR_SELECTION& pcr_allocation,
5178       TPMI_YES_NO* allocation_success,
5179       UINT32* max_pcr,
5180       UINT32* size_needed,
5181       UINT32* size_available,
5182       AuthorizationDelegate* authorization_delegate);
5183   typedef base::Callback<void(
5184       TPM_RC response_code)> PCR_SetAuthPolicyResponse;
5185   static TPM_RC SerializeCommand_PCR_SetAuthPolicy(
5186       const TPMI_RH_PLATFORM& auth_handle,
5187       const std::string& auth_handle_name,
5188       const TPMI_DH_PCR& pcr_num,
5189       const std::string& pcr_num_name,
5190       const TPM2B_DIGEST& auth_policy,
5191       const TPMI_ALG_HASH& policy_digest,
5192       std::string* serialized_command,
5193       AuthorizationDelegate* authorization_delegate);
5194   static TPM_RC ParseResponse_PCR_SetAuthPolicy(
5195       const std::string& response,
5196       AuthorizationDelegate* authorization_delegate);
5197   virtual void PCR_SetAuthPolicy(
5198       const TPMI_RH_PLATFORM& auth_handle,
5199       const std::string& auth_handle_name,
5200       const TPMI_DH_PCR& pcr_num,
5201       const std::string& pcr_num_name,
5202       const TPM2B_DIGEST& auth_policy,
5203       const TPMI_ALG_HASH& policy_digest,
5204       AuthorizationDelegate* authorization_delegate,
5205       const PCR_SetAuthPolicyResponse& callback);
5206   virtual TPM_RC PCR_SetAuthPolicySync(
5207       const TPMI_RH_PLATFORM& auth_handle,
5208       const std::string& auth_handle_name,
5209       const TPMI_DH_PCR& pcr_num,
5210       const std::string& pcr_num_name,
5211       const TPM2B_DIGEST& auth_policy,
5212       const TPMI_ALG_HASH& policy_digest,
5213       AuthorizationDelegate* authorization_delegate);
5214   typedef base::Callback<void(
5215       TPM_RC response_code)> PCR_SetAuthValueResponse;
5216   static TPM_RC SerializeCommand_PCR_SetAuthValue(
5217       const TPMI_DH_PCR& pcr_handle,
5218       const std::string& pcr_handle_name,
5219       const TPM2B_DIGEST& auth,
5220       std::string* serialized_command,
5221       AuthorizationDelegate* authorization_delegate);
5222   static TPM_RC ParseResponse_PCR_SetAuthValue(
5223       const std::string& response,
5224       AuthorizationDelegate* authorization_delegate);
5225   virtual void PCR_SetAuthValue(
5226       const TPMI_DH_PCR& pcr_handle,
5227       const std::string& pcr_handle_name,
5228       const TPM2B_DIGEST& auth,
5229       AuthorizationDelegate* authorization_delegate,
5230       const PCR_SetAuthValueResponse& callback);
5231   virtual TPM_RC PCR_SetAuthValueSync(
5232       const TPMI_DH_PCR& pcr_handle,
5233       const std::string& pcr_handle_name,
5234       const TPM2B_DIGEST& auth,
5235       AuthorizationDelegate* authorization_delegate);
5236   typedef base::Callback<void(
5237       TPM_RC response_code)> PCR_ResetResponse;
5238   static TPM_RC SerializeCommand_PCR_Reset(
5239       const TPMI_DH_PCR& pcr_handle,
5240       const std::string& pcr_handle_name,
5241       std::string* serialized_command,
5242       AuthorizationDelegate* authorization_delegate);
5243   static TPM_RC ParseResponse_PCR_Reset(
5244       const std::string& response,
5245       AuthorizationDelegate* authorization_delegate);
5246   virtual void PCR_Reset(
5247       const TPMI_DH_PCR& pcr_handle,
5248       const std::string& pcr_handle_name,
5249       AuthorizationDelegate* authorization_delegate,
5250       const PCR_ResetResponse& callback);
5251   virtual TPM_RC PCR_ResetSync(
5252       const TPMI_DH_PCR& pcr_handle,
5253       const std::string& pcr_handle_name,
5254       AuthorizationDelegate* authorization_delegate);
5255   typedef base::Callback<void(
5256       TPM_RC response_code,
5257       const TPM2B_TIMEOUT& timeout,
5258       const TPMT_TK_AUTH& policy_ticket)> PolicySignedResponse;
5259   static TPM_RC SerializeCommand_PolicySigned(
5260       const TPMI_DH_OBJECT& auth_object,
5261       const std::string& auth_object_name,
5262       const TPMI_SH_POLICY& policy_session,
5263       const std::string& policy_session_name,
5264       const TPM2B_NONCE& nonce_tpm,
5265       const TPM2B_DIGEST& cp_hash_a,
5266       const TPM2B_NONCE& policy_ref,
5267       const INT32& expiration,
5268       const TPMT_SIGNATURE& auth,
5269       std::string* serialized_command,
5270       AuthorizationDelegate* authorization_delegate);
5271   static TPM_RC ParseResponse_PolicySigned(
5272       const std::string& response,
5273       TPM2B_TIMEOUT* timeout,
5274       TPMT_TK_AUTH* policy_ticket,
5275       AuthorizationDelegate* authorization_delegate);
5276   virtual void PolicySigned(
5277       const TPMI_DH_OBJECT& auth_object,
5278       const std::string& auth_object_name,
5279       const TPMI_SH_POLICY& policy_session,
5280       const std::string& policy_session_name,
5281       const TPM2B_NONCE& nonce_tpm,
5282       const TPM2B_DIGEST& cp_hash_a,
5283       const TPM2B_NONCE& policy_ref,
5284       const INT32& expiration,
5285       const TPMT_SIGNATURE& auth,
5286       AuthorizationDelegate* authorization_delegate,
5287       const PolicySignedResponse& callback);
5288   virtual TPM_RC PolicySignedSync(
5289       const TPMI_DH_OBJECT& auth_object,
5290       const std::string& auth_object_name,
5291       const TPMI_SH_POLICY& policy_session,
5292       const std::string& policy_session_name,
5293       const TPM2B_NONCE& nonce_tpm,
5294       const TPM2B_DIGEST& cp_hash_a,
5295       const TPM2B_NONCE& policy_ref,
5296       const INT32& expiration,
5297       const TPMT_SIGNATURE& auth,
5298       TPM2B_TIMEOUT* timeout,
5299       TPMT_TK_AUTH* policy_ticket,
5300       AuthorizationDelegate* authorization_delegate);
5301   typedef base::Callback<void(
5302       TPM_RC response_code,
5303       const TPM2B_TIMEOUT& timeout,
5304       const TPMT_TK_AUTH& policy_ticket)> PolicySecretResponse;
5305   static TPM_RC SerializeCommand_PolicySecret(
5306       const TPMI_DH_ENTITY& auth_handle,
5307       const std::string& auth_handle_name,
5308       const TPMI_SH_POLICY& policy_session,
5309       const std::string& policy_session_name,
5310       const TPM2B_NONCE& nonce_tpm,
5311       const TPM2B_DIGEST& cp_hash_a,
5312       const TPM2B_NONCE& policy_ref,
5313       const INT32& expiration,
5314       std::string* serialized_command,
5315       AuthorizationDelegate* authorization_delegate);
5316   static TPM_RC ParseResponse_PolicySecret(
5317       const std::string& response,
5318       TPM2B_TIMEOUT* timeout,
5319       TPMT_TK_AUTH* policy_ticket,
5320       AuthorizationDelegate* authorization_delegate);
5321   virtual void PolicySecret(
5322       const TPMI_DH_ENTITY& auth_handle,
5323       const std::string& auth_handle_name,
5324       const TPMI_SH_POLICY& policy_session,
5325       const std::string& policy_session_name,
5326       const TPM2B_NONCE& nonce_tpm,
5327       const TPM2B_DIGEST& cp_hash_a,
5328       const TPM2B_NONCE& policy_ref,
5329       const INT32& expiration,
5330       AuthorizationDelegate* authorization_delegate,
5331       const PolicySecretResponse& callback);
5332   virtual TPM_RC PolicySecretSync(
5333       const TPMI_DH_ENTITY& auth_handle,
5334       const std::string& auth_handle_name,
5335       const TPMI_SH_POLICY& policy_session,
5336       const std::string& policy_session_name,
5337       const TPM2B_NONCE& nonce_tpm,
5338       const TPM2B_DIGEST& cp_hash_a,
5339       const TPM2B_NONCE& policy_ref,
5340       const INT32& expiration,
5341       TPM2B_TIMEOUT* timeout,
5342       TPMT_TK_AUTH* policy_ticket,
5343       AuthorizationDelegate* authorization_delegate);
5344   typedef base::Callback<void(
5345       TPM_RC response_code)> PolicyTicketResponse;
5346   static TPM_RC SerializeCommand_PolicyTicket(
5347       const TPMI_SH_POLICY& policy_session,
5348       const std::string& policy_session_name,
5349       const TPM2B_TIMEOUT& timeout,
5350       const TPM2B_DIGEST& cp_hash_a,
5351       const TPM2B_NONCE& policy_ref,
5352       const TPM2B_NAME& auth_name,
5353       const TPMT_TK_AUTH& ticket,
5354       std::string* serialized_command,
5355       AuthorizationDelegate* authorization_delegate);
5356   static TPM_RC ParseResponse_PolicyTicket(
5357       const std::string& response,
5358       AuthorizationDelegate* authorization_delegate);
5359   virtual void PolicyTicket(
5360       const TPMI_SH_POLICY& policy_session,
5361       const std::string& policy_session_name,
5362       const TPM2B_TIMEOUT& timeout,
5363       const TPM2B_DIGEST& cp_hash_a,
5364       const TPM2B_NONCE& policy_ref,
5365       const TPM2B_NAME& auth_name,
5366       const TPMT_TK_AUTH& ticket,
5367       AuthorizationDelegate* authorization_delegate,
5368       const PolicyTicketResponse& callback);
5369   virtual TPM_RC PolicyTicketSync(
5370       const TPMI_SH_POLICY& policy_session,
5371       const std::string& policy_session_name,
5372       const TPM2B_TIMEOUT& timeout,
5373       const TPM2B_DIGEST& cp_hash_a,
5374       const TPM2B_NONCE& policy_ref,
5375       const TPM2B_NAME& auth_name,
5376       const TPMT_TK_AUTH& ticket,
5377       AuthorizationDelegate* authorization_delegate);
5378   typedef base::Callback<void(
5379       TPM_RC response_code)> PolicyORResponse;
5380   static TPM_RC SerializeCommand_PolicyOR(
5381       const TPMI_SH_POLICY& policy_session,
5382       const std::string& policy_session_name,
5383       const TPML_DIGEST& p_hash_list,
5384       std::string* serialized_command,
5385       AuthorizationDelegate* authorization_delegate);
5386   static TPM_RC ParseResponse_PolicyOR(
5387       const std::string& response,
5388       AuthorizationDelegate* authorization_delegate);
5389   virtual void PolicyOR(
5390       const TPMI_SH_POLICY& policy_session,
5391       const std::string& policy_session_name,
5392       const TPML_DIGEST& p_hash_list,
5393       AuthorizationDelegate* authorization_delegate,
5394       const PolicyORResponse& callback);
5395   virtual TPM_RC PolicyORSync(
5396       const TPMI_SH_POLICY& policy_session,
5397       const std::string& policy_session_name,
5398       const TPML_DIGEST& p_hash_list,
5399       AuthorizationDelegate* authorization_delegate);
5400   typedef base::Callback<void(
5401       TPM_RC response_code)> PolicyPCRResponse;
5402   static TPM_RC SerializeCommand_PolicyPCR(
5403       const TPMI_SH_POLICY& policy_session,
5404       const std::string& policy_session_name,
5405       const TPM2B_DIGEST& pcr_digest,
5406       const TPML_PCR_SELECTION& pcrs,
5407       std::string* serialized_command,
5408       AuthorizationDelegate* authorization_delegate);
5409   static TPM_RC ParseResponse_PolicyPCR(
5410       const std::string& response,
5411       AuthorizationDelegate* authorization_delegate);
5412   virtual void PolicyPCR(
5413       const TPMI_SH_POLICY& policy_session,
5414       const std::string& policy_session_name,
5415       const TPM2B_DIGEST& pcr_digest,
5416       const TPML_PCR_SELECTION& pcrs,
5417       AuthorizationDelegate* authorization_delegate,
5418       const PolicyPCRResponse& callback);
5419   virtual TPM_RC PolicyPCRSync(
5420       const TPMI_SH_POLICY& policy_session,
5421       const std::string& policy_session_name,
5422       const TPM2B_DIGEST& pcr_digest,
5423       const TPML_PCR_SELECTION& pcrs,
5424       AuthorizationDelegate* authorization_delegate);
5425   typedef base::Callback<void(
5426       TPM_RC response_code)> PolicyLocalityResponse;
5427   static TPM_RC SerializeCommand_PolicyLocality(
5428       const TPMI_SH_POLICY& policy_session,
5429       const std::string& policy_session_name,
5430       const TPMA_LOCALITY& locality,
5431       std::string* serialized_command,
5432       AuthorizationDelegate* authorization_delegate);
5433   static TPM_RC ParseResponse_PolicyLocality(
5434       const std::string& response,
5435       AuthorizationDelegate* authorization_delegate);
5436   virtual void PolicyLocality(
5437       const TPMI_SH_POLICY& policy_session,
5438       const std::string& policy_session_name,
5439       const TPMA_LOCALITY& locality,
5440       AuthorizationDelegate* authorization_delegate,
5441       const PolicyLocalityResponse& callback);
5442   virtual TPM_RC PolicyLocalitySync(
5443       const TPMI_SH_POLICY& policy_session,
5444       const std::string& policy_session_name,
5445       const TPMA_LOCALITY& locality,
5446       AuthorizationDelegate* authorization_delegate);
5447   typedef base::Callback<void(
5448       TPM_RC response_code)> PolicyNVResponse;
5449   static TPM_RC SerializeCommand_PolicyNV(
5450       const TPMI_RH_NV_AUTH& auth_handle,
5451       const std::string& auth_handle_name,
5452       const TPMI_RH_NV_INDEX& nv_index,
5453       const std::string& nv_index_name,
5454       const TPMI_SH_POLICY& policy_session,
5455       const std::string& policy_session_name,
5456       const TPM2B_OPERAND& operand_b,
5457       const UINT16& offset,
5458       const TPM_EO& operation,
5459       std::string* serialized_command,
5460       AuthorizationDelegate* authorization_delegate);
5461   static TPM_RC ParseResponse_PolicyNV(
5462       const std::string& response,
5463       AuthorizationDelegate* authorization_delegate);
5464   virtual void PolicyNV(
5465       const TPMI_RH_NV_AUTH& auth_handle,
5466       const std::string& auth_handle_name,
5467       const TPMI_RH_NV_INDEX& nv_index,
5468       const std::string& nv_index_name,
5469       const TPMI_SH_POLICY& policy_session,
5470       const std::string& policy_session_name,
5471       const TPM2B_OPERAND& operand_b,
5472       const UINT16& offset,
5473       const TPM_EO& operation,
5474       AuthorizationDelegate* authorization_delegate,
5475       const PolicyNVResponse& callback);
5476   virtual TPM_RC PolicyNVSync(
5477       const TPMI_RH_NV_AUTH& auth_handle,
5478       const std::string& auth_handle_name,
5479       const TPMI_RH_NV_INDEX& nv_index,
5480       const std::string& nv_index_name,
5481       const TPMI_SH_POLICY& policy_session,
5482       const std::string& policy_session_name,
5483       const TPM2B_OPERAND& operand_b,
5484       const UINT16& offset,
5485       const TPM_EO& operation,
5486       AuthorizationDelegate* authorization_delegate);
5487   typedef base::Callback<void(
5488       TPM_RC response_code)> PolicyCounterTimerResponse;
5489   static TPM_RC SerializeCommand_PolicyCounterTimer(
5490       const TPMI_SH_POLICY& policy_session,
5491       const std::string& policy_session_name,
5492       const TPM2B_OPERAND& operand_b,
5493       const UINT16& offset,
5494       const TPM_EO& operation,
5495       std::string* serialized_command,
5496       AuthorizationDelegate* authorization_delegate);
5497   static TPM_RC ParseResponse_PolicyCounterTimer(
5498       const std::string& response,
5499       AuthorizationDelegate* authorization_delegate);
5500   virtual void PolicyCounterTimer(
5501       const TPMI_SH_POLICY& policy_session,
5502       const std::string& policy_session_name,
5503       const TPM2B_OPERAND& operand_b,
5504       const UINT16& offset,
5505       const TPM_EO& operation,
5506       AuthorizationDelegate* authorization_delegate,
5507       const PolicyCounterTimerResponse& callback);
5508   virtual TPM_RC PolicyCounterTimerSync(
5509       const TPMI_SH_POLICY& policy_session,
5510       const std::string& policy_session_name,
5511       const TPM2B_OPERAND& operand_b,
5512       const UINT16& offset,
5513       const TPM_EO& operation,
5514       AuthorizationDelegate* authorization_delegate);
5515   typedef base::Callback<void(
5516       TPM_RC response_code)> PolicyCommandCodeResponse;
5517   static TPM_RC SerializeCommand_PolicyCommandCode(
5518       const TPMI_SH_POLICY& policy_session,
5519       const std::string& policy_session_name,
5520       const TPM_CC& code,
5521       std::string* serialized_command,
5522       AuthorizationDelegate* authorization_delegate);
5523   static TPM_RC ParseResponse_PolicyCommandCode(
5524       const std::string& response,
5525       AuthorizationDelegate* authorization_delegate);
5526   virtual void PolicyCommandCode(
5527       const TPMI_SH_POLICY& policy_session,
5528       const std::string& policy_session_name,
5529       const TPM_CC& code,
5530       AuthorizationDelegate* authorization_delegate,
5531       const PolicyCommandCodeResponse& callback);
5532   virtual TPM_RC PolicyCommandCodeSync(
5533       const TPMI_SH_POLICY& policy_session,
5534       const std::string& policy_session_name,
5535       const TPM_CC& code,
5536       AuthorizationDelegate* authorization_delegate);
5537   typedef base::Callback<void(
5538       TPM_RC response_code)> PolicyPhysicalPresenceResponse;
5539   static TPM_RC SerializeCommand_PolicyPhysicalPresence(
5540       const TPMI_SH_POLICY& policy_session,
5541       const std::string& policy_session_name,
5542       std::string* serialized_command,
5543       AuthorizationDelegate* authorization_delegate);
5544   static TPM_RC ParseResponse_PolicyPhysicalPresence(
5545       const std::string& response,
5546       AuthorizationDelegate* authorization_delegate);
5547   virtual void PolicyPhysicalPresence(
5548       const TPMI_SH_POLICY& policy_session,
5549       const std::string& policy_session_name,
5550       AuthorizationDelegate* authorization_delegate,
5551       const PolicyPhysicalPresenceResponse& callback);
5552   virtual TPM_RC PolicyPhysicalPresenceSync(
5553       const TPMI_SH_POLICY& policy_session,
5554       const std::string& policy_session_name,
5555       AuthorizationDelegate* authorization_delegate);
5556   typedef base::Callback<void(
5557       TPM_RC response_code)> PolicyCpHashResponse;
5558   static TPM_RC SerializeCommand_PolicyCpHash(
5559       const TPMI_SH_POLICY& policy_session,
5560       const std::string& policy_session_name,
5561       const TPM2B_DIGEST& cp_hash_a,
5562       std::string* serialized_command,
5563       AuthorizationDelegate* authorization_delegate);
5564   static TPM_RC ParseResponse_PolicyCpHash(
5565       const std::string& response,
5566       AuthorizationDelegate* authorization_delegate);
5567   virtual void PolicyCpHash(
5568       const TPMI_SH_POLICY& policy_session,
5569       const std::string& policy_session_name,
5570       const TPM2B_DIGEST& cp_hash_a,
5571       AuthorizationDelegate* authorization_delegate,
5572       const PolicyCpHashResponse& callback);
5573   virtual TPM_RC PolicyCpHashSync(
5574       const TPMI_SH_POLICY& policy_session,
5575       const std::string& policy_session_name,
5576       const TPM2B_DIGEST& cp_hash_a,
5577       AuthorizationDelegate* authorization_delegate);
5578   typedef base::Callback<void(
5579       TPM_RC response_code)> PolicyNameHashResponse;
5580   static TPM_RC SerializeCommand_PolicyNameHash(
5581       const TPMI_SH_POLICY& policy_session,
5582       const std::string& policy_session_name,
5583       const TPM2B_DIGEST& name_hash,
5584       std::string* serialized_command,
5585       AuthorizationDelegate* authorization_delegate);
5586   static TPM_RC ParseResponse_PolicyNameHash(
5587       const std::string& response,
5588       AuthorizationDelegate* authorization_delegate);
5589   virtual void PolicyNameHash(
5590       const TPMI_SH_POLICY& policy_session,
5591       const std::string& policy_session_name,
5592       const TPM2B_DIGEST& name_hash,
5593       AuthorizationDelegate* authorization_delegate,
5594       const PolicyNameHashResponse& callback);
5595   virtual TPM_RC PolicyNameHashSync(
5596       const TPMI_SH_POLICY& policy_session,
5597       const std::string& policy_session_name,
5598       const TPM2B_DIGEST& name_hash,
5599       AuthorizationDelegate* authorization_delegate);
5600   typedef base::Callback<void(
5601       TPM_RC response_code)> PolicyDuplicationSelectResponse;
5602   static TPM_RC SerializeCommand_PolicyDuplicationSelect(
5603       const TPMI_SH_POLICY& policy_session,
5604       const std::string& policy_session_name,
5605       const TPM2B_NAME& object_name,
5606       const TPM2B_NAME& new_parent_name,
5607       const TPMI_YES_NO& include_object,
5608       std::string* serialized_command,
5609       AuthorizationDelegate* authorization_delegate);
5610   static TPM_RC ParseResponse_PolicyDuplicationSelect(
5611       const std::string& response,
5612       AuthorizationDelegate* authorization_delegate);
5613   virtual void PolicyDuplicationSelect(
5614       const TPMI_SH_POLICY& policy_session,
5615       const std::string& policy_session_name,
5616       const TPM2B_NAME& object_name,
5617       const TPM2B_NAME& new_parent_name,
5618       const TPMI_YES_NO& include_object,
5619       AuthorizationDelegate* authorization_delegate,
5620       const PolicyDuplicationSelectResponse& callback);
5621   virtual TPM_RC PolicyDuplicationSelectSync(
5622       const TPMI_SH_POLICY& policy_session,
5623       const std::string& policy_session_name,
5624       const TPM2B_NAME& object_name,
5625       const TPM2B_NAME& new_parent_name,
5626       const TPMI_YES_NO& include_object,
5627       AuthorizationDelegate* authorization_delegate);
5628   typedef base::Callback<void(
5629       TPM_RC response_code)> PolicyAuthorizeResponse;
5630   static TPM_RC SerializeCommand_PolicyAuthorize(
5631       const TPMI_SH_POLICY& policy_session,
5632       const std::string& policy_session_name,
5633       const TPM2B_DIGEST& approved_policy,
5634       const TPM2B_NONCE& policy_ref,
5635       const TPM2B_NAME& key_sign,
5636       const TPMT_TK_VERIFIED& check_ticket,
5637       std::string* serialized_command,
5638       AuthorizationDelegate* authorization_delegate);
5639   static TPM_RC ParseResponse_PolicyAuthorize(
5640       const std::string& response,
5641       AuthorizationDelegate* authorization_delegate);
5642   virtual void PolicyAuthorize(
5643       const TPMI_SH_POLICY& policy_session,
5644       const std::string& policy_session_name,
5645       const TPM2B_DIGEST& approved_policy,
5646       const TPM2B_NONCE& policy_ref,
5647       const TPM2B_NAME& key_sign,
5648       const TPMT_TK_VERIFIED& check_ticket,
5649       AuthorizationDelegate* authorization_delegate,
5650       const PolicyAuthorizeResponse& callback);
5651   virtual TPM_RC PolicyAuthorizeSync(
5652       const TPMI_SH_POLICY& policy_session,
5653       const std::string& policy_session_name,
5654       const TPM2B_DIGEST& approved_policy,
5655       const TPM2B_NONCE& policy_ref,
5656       const TPM2B_NAME& key_sign,
5657       const TPMT_TK_VERIFIED& check_ticket,
5658       AuthorizationDelegate* authorization_delegate);
5659   typedef base::Callback<void(
5660       TPM_RC response_code)> PolicyAuthValueResponse;
5661   static TPM_RC SerializeCommand_PolicyAuthValue(
5662       const TPMI_SH_POLICY& policy_session,
5663       const std::string& policy_session_name,
5664       std::string* serialized_command,
5665       AuthorizationDelegate* authorization_delegate);
5666   static TPM_RC ParseResponse_PolicyAuthValue(
5667       const std::string& response,
5668       AuthorizationDelegate* authorization_delegate);
5669   virtual void PolicyAuthValue(
5670       const TPMI_SH_POLICY& policy_session,
5671       const std::string& policy_session_name,
5672       AuthorizationDelegate* authorization_delegate,
5673       const PolicyAuthValueResponse& callback);
5674   virtual TPM_RC PolicyAuthValueSync(
5675       const TPMI_SH_POLICY& policy_session,
5676       const std::string& policy_session_name,
5677       AuthorizationDelegate* authorization_delegate);
5678   typedef base::Callback<void(
5679       TPM_RC response_code)> PolicyPasswordResponse;
5680   static TPM_RC SerializeCommand_PolicyPassword(
5681       const TPMI_SH_POLICY& policy_session,
5682       const std::string& policy_session_name,
5683       std::string* serialized_command,
5684       AuthorizationDelegate* authorization_delegate);
5685   static TPM_RC ParseResponse_PolicyPassword(
5686       const std::string& response,
5687       AuthorizationDelegate* authorization_delegate);
5688   virtual void PolicyPassword(
5689       const TPMI_SH_POLICY& policy_session,
5690       const std::string& policy_session_name,
5691       AuthorizationDelegate* authorization_delegate,
5692       const PolicyPasswordResponse& callback);
5693   virtual TPM_RC PolicyPasswordSync(
5694       const TPMI_SH_POLICY& policy_session,
5695       const std::string& policy_session_name,
5696       AuthorizationDelegate* authorization_delegate);
5697   typedef base::Callback<void(
5698       TPM_RC response_code,
5699       const TPM2B_DIGEST& policy_digest)> PolicyGetDigestResponse;
5700   static TPM_RC SerializeCommand_PolicyGetDigest(
5701       const TPMI_SH_POLICY& policy_session,
5702       const std::string& policy_session_name,
5703       std::string* serialized_command,
5704       AuthorizationDelegate* authorization_delegate);
5705   static TPM_RC ParseResponse_PolicyGetDigest(
5706       const std::string& response,
5707       TPM2B_DIGEST* policy_digest,
5708       AuthorizationDelegate* authorization_delegate);
5709   virtual void PolicyGetDigest(
5710       const TPMI_SH_POLICY& policy_session,
5711       const std::string& policy_session_name,
5712       AuthorizationDelegate* authorization_delegate,
5713       const PolicyGetDigestResponse& callback);
5714   virtual TPM_RC PolicyGetDigestSync(
5715       const TPMI_SH_POLICY& policy_session,
5716       const std::string& policy_session_name,
5717       TPM2B_DIGEST* policy_digest,
5718       AuthorizationDelegate* authorization_delegate);
5719   typedef base::Callback<void(
5720       TPM_RC response_code)> PolicyNvWrittenResponse;
5721   static TPM_RC SerializeCommand_PolicyNvWritten(
5722       const TPMI_SH_POLICY& policy_session,
5723       const std::string& policy_session_name,
5724       const TPMI_YES_NO& written_set,
5725       std::string* serialized_command,
5726       AuthorizationDelegate* authorization_delegate);
5727   static TPM_RC ParseResponse_PolicyNvWritten(
5728       const std::string& response,
5729       AuthorizationDelegate* authorization_delegate);
5730   virtual void PolicyNvWritten(
5731       const TPMI_SH_POLICY& policy_session,
5732       const std::string& policy_session_name,
5733       const TPMI_YES_NO& written_set,
5734       AuthorizationDelegate* authorization_delegate,
5735       const PolicyNvWrittenResponse& callback);
5736   virtual TPM_RC PolicyNvWrittenSync(
5737       const TPMI_SH_POLICY& policy_session,
5738       const std::string& policy_session_name,
5739       const TPMI_YES_NO& written_set,
5740       AuthorizationDelegate* authorization_delegate);
5741   typedef base::Callback<void(
5742       TPM_RC response_code,
5743       const TPM_HANDLE& object_handle,
5744       const TPM2B_PUBLIC& out_public,
5745       const TPM2B_CREATION_DATA& creation_data,
5746       const TPM2B_DIGEST& creation_hash,
5747       const TPMT_TK_CREATION& creation_ticket,
5748       const TPM2B_NAME& name)> CreatePrimaryResponse;
5749   static TPM_RC SerializeCommand_CreatePrimary(
5750       const TPMI_RH_HIERARCHY& primary_handle,
5751       const std::string& primary_handle_name,
5752       const TPM2B_SENSITIVE_CREATE& in_sensitive,
5753       const TPM2B_PUBLIC& in_public,
5754       const TPM2B_DATA& outside_info,
5755       const TPML_PCR_SELECTION& creation_pcr,
5756       std::string* serialized_command,
5757       AuthorizationDelegate* authorization_delegate);
5758   static TPM_RC ParseResponse_CreatePrimary(
5759       const std::string& response,
5760       TPM_HANDLE* object_handle,
5761       TPM2B_PUBLIC* out_public,
5762       TPM2B_CREATION_DATA* creation_data,
5763       TPM2B_DIGEST* creation_hash,
5764       TPMT_TK_CREATION* creation_ticket,
5765       TPM2B_NAME* name,
5766       AuthorizationDelegate* authorization_delegate);
5767   virtual void CreatePrimary(
5768       const TPMI_RH_HIERARCHY& primary_handle,
5769       const std::string& primary_handle_name,
5770       const TPM2B_SENSITIVE_CREATE& in_sensitive,
5771       const TPM2B_PUBLIC& in_public,
5772       const TPM2B_DATA& outside_info,
5773       const TPML_PCR_SELECTION& creation_pcr,
5774       AuthorizationDelegate* authorization_delegate,
5775       const CreatePrimaryResponse& callback);
5776   virtual TPM_RC CreatePrimarySync(
5777       const TPMI_RH_HIERARCHY& primary_handle,
5778       const std::string& primary_handle_name,
5779       const TPM2B_SENSITIVE_CREATE& in_sensitive,
5780       const TPM2B_PUBLIC& in_public,
5781       const TPM2B_DATA& outside_info,
5782       const TPML_PCR_SELECTION& creation_pcr,
5783       TPM_HANDLE* object_handle,
5784       TPM2B_PUBLIC* out_public,
5785       TPM2B_CREATION_DATA* creation_data,
5786       TPM2B_DIGEST* creation_hash,
5787       TPMT_TK_CREATION* creation_ticket,
5788       TPM2B_NAME* name,
5789       AuthorizationDelegate* authorization_delegate);
5790   typedef base::Callback<void(
5791       TPM_RC response_code)> HierarchyControlResponse;
5792   static TPM_RC SerializeCommand_HierarchyControl(
5793       const TPMI_RH_HIERARCHY& auth_handle,
5794       const std::string& auth_handle_name,
5795       const TPMI_RH_ENABLES& enable,
5796       const TPMI_YES_NO& state,
5797       std::string* serialized_command,
5798       AuthorizationDelegate* authorization_delegate);
5799   static TPM_RC ParseResponse_HierarchyControl(
5800       const std::string& response,
5801       AuthorizationDelegate* authorization_delegate);
5802   virtual void HierarchyControl(
5803       const TPMI_RH_HIERARCHY& auth_handle,
5804       const std::string& auth_handle_name,
5805       const TPMI_RH_ENABLES& enable,
5806       const TPMI_YES_NO& state,
5807       AuthorizationDelegate* authorization_delegate,
5808       const HierarchyControlResponse& callback);
5809   virtual TPM_RC HierarchyControlSync(
5810       const TPMI_RH_HIERARCHY& auth_handle,
5811       const std::string& auth_handle_name,
5812       const TPMI_RH_ENABLES& enable,
5813       const TPMI_YES_NO& state,
5814       AuthorizationDelegate* authorization_delegate);
5815   typedef base::Callback<void(
5816       TPM_RC response_code)> SetPrimaryPolicyResponse;
5817   static TPM_RC SerializeCommand_SetPrimaryPolicy(
5818       const TPMI_RH_HIERARCHY& auth_handle,
5819       const std::string& auth_handle_name,
5820       const TPM2B_DIGEST& auth_policy,
5821       const TPMI_ALG_HASH& hash_alg,
5822       std::string* serialized_command,
5823       AuthorizationDelegate* authorization_delegate);
5824   static TPM_RC ParseResponse_SetPrimaryPolicy(
5825       const std::string& response,
5826       AuthorizationDelegate* authorization_delegate);
5827   virtual void SetPrimaryPolicy(
5828       const TPMI_RH_HIERARCHY& auth_handle,
5829       const std::string& auth_handle_name,
5830       const TPM2B_DIGEST& auth_policy,
5831       const TPMI_ALG_HASH& hash_alg,
5832       AuthorizationDelegate* authorization_delegate,
5833       const SetPrimaryPolicyResponse& callback);
5834   virtual TPM_RC SetPrimaryPolicySync(
5835       const TPMI_RH_HIERARCHY& auth_handle,
5836       const std::string& auth_handle_name,
5837       const TPM2B_DIGEST& auth_policy,
5838       const TPMI_ALG_HASH& hash_alg,
5839       AuthorizationDelegate* authorization_delegate);
5840   typedef base::Callback<void(
5841       TPM_RC response_code)> ChangePPSResponse;
5842   static TPM_RC SerializeCommand_ChangePPS(
5843       const TPMI_RH_PLATFORM& auth_handle,
5844       const std::string& auth_handle_name,
5845       std::string* serialized_command,
5846       AuthorizationDelegate* authorization_delegate);
5847   static TPM_RC ParseResponse_ChangePPS(
5848       const std::string& response,
5849       AuthorizationDelegate* authorization_delegate);
5850   virtual void ChangePPS(
5851       const TPMI_RH_PLATFORM& auth_handle,
5852       const std::string& auth_handle_name,
5853       AuthorizationDelegate* authorization_delegate,
5854       const ChangePPSResponse& callback);
5855   virtual TPM_RC ChangePPSSync(
5856       const TPMI_RH_PLATFORM& auth_handle,
5857       const std::string& auth_handle_name,
5858       AuthorizationDelegate* authorization_delegate);
5859   typedef base::Callback<void(
5860       TPM_RC response_code)> ChangeEPSResponse;
5861   static TPM_RC SerializeCommand_ChangeEPS(
5862       const TPMI_RH_PLATFORM& auth_handle,
5863       const std::string& auth_handle_name,
5864       std::string* serialized_command,
5865       AuthorizationDelegate* authorization_delegate);
5866   static TPM_RC ParseResponse_ChangeEPS(
5867       const std::string& response,
5868       AuthorizationDelegate* authorization_delegate);
5869   virtual void ChangeEPS(
5870       const TPMI_RH_PLATFORM& auth_handle,
5871       const std::string& auth_handle_name,
5872       AuthorizationDelegate* authorization_delegate,
5873       const ChangeEPSResponse& callback);
5874   virtual TPM_RC ChangeEPSSync(
5875       const TPMI_RH_PLATFORM& auth_handle,
5876       const std::string& auth_handle_name,
5877       AuthorizationDelegate* authorization_delegate);
5878   typedef base::Callback<void(
5879       TPM_RC response_code)> ClearResponse;
5880   static TPM_RC SerializeCommand_Clear(
5881       const TPMI_RH_CLEAR& auth_handle,
5882       const std::string& auth_handle_name,
5883       std::string* serialized_command,
5884       AuthorizationDelegate* authorization_delegate);
5885   static TPM_RC ParseResponse_Clear(
5886       const std::string& response,
5887       AuthorizationDelegate* authorization_delegate);
5888   virtual void Clear(
5889       const TPMI_RH_CLEAR& auth_handle,
5890       const std::string& auth_handle_name,
5891       AuthorizationDelegate* authorization_delegate,
5892       const ClearResponse& callback);
5893   virtual TPM_RC ClearSync(
5894       const TPMI_RH_CLEAR& auth_handle,
5895       const std::string& auth_handle_name,
5896       AuthorizationDelegate* authorization_delegate);
5897   typedef base::Callback<void(
5898       TPM_RC response_code)> ClearControlResponse;
5899   static TPM_RC SerializeCommand_ClearControl(
5900       const TPMI_RH_CLEAR& auth,
5901       const std::string& auth_name,
5902       const TPMI_YES_NO& disable,
5903       std::string* serialized_command,
5904       AuthorizationDelegate* authorization_delegate);
5905   static TPM_RC ParseResponse_ClearControl(
5906       const std::string& response,
5907       AuthorizationDelegate* authorization_delegate);
5908   virtual void ClearControl(
5909       const TPMI_RH_CLEAR& auth,
5910       const std::string& auth_name,
5911       const TPMI_YES_NO& disable,
5912       AuthorizationDelegate* authorization_delegate,
5913       const ClearControlResponse& callback);
5914   virtual TPM_RC ClearControlSync(
5915       const TPMI_RH_CLEAR& auth,
5916       const std::string& auth_name,
5917       const TPMI_YES_NO& disable,
5918       AuthorizationDelegate* authorization_delegate);
5919   typedef base::Callback<void(
5920       TPM_RC response_code)> HierarchyChangeAuthResponse;
5921   static TPM_RC SerializeCommand_HierarchyChangeAuth(
5922       const TPMI_RH_HIERARCHY_AUTH& auth_handle,
5923       const std::string& auth_handle_name,
5924       const TPM2B_AUTH& new_auth,
5925       std::string* serialized_command,
5926       AuthorizationDelegate* authorization_delegate);
5927   static TPM_RC ParseResponse_HierarchyChangeAuth(
5928       const std::string& response,
5929       AuthorizationDelegate* authorization_delegate);
5930   virtual void HierarchyChangeAuth(
5931       const TPMI_RH_HIERARCHY_AUTH& auth_handle,
5932       const std::string& auth_handle_name,
5933       const TPM2B_AUTH& new_auth,
5934       AuthorizationDelegate* authorization_delegate,
5935       const HierarchyChangeAuthResponse& callback);
5936   virtual TPM_RC HierarchyChangeAuthSync(
5937       const TPMI_RH_HIERARCHY_AUTH& auth_handle,
5938       const std::string& auth_handle_name,
5939       const TPM2B_AUTH& new_auth,
5940       AuthorizationDelegate* authorization_delegate);
5941   typedef base::Callback<void(
5942       TPM_RC response_code)> DictionaryAttackLockResetResponse;
5943   static TPM_RC SerializeCommand_DictionaryAttackLockReset(
5944       const TPMI_RH_LOCKOUT& lock_handle,
5945       const std::string& lock_handle_name,
5946       std::string* serialized_command,
5947       AuthorizationDelegate* authorization_delegate);
5948   static TPM_RC ParseResponse_DictionaryAttackLockReset(
5949       const std::string& response,
5950       AuthorizationDelegate* authorization_delegate);
5951   virtual void DictionaryAttackLockReset(
5952       const TPMI_RH_LOCKOUT& lock_handle,
5953       const std::string& lock_handle_name,
5954       AuthorizationDelegate* authorization_delegate,
5955       const DictionaryAttackLockResetResponse& callback);
5956   virtual TPM_RC DictionaryAttackLockResetSync(
5957       const TPMI_RH_LOCKOUT& lock_handle,
5958       const std::string& lock_handle_name,
5959       AuthorizationDelegate* authorization_delegate);
5960   typedef base::Callback<void(
5961       TPM_RC response_code)> DictionaryAttackParametersResponse;
5962   static TPM_RC SerializeCommand_DictionaryAttackParameters(
5963       const TPMI_RH_LOCKOUT& lock_handle,
5964       const std::string& lock_handle_name,
5965       const UINT32& new_max_tries,
5966       const UINT32& new_recovery_time,
5967       const UINT32& lockout_recovery,
5968       std::string* serialized_command,
5969       AuthorizationDelegate* authorization_delegate);
5970   static TPM_RC ParseResponse_DictionaryAttackParameters(
5971       const std::string& response,
5972       AuthorizationDelegate* authorization_delegate);
5973   virtual void DictionaryAttackParameters(
5974       const TPMI_RH_LOCKOUT& lock_handle,
5975       const std::string& lock_handle_name,
5976       const UINT32& new_max_tries,
5977       const UINT32& new_recovery_time,
5978       const UINT32& lockout_recovery,
5979       AuthorizationDelegate* authorization_delegate,
5980       const DictionaryAttackParametersResponse& callback);
5981   virtual TPM_RC DictionaryAttackParametersSync(
5982       const TPMI_RH_LOCKOUT& lock_handle,
5983       const std::string& lock_handle_name,
5984       const UINT32& new_max_tries,
5985       const UINT32& new_recovery_time,
5986       const UINT32& lockout_recovery,
5987       AuthorizationDelegate* authorization_delegate);
5988   typedef base::Callback<void(
5989       TPM_RC response_code)> PP_CommandsResponse;
5990   static TPM_RC SerializeCommand_PP_Commands(
5991       const TPMI_RH_PLATFORM& auth,
5992       const std::string& auth_name,
5993       const TPML_CC& set_list,
5994       const TPML_CC& clear_list,
5995       std::string* serialized_command,
5996       AuthorizationDelegate* authorization_delegate);
5997   static TPM_RC ParseResponse_PP_Commands(
5998       const std::string& response,
5999       AuthorizationDelegate* authorization_delegate);
6000   virtual void PP_Commands(
6001       const TPMI_RH_PLATFORM& auth,
6002       const std::string& auth_name,
6003       const TPML_CC& set_list,
6004       const TPML_CC& clear_list,
6005       AuthorizationDelegate* authorization_delegate,
6006       const PP_CommandsResponse& callback);
6007   virtual TPM_RC PP_CommandsSync(
6008       const TPMI_RH_PLATFORM& auth,
6009       const std::string& auth_name,
6010       const TPML_CC& set_list,
6011       const TPML_CC& clear_list,
6012       AuthorizationDelegate* authorization_delegate);
6013   typedef base::Callback<void(
6014       TPM_RC response_code)> SetAlgorithmSetResponse;
6015   static TPM_RC SerializeCommand_SetAlgorithmSet(
6016       const TPMI_RH_PLATFORM& auth_handle,
6017       const std::string& auth_handle_name,
6018       const UINT32& algorithm_set,
6019       std::string* serialized_command,
6020       AuthorizationDelegate* authorization_delegate);
6021   static TPM_RC ParseResponse_SetAlgorithmSet(
6022       const std::string& response,
6023       AuthorizationDelegate* authorization_delegate);
6024   virtual void SetAlgorithmSet(
6025       const TPMI_RH_PLATFORM& auth_handle,
6026       const std::string& auth_handle_name,
6027       const UINT32& algorithm_set,
6028       AuthorizationDelegate* authorization_delegate,
6029       const SetAlgorithmSetResponse& callback);
6030   virtual TPM_RC SetAlgorithmSetSync(
6031       const TPMI_RH_PLATFORM& auth_handle,
6032       const std::string& auth_handle_name,
6033       const UINT32& algorithm_set,
6034       AuthorizationDelegate* authorization_delegate);
6035   typedef base::Callback<void(
6036       TPM_RC response_code)> FieldUpgradeStartResponse;
6037   static TPM_RC SerializeCommand_FieldUpgradeStart(
6038       const TPMI_RH_PLATFORM& authorization,
6039       const std::string& authorization_name,
6040       const TPMI_DH_OBJECT& key_handle,
6041       const std::string& key_handle_name,
6042       const TPM2B_DIGEST& fu_digest,
6043       const TPMT_SIGNATURE& manifest_signature,
6044       std::string* serialized_command,
6045       AuthorizationDelegate* authorization_delegate);
6046   static TPM_RC ParseResponse_FieldUpgradeStart(
6047       const std::string& response,
6048       AuthorizationDelegate* authorization_delegate);
6049   virtual void FieldUpgradeStart(
6050       const TPMI_RH_PLATFORM& authorization,
6051       const std::string& authorization_name,
6052       const TPMI_DH_OBJECT& key_handle,
6053       const std::string& key_handle_name,
6054       const TPM2B_DIGEST& fu_digest,
6055       const TPMT_SIGNATURE& manifest_signature,
6056       AuthorizationDelegate* authorization_delegate,
6057       const FieldUpgradeStartResponse& callback);
6058   virtual TPM_RC FieldUpgradeStartSync(
6059       const TPMI_RH_PLATFORM& authorization,
6060       const std::string& authorization_name,
6061       const TPMI_DH_OBJECT& key_handle,
6062       const std::string& key_handle_name,
6063       const TPM2B_DIGEST& fu_digest,
6064       const TPMT_SIGNATURE& manifest_signature,
6065       AuthorizationDelegate* authorization_delegate);
6066   typedef base::Callback<void(
6067       TPM_RC response_code,
6068       const TPMT_HA& next_digest,
6069       const TPMT_HA& first_digest)> FieldUpgradeDataResponse;
6070   static TPM_RC SerializeCommand_FieldUpgradeData(
6071       const TPM2B_MAX_BUFFER& fu_data,
6072       std::string* serialized_command,
6073       AuthorizationDelegate* authorization_delegate);
6074   static TPM_RC ParseResponse_FieldUpgradeData(
6075       const std::string& response,
6076       TPMT_HA* next_digest,
6077       TPMT_HA* first_digest,
6078       AuthorizationDelegate* authorization_delegate);
6079   virtual void FieldUpgradeData(
6080       const TPM2B_MAX_BUFFER& fu_data,
6081       AuthorizationDelegate* authorization_delegate,
6082       const FieldUpgradeDataResponse& callback);
6083   virtual TPM_RC FieldUpgradeDataSync(
6084       const TPM2B_MAX_BUFFER& fu_data,
6085       TPMT_HA* next_digest,
6086       TPMT_HA* first_digest,
6087       AuthorizationDelegate* authorization_delegate);
6088   typedef base::Callback<void(
6089       TPM_RC response_code,
6090       const TPM2B_MAX_BUFFER& fu_data)> FirmwareReadResponse;
6091   static TPM_RC SerializeCommand_FirmwareRead(
6092       const UINT32& sequence_number,
6093       std::string* serialized_command,
6094       AuthorizationDelegate* authorization_delegate);
6095   static TPM_RC ParseResponse_FirmwareRead(
6096       const std::string& response,
6097       TPM2B_MAX_BUFFER* fu_data,
6098       AuthorizationDelegate* authorization_delegate);
6099   virtual void FirmwareRead(
6100       const UINT32& sequence_number,
6101       AuthorizationDelegate* authorization_delegate,
6102       const FirmwareReadResponse& callback);
6103   virtual TPM_RC FirmwareReadSync(
6104       const UINT32& sequence_number,
6105       TPM2B_MAX_BUFFER* fu_data,
6106       AuthorizationDelegate* authorization_delegate);
6107   typedef base::Callback<void(
6108       TPM_RC response_code,
6109       const TPMS_CONTEXT& context)> ContextSaveResponse;
6110   static TPM_RC SerializeCommand_ContextSave(
6111       const TPMI_DH_CONTEXT& save_handle,
6112       const std::string& save_handle_name,
6113       std::string* serialized_command,
6114       AuthorizationDelegate* authorization_delegate);
6115   static TPM_RC ParseResponse_ContextSave(
6116       const std::string& response,
6117       TPMS_CONTEXT* context,
6118       AuthorizationDelegate* authorization_delegate);
6119   virtual void ContextSave(
6120       const TPMI_DH_CONTEXT& save_handle,
6121       const std::string& save_handle_name,
6122       AuthorizationDelegate* authorization_delegate,
6123       const ContextSaveResponse& callback);
6124   virtual TPM_RC ContextSaveSync(
6125       const TPMI_DH_CONTEXT& save_handle,
6126       const std::string& save_handle_name,
6127       TPMS_CONTEXT* context,
6128       AuthorizationDelegate* authorization_delegate);
6129   typedef base::Callback<void(
6130       TPM_RC response_code,
6131       const TPMI_DH_CONTEXT& loaded_handle)> ContextLoadResponse;
6132   static TPM_RC SerializeCommand_ContextLoad(
6133       const TPMS_CONTEXT& context,
6134       std::string* serialized_command,
6135       AuthorizationDelegate* authorization_delegate);
6136   static TPM_RC ParseResponse_ContextLoad(
6137       const std::string& response,
6138       TPMI_DH_CONTEXT* loaded_handle,
6139       AuthorizationDelegate* authorization_delegate);
6140   virtual void ContextLoad(
6141       const TPMS_CONTEXT& context,
6142       AuthorizationDelegate* authorization_delegate,
6143       const ContextLoadResponse& callback);
6144   virtual TPM_RC ContextLoadSync(
6145       const TPMS_CONTEXT& context,
6146       TPMI_DH_CONTEXT* loaded_handle,
6147       AuthorizationDelegate* authorization_delegate);
6148   typedef base::Callback<void(
6149       TPM_RC response_code)> FlushContextResponse;
6150   static TPM_RC SerializeCommand_FlushContext(
6151       const TPMI_DH_CONTEXT& flush_handle,
6152       std::string* serialized_command,
6153       AuthorizationDelegate* authorization_delegate);
6154   static TPM_RC ParseResponse_FlushContext(
6155       const std::string& response,
6156       AuthorizationDelegate* authorization_delegate);
6157   virtual void FlushContext(
6158       const TPMI_DH_CONTEXT& flush_handle,
6159       AuthorizationDelegate* authorization_delegate,
6160       const FlushContextResponse& callback);
6161   virtual TPM_RC FlushContextSync(
6162       const TPMI_DH_CONTEXT& flush_handle,
6163       AuthorizationDelegate* authorization_delegate);
6164   typedef base::Callback<void(
6165       TPM_RC response_code)> EvictControlResponse;
6166   static TPM_RC SerializeCommand_EvictControl(
6167       const TPMI_RH_PROVISION& auth,
6168       const std::string& auth_name,
6169       const TPMI_DH_OBJECT& object_handle,
6170       const std::string& object_handle_name,
6171       const TPMI_DH_PERSISTENT& persistent_handle,
6172       std::string* serialized_command,
6173       AuthorizationDelegate* authorization_delegate);
6174   static TPM_RC ParseResponse_EvictControl(
6175       const std::string& response,
6176       AuthorizationDelegate* authorization_delegate);
6177   virtual void EvictControl(
6178       const TPMI_RH_PROVISION& auth,
6179       const std::string& auth_name,
6180       const TPMI_DH_OBJECT& object_handle,
6181       const std::string& object_handle_name,
6182       const TPMI_DH_PERSISTENT& persistent_handle,
6183       AuthorizationDelegate* authorization_delegate,
6184       const EvictControlResponse& callback);
6185   virtual TPM_RC EvictControlSync(
6186       const TPMI_RH_PROVISION& auth,
6187       const std::string& auth_name,
6188       const TPMI_DH_OBJECT& object_handle,
6189       const std::string& object_handle_name,
6190       const TPMI_DH_PERSISTENT& persistent_handle,
6191       AuthorizationDelegate* authorization_delegate);
6192   typedef base::Callback<void(
6193       TPM_RC response_code,
6194       const TPMS_TIME_INFO& current_time)> ReadClockResponse;
6195   static TPM_RC SerializeCommand_ReadClock(
6196       std::string* serialized_command,
6197       AuthorizationDelegate* authorization_delegate);
6198   static TPM_RC ParseResponse_ReadClock(
6199       const std::string& response,
6200       TPMS_TIME_INFO* current_time,
6201       AuthorizationDelegate* authorization_delegate);
6202   virtual void ReadClock(
6203       AuthorizationDelegate* authorization_delegate,
6204       const ReadClockResponse& callback);
6205   virtual TPM_RC ReadClockSync(
6206       TPMS_TIME_INFO* current_time,
6207       AuthorizationDelegate* authorization_delegate);
6208   typedef base::Callback<void(
6209       TPM_RC response_code)> ClockSetResponse;
6210   static TPM_RC SerializeCommand_ClockSet(
6211       const TPMI_RH_PROVISION& auth,
6212       const std::string& auth_name,
6213       const UINT64& new_time,
6214       std::string* serialized_command,
6215       AuthorizationDelegate* authorization_delegate);
6216   static TPM_RC ParseResponse_ClockSet(
6217       const std::string& response,
6218       AuthorizationDelegate* authorization_delegate);
6219   virtual void ClockSet(
6220       const TPMI_RH_PROVISION& auth,
6221       const std::string& auth_name,
6222       const UINT64& new_time,
6223       AuthorizationDelegate* authorization_delegate,
6224       const ClockSetResponse& callback);
6225   virtual TPM_RC ClockSetSync(
6226       const TPMI_RH_PROVISION& auth,
6227       const std::string& auth_name,
6228       const UINT64& new_time,
6229       AuthorizationDelegate* authorization_delegate);
6230   typedef base::Callback<void(
6231       TPM_RC response_code)> ClockRateAdjustResponse;
6232   static TPM_RC SerializeCommand_ClockRateAdjust(
6233       const TPMI_RH_PROVISION& auth,
6234       const std::string& auth_name,
6235       const TPM_CLOCK_ADJUST& rate_adjust,
6236       std::string* serialized_command,
6237       AuthorizationDelegate* authorization_delegate);
6238   static TPM_RC ParseResponse_ClockRateAdjust(
6239       const std::string& response,
6240       AuthorizationDelegate* authorization_delegate);
6241   virtual void ClockRateAdjust(
6242       const TPMI_RH_PROVISION& auth,
6243       const std::string& auth_name,
6244       const TPM_CLOCK_ADJUST& rate_adjust,
6245       AuthorizationDelegate* authorization_delegate,
6246       const ClockRateAdjustResponse& callback);
6247   virtual TPM_RC ClockRateAdjustSync(
6248       const TPMI_RH_PROVISION& auth,
6249       const std::string& auth_name,
6250       const TPM_CLOCK_ADJUST& rate_adjust,
6251       AuthorizationDelegate* authorization_delegate);
6252   typedef base::Callback<void(
6253       TPM_RC response_code,
6254       const TPMI_YES_NO& more_data,
6255       const TPMS_CAPABILITY_DATA& capability_data)> GetCapabilityResponse;
6256   static TPM_RC SerializeCommand_GetCapability(
6257       const TPM_CAP& capability,
6258       const UINT32& property,
6259       const UINT32& property_count,
6260       std::string* serialized_command,
6261       AuthorizationDelegate* authorization_delegate);
6262   static TPM_RC ParseResponse_GetCapability(
6263       const std::string& response,
6264       TPMI_YES_NO* more_data,
6265       TPMS_CAPABILITY_DATA* capability_data,
6266       AuthorizationDelegate* authorization_delegate);
6267   virtual void GetCapability(
6268       const TPM_CAP& capability,
6269       const UINT32& property,
6270       const UINT32& property_count,
6271       AuthorizationDelegate* authorization_delegate,
6272       const GetCapabilityResponse& callback);
6273   virtual TPM_RC GetCapabilitySync(
6274       const TPM_CAP& capability,
6275       const UINT32& property,
6276       const UINT32& property_count,
6277       TPMI_YES_NO* more_data,
6278       TPMS_CAPABILITY_DATA* capability_data,
6279       AuthorizationDelegate* authorization_delegate);
6280   typedef base::Callback<void(
6281       TPM_RC response_code)> TestParmsResponse;
6282   static TPM_RC SerializeCommand_TestParms(
6283       const TPMT_PUBLIC_PARMS& parameters,
6284       std::string* serialized_command,
6285       AuthorizationDelegate* authorization_delegate);
6286   static TPM_RC ParseResponse_TestParms(
6287       const std::string& response,
6288       AuthorizationDelegate* authorization_delegate);
6289   virtual void TestParms(
6290       const TPMT_PUBLIC_PARMS& parameters,
6291       AuthorizationDelegate* authorization_delegate,
6292       const TestParmsResponse& callback);
6293   virtual TPM_RC TestParmsSync(
6294       const TPMT_PUBLIC_PARMS& parameters,
6295       AuthorizationDelegate* authorization_delegate);
6296   typedef base::Callback<void(
6297       TPM_RC response_code)> NV_DefineSpaceResponse;
6298   static TPM_RC SerializeCommand_NV_DefineSpace(
6299       const TPMI_RH_PROVISION& auth_handle,
6300       const std::string& auth_handle_name,
6301       const TPM2B_AUTH& auth,
6302       const TPM2B_NV_PUBLIC& public_info,
6303       std::string* serialized_command,
6304       AuthorizationDelegate* authorization_delegate);
6305   static TPM_RC ParseResponse_NV_DefineSpace(
6306       const std::string& response,
6307       AuthorizationDelegate* authorization_delegate);
6308   virtual void NV_DefineSpace(
6309       const TPMI_RH_PROVISION& auth_handle,
6310       const std::string& auth_handle_name,
6311       const TPM2B_AUTH& auth,
6312       const TPM2B_NV_PUBLIC& public_info,
6313       AuthorizationDelegate* authorization_delegate,
6314       const NV_DefineSpaceResponse& callback);
6315   virtual TPM_RC NV_DefineSpaceSync(
6316       const TPMI_RH_PROVISION& auth_handle,
6317       const std::string& auth_handle_name,
6318       const TPM2B_AUTH& auth,
6319       const TPM2B_NV_PUBLIC& public_info,
6320       AuthorizationDelegate* authorization_delegate);
6321   typedef base::Callback<void(
6322       TPM_RC response_code)> NV_UndefineSpaceResponse;
6323   static TPM_RC SerializeCommand_NV_UndefineSpace(
6324       const TPMI_RH_PROVISION& auth_handle,
6325       const std::string& auth_handle_name,
6326       const TPMI_RH_NV_INDEX& nv_index,
6327       const std::string& nv_index_name,
6328       std::string* serialized_command,
6329       AuthorizationDelegate* authorization_delegate);
6330   static TPM_RC ParseResponse_NV_UndefineSpace(
6331       const std::string& response,
6332       AuthorizationDelegate* authorization_delegate);
6333   virtual void NV_UndefineSpace(
6334       const TPMI_RH_PROVISION& auth_handle,
6335       const std::string& auth_handle_name,
6336       const TPMI_RH_NV_INDEX& nv_index,
6337       const std::string& nv_index_name,
6338       AuthorizationDelegate* authorization_delegate,
6339       const NV_UndefineSpaceResponse& callback);
6340   virtual TPM_RC NV_UndefineSpaceSync(
6341       const TPMI_RH_PROVISION& auth_handle,
6342       const std::string& auth_handle_name,
6343       const TPMI_RH_NV_INDEX& nv_index,
6344       const std::string& nv_index_name,
6345       AuthorizationDelegate* authorization_delegate);
6346   typedef base::Callback<void(
6347       TPM_RC response_code)> NV_UndefineSpaceSpecialResponse;
6348   static TPM_RC SerializeCommand_NV_UndefineSpaceSpecial(
6349       const TPMI_RH_NV_INDEX& nv_index,
6350       const std::string& nv_index_name,
6351       const TPMI_RH_PLATFORM& platform,
6352       const std::string& platform_name,
6353       std::string* serialized_command,
6354       AuthorizationDelegate* authorization_delegate);
6355   static TPM_RC ParseResponse_NV_UndefineSpaceSpecial(
6356       const std::string& response,
6357       AuthorizationDelegate* authorization_delegate);
6358   virtual void NV_UndefineSpaceSpecial(
6359       const TPMI_RH_NV_INDEX& nv_index,
6360       const std::string& nv_index_name,
6361       const TPMI_RH_PLATFORM& platform,
6362       const std::string& platform_name,
6363       AuthorizationDelegate* authorization_delegate,
6364       const NV_UndefineSpaceSpecialResponse& callback);
6365   virtual TPM_RC NV_UndefineSpaceSpecialSync(
6366       const TPMI_RH_NV_INDEX& nv_index,
6367       const std::string& nv_index_name,
6368       const TPMI_RH_PLATFORM& platform,
6369       const std::string& platform_name,
6370       AuthorizationDelegate* authorization_delegate);
6371   typedef base::Callback<void(
6372       TPM_RC response_code,
6373       const TPM2B_NV_PUBLIC& nv_public,
6374       const TPM2B_NAME& nv_name)> NV_ReadPublicResponse;
6375   static TPM_RC SerializeCommand_NV_ReadPublic(
6376       const TPMI_RH_NV_INDEX& nv_index,
6377       const std::string& nv_index_name,
6378       std::string* serialized_command,
6379       AuthorizationDelegate* authorization_delegate);
6380   static TPM_RC ParseResponse_NV_ReadPublic(
6381       const std::string& response,
6382       TPM2B_NV_PUBLIC* nv_public,
6383       TPM2B_NAME* nv_name,
6384       AuthorizationDelegate* authorization_delegate);
6385   virtual void NV_ReadPublic(
6386       const TPMI_RH_NV_INDEX& nv_index,
6387       const std::string& nv_index_name,
6388       AuthorizationDelegate* authorization_delegate,
6389       const NV_ReadPublicResponse& callback);
6390   virtual TPM_RC NV_ReadPublicSync(
6391       const TPMI_RH_NV_INDEX& nv_index,
6392       const std::string& nv_index_name,
6393       TPM2B_NV_PUBLIC* nv_public,
6394       TPM2B_NAME* nv_name,
6395       AuthorizationDelegate* authorization_delegate);
6396   typedef base::Callback<void(
6397       TPM_RC response_code)> NV_WriteResponse;
6398   static TPM_RC SerializeCommand_NV_Write(
6399       const TPMI_RH_NV_AUTH& auth_handle,
6400       const std::string& auth_handle_name,
6401       const TPMI_RH_NV_INDEX& nv_index,
6402       const std::string& nv_index_name,
6403       const TPM2B_MAX_NV_BUFFER& data,
6404       const UINT16& offset,
6405       std::string* serialized_command,
6406       AuthorizationDelegate* authorization_delegate);
6407   static TPM_RC ParseResponse_NV_Write(
6408       const std::string& response,
6409       AuthorizationDelegate* authorization_delegate);
6410   virtual void NV_Write(
6411       const TPMI_RH_NV_AUTH& auth_handle,
6412       const std::string& auth_handle_name,
6413       const TPMI_RH_NV_INDEX& nv_index,
6414       const std::string& nv_index_name,
6415       const TPM2B_MAX_NV_BUFFER& data,
6416       const UINT16& offset,
6417       AuthorizationDelegate* authorization_delegate,
6418       const NV_WriteResponse& callback);
6419   virtual TPM_RC NV_WriteSync(
6420       const TPMI_RH_NV_AUTH& auth_handle,
6421       const std::string& auth_handle_name,
6422       const TPMI_RH_NV_INDEX& nv_index,
6423       const std::string& nv_index_name,
6424       const TPM2B_MAX_NV_BUFFER& data,
6425       const UINT16& offset,
6426       AuthorizationDelegate* authorization_delegate);
6427   typedef base::Callback<void(
6428       TPM_RC response_code)> NV_IncrementResponse;
6429   static TPM_RC SerializeCommand_NV_Increment(
6430       const TPMI_RH_NV_AUTH& auth_handle,
6431       const std::string& auth_handle_name,
6432       const TPMI_RH_NV_INDEX& nv_index,
6433       const std::string& nv_index_name,
6434       std::string* serialized_command,
6435       AuthorizationDelegate* authorization_delegate);
6436   static TPM_RC ParseResponse_NV_Increment(
6437       const std::string& response,
6438       AuthorizationDelegate* authorization_delegate);
6439   virtual void NV_Increment(
6440       const TPMI_RH_NV_AUTH& auth_handle,
6441       const std::string& auth_handle_name,
6442       const TPMI_RH_NV_INDEX& nv_index,
6443       const std::string& nv_index_name,
6444       AuthorizationDelegate* authorization_delegate,
6445       const NV_IncrementResponse& callback);
6446   virtual TPM_RC NV_IncrementSync(
6447       const TPMI_RH_NV_AUTH& auth_handle,
6448       const std::string& auth_handle_name,
6449       const TPMI_RH_NV_INDEX& nv_index,
6450       const std::string& nv_index_name,
6451       AuthorizationDelegate* authorization_delegate);
6452   typedef base::Callback<void(
6453       TPM_RC response_code)> NV_ExtendResponse;
6454   static TPM_RC SerializeCommand_NV_Extend(
6455       const TPMI_RH_NV_AUTH& auth_handle,
6456       const std::string& auth_handle_name,
6457       const TPMI_RH_NV_INDEX& nv_index,
6458       const std::string& nv_index_name,
6459       const TPM2B_MAX_NV_BUFFER& data,
6460       std::string* serialized_command,
6461       AuthorizationDelegate* authorization_delegate);
6462   static TPM_RC ParseResponse_NV_Extend(
6463       const std::string& response,
6464       AuthorizationDelegate* authorization_delegate);
6465   virtual void NV_Extend(
6466       const TPMI_RH_NV_AUTH& auth_handle,
6467       const std::string& auth_handle_name,
6468       const TPMI_RH_NV_INDEX& nv_index,
6469       const std::string& nv_index_name,
6470       const TPM2B_MAX_NV_BUFFER& data,
6471       AuthorizationDelegate* authorization_delegate,
6472       const NV_ExtendResponse& callback);
6473   virtual TPM_RC NV_ExtendSync(
6474       const TPMI_RH_NV_AUTH& auth_handle,
6475       const std::string& auth_handle_name,
6476       const TPMI_RH_NV_INDEX& nv_index,
6477       const std::string& nv_index_name,
6478       const TPM2B_MAX_NV_BUFFER& data,
6479       AuthorizationDelegate* authorization_delegate);
6480   typedef base::Callback<void(
6481       TPM_RC response_code)> NV_SetBitsResponse;
6482   static TPM_RC SerializeCommand_NV_SetBits(
6483       const TPMI_RH_NV_AUTH& auth_handle,
6484       const std::string& auth_handle_name,
6485       const TPMI_RH_NV_INDEX& nv_index,
6486       const std::string& nv_index_name,
6487       const UINT64& bits,
6488       std::string* serialized_command,
6489       AuthorizationDelegate* authorization_delegate);
6490   static TPM_RC ParseResponse_NV_SetBits(
6491       const std::string& response,
6492       AuthorizationDelegate* authorization_delegate);
6493   virtual void NV_SetBits(
6494       const TPMI_RH_NV_AUTH& auth_handle,
6495       const std::string& auth_handle_name,
6496       const TPMI_RH_NV_INDEX& nv_index,
6497       const std::string& nv_index_name,
6498       const UINT64& bits,
6499       AuthorizationDelegate* authorization_delegate,
6500       const NV_SetBitsResponse& callback);
6501   virtual TPM_RC NV_SetBitsSync(
6502       const TPMI_RH_NV_AUTH& auth_handle,
6503       const std::string& auth_handle_name,
6504       const TPMI_RH_NV_INDEX& nv_index,
6505       const std::string& nv_index_name,
6506       const UINT64& bits,
6507       AuthorizationDelegate* authorization_delegate);
6508   typedef base::Callback<void(
6509       TPM_RC response_code)> NV_WriteLockResponse;
6510   static TPM_RC SerializeCommand_NV_WriteLock(
6511       const TPMI_RH_NV_AUTH& auth_handle,
6512       const std::string& auth_handle_name,
6513       const TPMI_RH_NV_INDEX& nv_index,
6514       const std::string& nv_index_name,
6515       std::string* serialized_command,
6516       AuthorizationDelegate* authorization_delegate);
6517   static TPM_RC ParseResponse_NV_WriteLock(
6518       const std::string& response,
6519       AuthorizationDelegate* authorization_delegate);
6520   virtual void NV_WriteLock(
6521       const TPMI_RH_NV_AUTH& auth_handle,
6522       const std::string& auth_handle_name,
6523       const TPMI_RH_NV_INDEX& nv_index,
6524       const std::string& nv_index_name,
6525       AuthorizationDelegate* authorization_delegate,
6526       const NV_WriteLockResponse& callback);
6527   virtual TPM_RC NV_WriteLockSync(
6528       const TPMI_RH_NV_AUTH& auth_handle,
6529       const std::string& auth_handle_name,
6530       const TPMI_RH_NV_INDEX& nv_index,
6531       const std::string& nv_index_name,
6532       AuthorizationDelegate* authorization_delegate);
6533   typedef base::Callback<void(
6534       TPM_RC response_code)> NV_GlobalWriteLockResponse;
6535   static TPM_RC SerializeCommand_NV_GlobalWriteLock(
6536       const TPMI_RH_PROVISION& auth_handle,
6537       const std::string& auth_handle_name,
6538       std::string* serialized_command,
6539       AuthorizationDelegate* authorization_delegate);
6540   static TPM_RC ParseResponse_NV_GlobalWriteLock(
6541       const std::string& response,
6542       AuthorizationDelegate* authorization_delegate);
6543   virtual void NV_GlobalWriteLock(
6544       const TPMI_RH_PROVISION& auth_handle,
6545       const std::string& auth_handle_name,
6546       AuthorizationDelegate* authorization_delegate,
6547       const NV_GlobalWriteLockResponse& callback);
6548   virtual TPM_RC NV_GlobalWriteLockSync(
6549       const TPMI_RH_PROVISION& auth_handle,
6550       const std::string& auth_handle_name,
6551       AuthorizationDelegate* authorization_delegate);
6552   typedef base::Callback<void(
6553       TPM_RC response_code,
6554       const TPM2B_MAX_NV_BUFFER& data)> NV_ReadResponse;
6555   static TPM_RC SerializeCommand_NV_Read(
6556       const TPMI_RH_NV_AUTH& auth_handle,
6557       const std::string& auth_handle_name,
6558       const TPMI_RH_NV_INDEX& nv_index,
6559       const std::string& nv_index_name,
6560       const UINT16& size,
6561       const UINT16& offset,
6562       std::string* serialized_command,
6563       AuthorizationDelegate* authorization_delegate);
6564   static TPM_RC ParseResponse_NV_Read(
6565       const std::string& response,
6566       TPM2B_MAX_NV_BUFFER* data,
6567       AuthorizationDelegate* authorization_delegate);
6568   virtual void NV_Read(
6569       const TPMI_RH_NV_AUTH& auth_handle,
6570       const std::string& auth_handle_name,
6571       const TPMI_RH_NV_INDEX& nv_index,
6572       const std::string& nv_index_name,
6573       const UINT16& size,
6574       const UINT16& offset,
6575       AuthorizationDelegate* authorization_delegate,
6576       const NV_ReadResponse& callback);
6577   virtual TPM_RC NV_ReadSync(
6578       const TPMI_RH_NV_AUTH& auth_handle,
6579       const std::string& auth_handle_name,
6580       const TPMI_RH_NV_INDEX& nv_index,
6581       const std::string& nv_index_name,
6582       const UINT16& size,
6583       const UINT16& offset,
6584       TPM2B_MAX_NV_BUFFER* data,
6585       AuthorizationDelegate* authorization_delegate);
6586   typedef base::Callback<void(
6587       TPM_RC response_code)> NV_ReadLockResponse;
6588   static TPM_RC SerializeCommand_NV_ReadLock(
6589       const TPMI_RH_NV_AUTH& auth_handle,
6590       const std::string& auth_handle_name,
6591       const TPMI_RH_NV_INDEX& nv_index,
6592       const std::string& nv_index_name,
6593       std::string* serialized_command,
6594       AuthorizationDelegate* authorization_delegate);
6595   static TPM_RC ParseResponse_NV_ReadLock(
6596       const std::string& response,
6597       AuthorizationDelegate* authorization_delegate);
6598   virtual void NV_ReadLock(
6599       const TPMI_RH_NV_AUTH& auth_handle,
6600       const std::string& auth_handle_name,
6601       const TPMI_RH_NV_INDEX& nv_index,
6602       const std::string& nv_index_name,
6603       AuthorizationDelegate* authorization_delegate,
6604       const NV_ReadLockResponse& callback);
6605   virtual TPM_RC NV_ReadLockSync(
6606       const TPMI_RH_NV_AUTH& auth_handle,
6607       const std::string& auth_handle_name,
6608       const TPMI_RH_NV_INDEX& nv_index,
6609       const std::string& nv_index_name,
6610       AuthorizationDelegate* authorization_delegate);
6611   typedef base::Callback<void(
6612       TPM_RC response_code)> NV_ChangeAuthResponse;
6613   static TPM_RC SerializeCommand_NV_ChangeAuth(
6614       const TPMI_RH_NV_INDEX& nv_index,
6615       const std::string& nv_index_name,
6616       const TPM2B_AUTH& new_auth,
6617       std::string* serialized_command,
6618       AuthorizationDelegate* authorization_delegate);
6619   static TPM_RC ParseResponse_NV_ChangeAuth(
6620       const std::string& response,
6621       AuthorizationDelegate* authorization_delegate);
6622   virtual void NV_ChangeAuth(
6623       const TPMI_RH_NV_INDEX& nv_index,
6624       const std::string& nv_index_name,
6625       const TPM2B_AUTH& new_auth,
6626       AuthorizationDelegate* authorization_delegate,
6627       const NV_ChangeAuthResponse& callback);
6628   virtual TPM_RC NV_ChangeAuthSync(
6629       const TPMI_RH_NV_INDEX& nv_index,
6630       const std::string& nv_index_name,
6631       const TPM2B_AUTH& new_auth,
6632       AuthorizationDelegate* authorization_delegate);
6633   typedef base::Callback<void(
6634       TPM_RC response_code,
6635       const TPM2B_ATTEST& certify_info,
6636       const TPMT_SIGNATURE& signature)> NV_CertifyResponse;
6637   static TPM_RC SerializeCommand_NV_Certify(
6638       const TPMI_DH_OBJECT& sign_handle,
6639       const std::string& sign_handle_name,
6640       const TPMI_RH_NV_AUTH& auth_handle,
6641       const std::string& auth_handle_name,
6642       const TPMI_RH_NV_INDEX& nv_index,
6643       const std::string& nv_index_name,
6644       const TPM2B_DATA& qualifying_data,
6645       const TPMT_SIG_SCHEME& in_scheme,
6646       const UINT16& size,
6647       const UINT16& offset,
6648       std::string* serialized_command,
6649       AuthorizationDelegate* authorization_delegate);
6650   static TPM_RC ParseResponse_NV_Certify(
6651       const std::string& response,
6652       TPM2B_ATTEST* certify_info,
6653       TPMT_SIGNATURE* signature,
6654       AuthorizationDelegate* authorization_delegate);
6655   virtual void NV_Certify(
6656       const TPMI_DH_OBJECT& sign_handle,
6657       const std::string& sign_handle_name,
6658       const TPMI_RH_NV_AUTH& auth_handle,
6659       const std::string& auth_handle_name,
6660       const TPMI_RH_NV_INDEX& nv_index,
6661       const std::string& nv_index_name,
6662       const TPM2B_DATA& qualifying_data,
6663       const TPMT_SIG_SCHEME& in_scheme,
6664       const UINT16& size,
6665       const UINT16& offset,
6666       AuthorizationDelegate* authorization_delegate,
6667       const NV_CertifyResponse& callback);
6668   virtual TPM_RC NV_CertifySync(
6669       const TPMI_DH_OBJECT& sign_handle,
6670       const std::string& sign_handle_name,
6671       const TPMI_RH_NV_AUTH& auth_handle,
6672       const std::string& auth_handle_name,
6673       const TPMI_RH_NV_INDEX& nv_index,
6674       const std::string& nv_index_name,
6675       const TPM2B_DATA& qualifying_data,
6676       const TPMT_SIG_SCHEME& in_scheme,
6677       const UINT16& size,
6678       const UINT16& offset,
6679       TPM2B_ATTEST* certify_info,
6680       TPMT_SIGNATURE* signature,
6681       AuthorizationDelegate* authorization_delegate);
6682 
6683  private:
6684   CommandTransceiver* transceiver_;
6685 
6686   DISALLOW_COPY_AND_ASSIGN(Tpm);
6687 };
6688 
6689 }  // namespace trunks
6690 
6691 #endif  // TRUNKS_TPM_GENERATED_H_
6692