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