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