1 /********************************************************************************/
2 /*										*/
3 /*		    TSS Implementation Specific Constants			*/
4 /*			     Written by Ken Goldman				*/
5 /*		       IBM Thomas J. Watson Research Center			*/
6 /*										*/
7 /*  Licenses and Notices							*/
8 /*										*/
9 /*  1. Copyright Licenses:							*/
10 /*										*/
11 /*  - Trusted Computing Group (TCG) grants to the user of the source code in	*/
12 /*    this specification (the "Source Code") a worldwide, irrevocable, 		*/
13 /*    nonexclusive, royalty free, copyright license to reproduce, create 	*/
14 /*    derivative works, distribute, display and perform the Source Code and	*/
15 /*    derivative works thereof, and to grant others the rights granted herein.	*/
16 /*										*/
17 /*  - The TCG grants to the user of the other parts of the specification 	*/
18 /*    (other than the Source Code) the rights to reproduce, distribute, 	*/
19 /*    display, and perform the specification solely for the purpose of 		*/
20 /*    developing products based on such documents.				*/
21 /*										*/
22 /*  2. Source Code Distribution Conditions:					*/
23 /*										*/
24 /*  - Redistributions of Source Code must retain the above copyright licenses, 	*/
25 /*    this list of conditions and the following disclaimers.			*/
26 /*										*/
27 /*  - Redistributions in binary form must reproduce the above copyright 	*/
28 /*    licenses, this list of conditions	and the following disclaimers in the 	*/
29 /*    documentation and/or other materials provided with the distribution.	*/
30 /*										*/
31 /*  3. Disclaimers:								*/
32 /*										*/
33 /*  - THE COPYRIGHT LICENSES SET FORTH ABOVE DO NOT REPRESENT ANY FORM OF	*/
34 /*  LICENSE OR WAIVER, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, WITH	*/
35 /*  RESPECT TO PATENT RIGHTS HELD BY TCG MEMBERS (OR OTHER THIRD PARTIES)	*/
36 /*  THAT MAY BE NECESSARY TO IMPLEMENT THIS SPECIFICATION OR OTHERWISE.		*/
37 /*  Contact TCG Administration (admin@trustedcomputinggroup.org) for 		*/
38 /*  information on specification licensing rights available through TCG 	*/
39 /*  membership agreements.							*/
40 /*										*/
41 /*  - THIS SPECIFICATION IS PROVIDED "AS IS" WITH NO EXPRESS OR IMPLIED 	*/
42 /*    WARRANTIES WHATSOEVER, INCLUDING ANY WARRANTY OF MERCHANTABILITY OR 	*/
43 /*    FITNESS FOR A PARTICULAR PURPOSE, ACCURACY, COMPLETENESS, OR 		*/
44 /*    NONINFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS, OR ANY WARRANTY 		*/
45 /*    OTHERWISE ARISING OUT OF ANY PROPOSAL, SPECIFICATION OR SAMPLE.		*/
46 /*										*/
47 /*  - Without limitation, TCG and its members and licensors disclaim all 	*/
48 /*    liability, including liability for infringement of any proprietary 	*/
49 /*    rights, relating to use of information in this specification and to the	*/
50 /*    implementation of this specification, and TCG disclaims all liability for	*/
51 /*    cost of procurement of substitute goods or services, lost profits, loss 	*/
52 /*    of use, loss of data or any incidental, consequential, direct, indirect, 	*/
53 /*    or special damages, whether under contract, tort, warranty or otherwise, 	*/
54 /*    arising in any way out of use or reliance upon this specification or any 	*/
55 /*    information herein.							*/
56 /*										*/
57 /*  (c) Copyright IBM Corp. and others, 2012 - 2019				*/
58 /*										*/
59 /********************************************************************************/
60 
61 /* #define TPM_TSS_SO_0 to get the libibmtss.so.0 values.  Leave it undefined to get the new
62    libibmtss.so.1 values.
63 
64    The new values are required for a TPM with 4 or more hash algorithms.
65 */
66 
67 // A.2	Implementation.h
68 
69 #ifndef _IMPLEMENTATION_H_
70 #define _IMPLEMENTATION_H_
71 
72 #include <ibmtss/TpmBuildSwitches.h>
73 #include <ibmtss/BaseTypes.h>
74 #include <ibmtss/TPMB.h>
75 
76 /* Constants for TPM_Types.h structures.  Changing these values is likely to break ABI
77    compatiblility.*/
78 
79 // From Vendor-Specific: Table 4 - Defines for Key Size Constants
80 
81 #ifdef TPM_TSS_SO_0
82 #define  MAX_RSA_KEY_BYTES          256
83 #else
84 #define  MAX_RSA_KEY_BYTES          512
85 #endif
86 
87 #ifdef TPM_TSS_SO_0
88 #define  MAX_ECC_KEY_BYTES     48
89 #else
90 #define  MAX_ECC_KEY_BYTES     128
91 #endif
92 
93 /* This is the PC Client minimum value, and should be used for applications. */
94 #define IMPLEMENTATION_PCR		24
95 
96 #define MAX_HANDLE_NUM			3	/* the maximum number of handles in the handle
97 						   area */
98 #define MAX_ACTIVE_SESSIONS		64	/* the number of simultaneously active sessions that
99 						   are supported by the TPM implementation */
100 #define MAX_SESSION_NUM 		3	/* this is the current maximum value */
101 
102 #ifdef TPM_TSS_SO_0
103 #define PCR_SELECT_MAX			((IMPLEMENTATION_PCR+7)/8)
104 #else
105 /* increased to 8 to handle up to 64 PCRs */
106 #define PCR_SELECT_MAX			8
107 #endif
108 
109 #ifdef TPM_TSS_SO_0
110 #define MAX_CONTEXT_SIZE		2048
111 #else
112 #define MAX_CONTEXT_SIZE		5120
113 #endif
114 
115 #define MAX_DIGEST_BUFFER		2048
116 #define MAX_NV_BUFFER_SIZE		2048
117 #define MAX_CAP_BUFFER                  2048
118 
119 #ifdef TPM_TSS_SO_0
120 #define MAX_ALG_LIST_SIZE               64	/* number of algorithms that can be in a list */
121 #else
122 #define MAX_ALG_LIST_SIZE               128	/* number of algorithms that can be in a list */
123 #endif
124 
125 #define MAX_COMMAND_SIZE		4096	/* maximum size of a command */
126 #define MAX_RESPONSE_SIZE		4096	/* maximum size of a response */
127 
128 #ifdef TPM_TSS_SO_0
129 #define MAX_SYM_DATA			128		/* this is the maximum number of octets that
130 							   may be in a sealed blob. */
131 #else
132 #define MAX_SYM_DATA			256
133 #endif
134 
135 #ifdef TPM_TSS_SO_0
136 /* For the TSS .so.0, the number of digest and PCR banks was originally dependent on the number of
137    supported hash algoriths, using common TPM / TSS code. */
138 #define HASH_COUNT 3
139 #else
140 /* For the TSS .so.1, the number was increased to support a SW TPM with 4 banks (unlikely for a HW
141    TPM) plus future expansion. */
142 #define HASH_COUNT 16
143 #endif
144 
145 /* value independent of supported hash algorithms */
146 #define LABEL_MAX_BUFFER   48
147 #if LABEL_MAX_BUFFER < 32
148 #error "The size allowed for the label is not large enough for interoperability."
149 #endif
150 
151 /* hard code maximum independent of the algorithms actually supported */
152 #define MAX_SYM_KEY_BYTES 	32
153 #define MAX_SYM_BLOCK_SIZE  	16
154 
155 #define RSA_DEFAULT_PUBLIC_EXPONENT	0x00010001	/* 2^^16 + 1 */
156 
157 #undef TRUE
158 #undef FALSE
159 
160 // From TPM 2.0 Part 2: Table 4 - Defines for Logic Values
161 
162 #define  TRUE     1
163 #define  FALSE    0
164 #define  YES      1
165 #define  NO       0
166 #define  SET      1
167 #define  CLEAR    0
168 
169 // Change these definitions to turn all algorithms or commands ON or OFF. That is, to turn all
170 // algorithms on, set ALG_NO to YES. This is mostly useful as a debug feature.
171 
172 #define      ALG_YES      YES
173 #define      ALG_NO       NO
174 #define      CC_YES       YES
175 #define      CC_NO        NO
176 
177 // From Vendor-Specific: Table 2 - Defines for Implemented Algorithms
178 
179 #ifndef ALG_RSA
180 #define  ALG_RSA               ALG_YES
181 #endif
182 #ifndef ALG_SHA1
183 #define  ALG_SHA1              ALG_YES
184 #endif
185 #define  ALG_HMAC              ALG_YES
186 #ifndef ALG_TDES
187 #define  ALG_TDES              ALG_YES
188 #endif
189 #define  ALG_AES               ALG_YES
190 #define  ALG_MGF1              ALG_YES
191 #define  ALG_XOR               ALG_YES
192 #define  ALG_KEYEDHASH         ALG_YES
193 #ifndef ALG_SHA256
194 #define  ALG_SHA256            ALG_YES
195 #endif
196 #ifndef ALG_SHA384
197 #define  ALG_SHA384            ALG_YES
198 #endif
199 #ifndef ALG_SHA512
200 #define  ALG_SHA512            ALG_YES
201 #endif
202 #define  ALG_SHA3_256          ALG_NO
203 #define  ALG_SHA3_384          ALG_NO
204 #define  ALG_SHA3_512          ALG_NO
205 #define  ALG_SM3_256           ALG_YES
206 #define  ALG_SM4               ALG_NO
207 #define  ALG_RSASSA            (ALG_YES*ALG_RSA)
208 #define  ALG_RSAES             (ALG_YES*ALG_RSA)
209 #define  ALG_RSAPSS            (ALG_YES*ALG_RSA)
210 #define  ALG_OAEP              (ALG_YES*ALG_RSA)
211 #ifndef ALG_ECC
212 #define  ALG_ECC               ALG_YES
213 #endif
214 #define  ALG_ECDH              (ALG_YES*ALG_ECC)
215 #define  ALG_ECDSA             (ALG_YES*ALG_ECC)
216 #define  ALG_ECDAA             (ALG_YES*ALG_ECC)
217 #define  ALG_SM2               (ALG_YES*ALG_ECC)
218 #define  ALG_ECSCHNORR         (ALG_YES*ALG_ECC)
219 #define  ALG_ECMQV             (ALG_NO*ALG_ECC)
220 #define  ALG_SYMCIPHER         ALG_YES
221 #define  ALG_KDF1_SP800_56A    (ALG_YES*ALG_ECC)
222 #define  ALG_KDF2              ALG_NO
223 #define  ALG_KDF1_SP800_108    ALG_YES
224 #define  ALG_CTR               ALG_YES
225 #define  ALG_OFB               ALG_YES
226 #define  ALG_CBC               ALG_YES
227 #define  ALG_CFB               ALG_YES
228 #define  ALG_ECB               ALG_YES
229 
230 // From Vendor-Specific: Table 6 - Defines for Implemented Commands
231 
232 #define  CC_ActivateCredential            CC_YES
233 #define  CC_Certify                       CC_YES
234 #define  CC_CertifyCreation               CC_YES
235 #define  CC_CertifyX509		          CC_YES
236 #define  CC_ChangeEPS                     CC_YES
237 #define  CC_ChangePPS                     CC_YES
238 #define  CC_Clear                         CC_YES
239 #define  CC_ClearControl                  CC_YES
240 #define  CC_ClockRateAdjust               CC_YES
241 #define  CC_ClockSet                      CC_YES
242 #define  CC_Commit                        (CC_YES*ALG_ECC)
243 #define  CC_ContextLoad                   CC_YES
244 #define  CC_ContextSave                   CC_YES
245 #define  CC_Create                        CC_YES
246 #define  CC_CreatePrimary                 CC_YES
247 #define  CC_DictionaryAttackLockReset     CC_YES
248 #define  CC_DictionaryAttackParameters    CC_YES
249 #define  CC_Duplicate                     CC_YES
250 #define  CC_ECC_Parameters                (CC_YES*ALG_ECC)
251 #define  CC_ECDH_KeyGen                   (CC_YES*ALG_ECC)
252 #define  CC_ECDH_ZGen                     (CC_YES*ALG_ECC)
253 #define  CC_EncryptDecrypt                CC_YES
254 #define  CC_EventSequenceComplete         CC_YES
255 #define  CC_EvictControl                  CC_YES
256 #define  CC_FieldUpgradeData              CC_NO
257 #define  CC_FieldUpgradeStart             CC_NO
258 #define  CC_FirmwareRead                  CC_NO
259 #define  CC_FlushContext                  CC_YES
260 #define  CC_GetCapability                 CC_YES
261 #define  CC_GetCommandAuditDigest         CC_YES
262 #define  CC_GetRandom                     CC_YES
263 #define  CC_GetSessionAuditDigest         CC_YES
264 #define  CC_GetTestResult                 CC_YES
265 #define  CC_GetTime                       CC_YES
266 #define  CC_Hash                          CC_YES
267 #define  CC_HashSequenceStart             CC_YES
268 #define  CC_HierarchyChangeAuth           CC_YES
269 #define  CC_HierarchyControl              CC_YES
270 #define  CC_HMAC                          CC_YES
271 #define  CC_HMAC_Start                    CC_YES
272 #define  CC_Import                        CC_YES
273 #define  CC_IncrementalSelfTest           CC_YES
274 #define  CC_Load                          CC_YES
275 #define  CC_LoadExternal                  CC_YES
276 #define  CC_MakeCredential                CC_YES
277 #define  CC_NV_Certify                    CC_YES
278 #define  CC_NV_ChangeAuth                 CC_YES
279 #define  CC_NV_DefineSpace                CC_YES
280 #define  CC_NV_Extend                     CC_YES
281 #define  CC_NV_GlobalWriteLock            CC_YES
282 #define  CC_NV_Increment                  CC_YES
283 #define  CC_NV_Read                       CC_YES
284 #define  CC_NV_ReadLock                   CC_YES
285 #define  CC_NV_ReadPublic                 CC_YES
286 #define  CC_NV_SetBits                    CC_YES
287 #define  CC_NV_UndefineSpace              CC_YES
288 #define  CC_NV_UndefineSpaceSpecial       CC_YES
289 #define  CC_NV_Write                      CC_YES
290 #define  CC_NV_WriteLock                  CC_YES
291 #define  CC_ObjectChangeAuth              CC_YES
292 #define  CC_PCR_Allocate                  CC_YES
293 #define  CC_PCR_Event                     CC_YES
294 #define  CC_PCR_Extend                    CC_YES
295 #define  CC_PCR_Read                      CC_YES
296 #define  CC_PCR_Reset                     CC_YES
297 #define  CC_PCR_SetAuthPolicy             CC_YES
298 #define  CC_PCR_SetAuthValue              CC_YES
299 #define  CC_PolicyAuthorize               CC_YES
300 #define  CC_PolicyAuthorizeNV             CC_YES
301 #define  CC_PolicyAuthValue               CC_YES
302 #define  CC_PolicyCommandCode             CC_YES
303 #define  CC_PolicyCounterTimer            CC_YES
304 #define  CC_PolicyCpHash                  CC_YES
305 #define  CC_PolicyDuplicationSelect       CC_YES
306 #define  CC_PolicyGetDigest               CC_YES
307 #define  CC_PolicyLocality                CC_YES
308 #define  CC_PolicyNameHash                CC_YES
309 #define  CC_PolicyNV                      CC_YES
310 #define  CC_PolicyOR                      CC_YES
311 #define  CC_PolicyPassword                CC_YES
312 #define  CC_PolicyPCR                     CC_YES
313 #define  CC_PolicyPhysicalPresence        CC_YES
314 #define  CC_PolicyRestart                 CC_YES
315 #define  CC_PolicySecret                  CC_YES
316 #define  CC_PolicySigned                  CC_YES
317 #define  CC_PolicyTicket                  CC_YES
318 #define  CC_PP_Commands                   CC_YES
319 #define  CC_Quote                         CC_YES
320 #define  CC_ReadClock                     CC_YES
321 #define  CC_ReadPublic                    CC_YES
322 #define  CC_Rewrap                        CC_YES
323 #define  CC_RSA_Decrypt                   (CC_YES*ALG_RSA)
324 #define  CC_RSA_Encrypt                   (CC_YES*ALG_RSA)
325 #define  CC_SelfTest                      CC_YES
326 #define  CC_SequenceComplete              CC_YES
327 #define  CC_SequenceUpdate                CC_YES
328 #define  CC_SetAlgorithmSet               CC_YES
329 #define  CC_SetCommandCodeAuditStatus     CC_YES
330 #define  CC_SetPrimaryPolicy              CC_YES
331 #define  CC_Shutdown                      CC_YES
332 #define  CC_Sign                          CC_YES
333 #define  CC_StartAuthSession              CC_YES
334 #define  CC_Startup                       CC_YES
335 #define  CC_StirRandom                    CC_YES
336 #define  CC_TestParms                     CC_YES
337 #define  CC_Unseal                        CC_YES
338 #define  CC_VerifySignature               CC_YES
339 #define  CC_ZGen_2Phase                   (CC_YES*ALG_ECC)
340 #define  CC_EC_Ephemeral                  (CC_YES*ALG_ECC)
341 #define  CC_PolicyNvWritten               CC_YES
342 #define  CC_PolicyTemplate                CC_YES
343 #define  CC_CreateLoaded                  CC_YES
344 #define  CC_PolicyAuthorizeNV             CC_YES
345 #define  CC_EncryptDecrypt2               CC_YES
346 #define  CC_Vendor_TCG_Test               CC_YES
347 
348 #define  CC_NTC2_PreConfig                CC_YES
349 #define  CC_NTC2_LockPreConfig            CC_YES
350 #define  CC_NTC2_GetConfig                CC_YES
351 
352 // From TCG Algorithm Registry: Table 2 - Definition of TPM_ALG_ID Constants
353 
354 #define  ALG_ERROR_VALUE             0x0000
355 #define  TPM_ALG_ERROR               (TPM_ALG_ID)(ALG_ERROR_VALUE)
356 #define  ALG_RSA_VALUE               0x0001
357 #if defined ALG_RSA && ALG_RSA == YES
358 #define  TPM_ALG_RSA                 (TPM_ALG_ID)(ALG_RSA_VALUE)
359 #endif
360 #define  ALG_TDES_VALUE              0x0003
361 #if defined ALG_TDES && ALG_TDES == YES
362 #define  TPM_ALG_TDES                (TPM_ALG_ID)(ALG_TDES_VALUE)
363 #endif
364 #define  ALG_SHA_VALUE               0x0004
365 #if defined ALG_SHA && ALG_SHA == YES
366 #define  TPM_ALG_SHA                 (TPM_ALG_ID)(ALG_SHA_VALUE)
367 #endif
368 #define  ALG_SHA1_VALUE              0x0004
369 #if defined ALG_SHA1 && ALG_SHA1 == YES
370 #define  TPM_ALG_SHA1                (TPM_ALG_ID)(ALG_SHA1_VALUE)
371 #endif
372 #define  ALG_HMAC_VALUE              0x0005
373 #if defined ALG_HMAC && ALG_HMAC == YES
374 #define  TPM_ALG_HMAC                (TPM_ALG_ID)(ALG_HMAC_VALUE)
375 #endif
376 #define  ALG_AES_VALUE               0x0006
377 #if defined ALG_AES && ALG_AES == YES
378 #define  TPM_ALG_AES                 (TPM_ALG_ID)(ALG_AES_VALUE)
379 #endif
380 #define  ALG_MGF1_VALUE              0x0007
381 #if defined ALG_MGF1 && ALG_MGF1 == YES
382 #define  TPM_ALG_MGF1                (TPM_ALG_ID)(ALG_MGF1_VALUE)
383 #endif
384 #define  ALG_KEYEDHASH_VALUE         0x0008
385 #if defined ALG_KEYEDHASH && ALG_KEYEDHASH == YES
386 #define  TPM_ALG_KEYEDHASH           (TPM_ALG_ID)(ALG_KEYEDHASH_VALUE)
387 #endif
388 #define  ALG_XOR_VALUE               0x000A
389 #if defined ALG_XOR && ALG_XOR == YES
390 #define  TPM_ALG_XOR                 (TPM_ALG_ID)(ALG_XOR_VALUE)
391 #endif
392 #define  ALG_SHA256_VALUE            0x000B
393 #if defined ALG_SHA256 && ALG_SHA256 == YES
394 #define  TPM_ALG_SHA256              (TPM_ALG_ID)(ALG_SHA256_VALUE)
395 #endif
396 #define  ALG_SHA384_VALUE            0x000C
397 #if defined ALG_SHA384 && ALG_SHA384 == YES
398 #define  TPM_ALG_SHA384              (TPM_ALG_ID)(ALG_SHA384_VALUE)
399 #endif
400 #define  ALG_SHA512_VALUE            0x000D
401 #if defined ALG_SHA512 && ALG_SHA512 == YES
402 #define  TPM_ALG_SHA512              (TPM_ALG_ID)(ALG_SHA512_VALUE)
403 #endif
404 #define  ALG_NULL_VALUE              0x0010
405 #define  TPM_ALG_NULL                (TPM_ALG_ID)(ALG_NULL_VALUE)
406 #define  ALG_SM3_256_VALUE           0x0012
407 #if defined ALG_SM3_256 && ALG_SM3_256 == YES
408 #define  TPM_ALG_SM3_256             (TPM_ALG_ID)(ALG_SM3_256_VALUE)
409 #endif
410 #define  ALG_SM4_VALUE               0x0013
411 #if defined ALG_SM4 && ALG_SM4 == YES
412 #define  TPM_ALG_SM4                 (TPM_ALG_ID)(ALG_SM4_VALUE)
413 #endif
414 #define  ALG_RSASSA_VALUE            0x0014
415 #if defined ALG_RSASSA && ALG_RSASSA == YES
416 #define  TPM_ALG_RSASSA              (TPM_ALG_ID)(ALG_RSASSA_VALUE)
417 #endif
418 #define  ALG_RSAES_VALUE             0x0015
419 #if defined ALG_RSAES && ALG_RSAES == YES
420 #define  TPM_ALG_RSAES               (TPM_ALG_ID)(ALG_RSAES_VALUE)
421 #endif
422 #define  ALG_RSAPSS_VALUE            0x0016
423 #if defined ALG_RSAPSS && ALG_RSAPSS == YES
424 #define  TPM_ALG_RSAPSS              (TPM_ALG_ID)(ALG_RSAPSS_VALUE)
425 #endif
426 #define  ALG_OAEP_VALUE              0x0017
427 #if defined ALG_OAEP && ALG_OAEP == YES
428 #define  TPM_ALG_OAEP                (TPM_ALG_ID)(ALG_OAEP_VALUE)
429 #endif
430 #define  ALG_ECDSA_VALUE             0x0018
431 #if defined ALG_ECDSA && ALG_ECDSA == YES
432 #define  TPM_ALG_ECDSA               (TPM_ALG_ID)(ALG_ECDSA_VALUE)
433 #endif
434 #define  ALG_ECDH_VALUE              0x0019
435 #if defined ALG_ECDH && ALG_ECDH == YES
436 #define  TPM_ALG_ECDH                (TPM_ALG_ID)(ALG_ECDH_VALUE)
437 #endif
438 #define  ALG_ECDAA_VALUE             0x001A
439 #if defined ALG_ECDAA && ALG_ECDAA == YES
440 #define  TPM_ALG_ECDAA               (TPM_ALG_ID)(ALG_ECDAA_VALUE)
441 #endif
442 #define  ALG_SM2_VALUE               0x001B
443 #if defined ALG_SM2 && ALG_SM2 == YES
444 #define  TPM_ALG_SM2                 (TPM_ALG_ID)(ALG_SM2_VALUE)
445 #endif
446 #define  ALG_ECSCHNORR_VALUE         0x001C
447 #if defined ALG_ECSCHNORR && ALG_ECSCHNORR == YES
448 #define  TPM_ALG_ECSCHNORR           (TPM_ALG_ID)(ALG_ECSCHNORR_VALUE)
449 #endif
450 #define  ALG_ECMQV_VALUE             0x001D
451 #if defined ALG_ECMQV && ALG_ECMQV == YES
452 #define  TPM_ALG_ECMQV               (TPM_ALG_ID)(ALG_ECMQV_VALUE)
453 #endif
454 #define  ALG_KDF1_SP800_56A_VALUE    0x0020
455 #if defined ALG_KDF1_SP800_56A && ALG_KDF1_SP800_56A == YES
456 #define  TPM_ALG_KDF1_SP800_56A      (TPM_ALG_ID)(ALG_KDF1_SP800_56A_VALUE)
457 #endif
458 #define  ALG_KDF2_VALUE              0x0021
459 #if defined ALG_KDF2 && ALG_KDF2 == YES
460 #define  TPM_ALG_KDF2                (TPM_ALG_ID)(ALG_KDF2_VALUE)
461 #endif
462 #define  ALG_KDF1_SP800_108_VALUE    0x0022
463 #if defined ALG_KDF1_SP800_108 && ALG_KDF1_SP800_108 == YES
464 #define  TPM_ALG_KDF1_SP800_108      (TPM_ALG_ID)(ALG_KDF1_SP800_108_VALUE)
465 #endif
466 #define  ALG_ECC_VALUE               0x0023
467 #if defined ALG_ECC && ALG_ECC == YES
468 #define  TPM_ALG_ECC                 (TPM_ALG_ID)(ALG_ECC_VALUE)
469 #endif
470 #define  ALG_SYMCIPHER_VALUE         0x0025
471 #if defined ALG_SYMCIPHER && ALG_SYMCIPHER == YES
472 #define  TPM_ALG_SYMCIPHER           (TPM_ALG_ID)(ALG_SYMCIPHER_VALUE)
473 #endif
474 #define  ALG_CAMELLIA_VALUE          0x0026
475 #if defined ALG_CAMELLIA && ALG_CAMELLIA == YES
476 #define  TPM_ALG_CAMELLIA            (TPM_ALG_ID)(ALG_CAMELLIA_VALUE)
477 #endif
478 #define  ALG_SHA3_256_VALUE	     0x0027
479 #if defined ALG_SHA3_256 && ALG_SHA3_256 == YES
480 #define TPM_ALGSHA3_256              (TPM_ALG_ID)(ALG_SHA3_256_VALUE)
481 #endif
482 #define  ALG_SHA3_384_VALUE	     0x0028
483 #if defined ALG_SHA3_384 && ALG_SHA3_384 == YES
484 #define TPM_ALGSHA3_384              (TPM_ALG_ID)(ALG_SHA3_384_VALUE)
485 #endif
486 #define  ALG_SHA3_512_VALUE	     0x0029
487 #if defined ALG_SHA3_512 && ALG_SHA3_512 == YES
488 #define TPM_ALGSHA3_512              (TPM_ALG_ID)(ALG_SHA3_512_VALUE)
489 #endif
490 #define  ALG_CMAC_VALUE               0x003f
491 #if defined ALG_CMAC && ALG_CMAC == YES
492 #define  TPM_ALG_CMAC                 (TPM_ALG_ID)(ALG_CMAC_VALUE)
493 #endif
494 #define  ALG_CTR_VALUE               0x0040
495 #if defined ALG_CTR && ALG_CTR == YES
496 #define  TPM_ALG_CTR                 (TPM_ALG_ID)(ALG_CTR_VALUE)
497 #endif
498 #define  ALG_OFB_VALUE               0x0041
499 #if defined ALG_OFB && ALG_OFB == YES
500 #define  TPM_ALG_OFB                 (TPM_ALG_ID)(ALG_OFB_VALUE)
501 #endif
502 #define  ALG_CBC_VALUE               0x0042
503 #if defined ALG_CBC && ALG_CBC == YES
504 #define  TPM_ALG_CBC                 (TPM_ALG_ID)(ALG_CBC_VALUE)
505 #endif
506 #define  ALG_CFB_VALUE               0x0043
507 #if defined ALG_CFB && ALG_CFB == YES
508 #define  TPM_ALG_CFB                 (TPM_ALG_ID)(ALG_CFB_VALUE)
509 #endif
510 #define  ALG_ECB_VALUE               0x0044
511 #if defined ALG_ECB && ALG_ECB == YES
512 #define  TPM_ALG_ECB                 (TPM_ALG_ID)(ALG_ECB_VALUE)
513 #endif
514 
515 //     From TCG Algorithm Registry: Table 3 - Definition of TPM_ECC_CURVE Constants
516 
517 #define  TPM_ECC_NONE         (TPM_ECC_CURVE)(0x0000)
518 #define  TPM_ECC_NIST_P192    (TPM_ECC_CURVE)(0x0001)
519 #define  TPM_ECC_NIST_P224    (TPM_ECC_CURVE)(0x0002)
520 #define  TPM_ECC_NIST_P256    (TPM_ECC_CURVE)(0x0003)
521 #define  TPM_ECC_NIST_P384    (TPM_ECC_CURVE)(0x0004)
522 #define  TPM_ECC_NIST_P521    (TPM_ECC_CURVE)(0x0005)
523 #define  TPM_ECC_BN_P256      (TPM_ECC_CURVE)(0x0010)
524 #define  TPM_ECC_BN_P638      (TPM_ECC_CURVE)(0x0011)
525 #define  TPM_ECC_SM2_P256     (TPM_ECC_CURVE)(0x0020)
526 
527 // From TCG Algorithm Registry: Table 12 - Defines for SHA1 Hash Values
528 #define  SHA1_DIGEST_SIZE    20
529 #define  SHA1_BLOCK_SIZE     64
530 #define  SHA1_DER_SIZE       15
531 #define  SHA1_DER							\
532     0x30,0x21,0x30,0x09,0x06,0x05,0x2B,0x0E,0x03,0x02,0x1A,0x05,0x00,0x04,0x14
533 
534 // From TCG Algorithm Registry: Table 13 - Defines for SHA256 Hash Values
535 #define  SHA256_DIGEST_SIZE    32
536 #define  SHA256_BLOCK_SIZE     64
537 #define  SHA256_DER_SIZE       19
538 #define  SHA256_DER							\
539     0x30,0x31,0x30,0x0D,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x01,0x05,0x00,0x04,0x20
540 
541 // From TCG Algorithm Registry: Table 14 - Defines for SHA384 Hash Values
542 #define  SHA384_DIGEST_SIZE    48
543 #define  SHA384_BLOCK_SIZE     128
544 #define  SHA384_DER_SIZE       19
545 #define  SHA384_DER							\
546     0x30,0x41,0x30,0x0D,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x02,0x05,0x00,0x04,0x30
547 
548 // From TCG Algorithm Registry: Table 15 - Defines for SHA512 Hash Values
549 #define  SHA512_DIGEST_SIZE    64
550 #define  SHA512_BLOCK_SIZE     128
551 #define  SHA512_DER_SIZE       19
552 #define  SHA512_DER							\
553     0x30,0x51,0x30,0x0D,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x03,0x05,0x00,0x04,0x40
554 
555 // From TCG Algorithm Registry: Table 16 - Defines for SM3_256 Hash Values
556 #define  SM3_256_DIGEST_SIZE    32
557 #define  SM3_256_BLOCK_SIZE     64
558 #define  SM3_256_DER_SIZE       18
559 #define  SM3_256_DER							\
560     0x30,0x30,0x30,0x0C,0x06,0x08,0x2A,0x81,0x1C,0x81,0x45,0x01,0x83,0x11,0x05,0x00,0x04,0x20
561 
562 // From TCG Algorithm Registry: Table 17 - Defines for AES Symmetric Cipher Algorithm Constants
563 #define  AES_128_BLOCK_SIZE_BYTES    16
564 #define  AES_192_BLOCK_SIZE_BYTES    16
565 #define  AES_256_BLOCK_SIZE_BYTES    16
566 
567 // From TCG Algorithm Registry: Table 18 - Defines for SM4 Symmetric Cipher Algorithm Constants
568 #define  SM4_128_BLOCK_SIZE_BYTES    16
569 
570 // From TCG Algorithm Registry: Table 19 - Defines for CAMELLIA Symmetric Cipher Algorithm Constants
571 #define  CAMELLIA_128_BLOCK_SIZE_BYTES    16
572 #define  CAMELLIA_192_BLOCK_SIZE_BYTES    16
573 #define  CAMELLIA_256_BLOCK_SIZE_BYTES    16
574 
575 // From TPM 2.0 Part 2: Table 12 - Definition of TPM_CC Constants
576 
577 typedef  UINT32             TPM_CC;
578 
579 #define TPM_CC_FIRST	0x0000011f	/* Compile variable. May decrease based on
580 					   implementation. */
581 
582 #ifndef CC_NV_UndefineSpaceSpecial
583 #   define CC_NV_UndefineSpaceSpecial NO
584 #endif
585 #if CC_NV_UndefineSpaceSpecial == YES
586 #define  TPM_CC_NV_UndefineSpaceSpecial       (TPM_CC)(0x0000011f)
587 #endif
588 #ifndef CC_EvictControl
589 #   define CC_EvictControl NO
590 #endif
591 #if CC_EvictControl == YES
592 #define  TPM_CC_EvictControl                  (TPM_CC)(0x00000120)
593 #endif
594 #ifndef CC_HierarchyControl
595 #   define CC_HierarchyControl NO
596 #endif
597 #if CC_HierarchyControl == YES
598 #define  TPM_CC_HierarchyControl              (TPM_CC)(0x00000121)
599 #endif
600 #ifndef CC_NV_UndefineSpace
601 #   define CC_NV_UndefineSpace NO
602 #endif
603 #if CC_NV_UndefineSpace == YES
604 #define  TPM_CC_NV_UndefineSpace              (TPM_CC)(0x00000122)
605 #endif
606 #ifndef CC_ChangeEPS
607 #   define CC_ChangeEPS NO
608 #endif
609 #if CC_ChangeEPS == YES
610 #define  TPM_CC_ChangeEPS                     (TPM_CC)(0x00000124)
611 #endif
612 #ifndef CC_ChangePPS
613 #   define CC_ChangePPS NO
614 #endif
615 #if CC_ChangePPS == YES
616 #define  TPM_CC_ChangePPS                     (TPM_CC)(0x00000125)
617 #endif
618 #ifndef CC_Clear
619 #   define CC_Clear NO
620 #endif
621 #if CC_Clear == YES
622 #define  TPM_CC_Clear                         (TPM_CC)(0x00000126)
623 #endif
624 #ifndef CC_ClearControl
625 #   define CC_ClearControl NO
626 #endif
627 #if CC_ClearControl == YES
628 #define  TPM_CC_ClearControl                  (TPM_CC)(0x00000127)
629 #endif
630 #ifndef CC_ClockSet
631 #   define CC_ClockSet NO
632 #endif
633 #if CC_ClockSet == YES
634 #define  TPM_CC_ClockSet                      (TPM_CC)(0x00000128)
635 #endif
636 #ifndef CC_HierarchyChangeAuth
637 #   define CC_HierarchyChangeAuth NO
638 #endif
639 #if CC_HierarchyChangeAuth == YES
640 #define  TPM_CC_HierarchyChangeAuth           (TPM_CC)(0x00000129)
641 #endif
642 #ifndef CC_NV_DefineSpace
643 #   define CC_NV_DefineSpace NO
644 #endif
645 #if CC_NV_DefineSpace == YES
646 #define  TPM_CC_NV_DefineSpace                (TPM_CC)(0x0000012a)
647 #endif
648 #ifndef CC_PCR_Allocate
649 #   define CC_PCR_Allocate NO
650 #endif
651 #if CC_PCR_Allocate == YES
652 #define  TPM_CC_PCR_Allocate                  (TPM_CC)(0x0000012b)
653 #endif
654 #ifndef CC_PCR_SetAuthPolicy
655 #   define CC_PCR_SetAuthPolicy NO
656 #endif
657 #if CC_PCR_SetAuthPolicy == YES
658 #define  TPM_CC_PCR_SetAuthPolicy             (TPM_CC)(0x0000012c)
659 #endif
660 #ifndef CC_PP_Commands
661 #   define CC_PP_Commands NO
662 #endif
663 #if CC_PP_Commands == YES
664 #define  TPM_CC_PP_Commands                   (TPM_CC)(0x0000012d)
665 #endif
666 #ifndef CC_SetPrimaryPolicy
667 #   define CC_SetPrimaryPolicy NO
668 #endif
669 #if CC_SetPrimaryPolicy == YES
670 #define  TPM_CC_SetPrimaryPolicy              (TPM_CC)(0x0000012e)
671 #endif
672 #ifndef CC_FieldUpgradeStart
673 #   define CC_FieldUpgradeStart NO
674 #endif
675 #if CC_FieldUpgradeStart == YES
676 #define  TPM_CC_FieldUpgradeStart             (TPM_CC)(0x0000012f)
677 #endif
678 #ifndef CC_ClockRateAdjust
679 #   define CC_ClockRateAdjust NO
680 #endif
681 #if CC_ClockRateAdjust == YES
682 #define  TPM_CC_ClockRateAdjust               (TPM_CC)(0x00000130)
683 #endif
684 #ifndef CC_CreatePrimary
685 #   define CC_CreatePrimary NO
686 #endif
687 #if CC_CreatePrimary == YES
688 #define  TPM_CC_CreatePrimary                 (TPM_CC)(0x00000131)
689 #endif
690 #ifndef CC_NV_GlobalWriteLock
691 #   define CC_NV_GlobalWriteLock NO
692 #endif
693 #if CC_NV_GlobalWriteLock == YES
694 #define  TPM_CC_NV_GlobalWriteLock            (TPM_CC)(0x00000132)
695 #endif
696 #ifndef CC_GetCommandAuditDigest
697 #   define CC_GetCommandAuditDigest NO
698 #endif
699 #if CC_GetCommandAuditDigest == YES
700 #define  TPM_CC_GetCommandAuditDigest         (TPM_CC)(0x00000133)
701 #endif
702 #ifndef CC_NV_Increment
703 #   define CC_NV_Increment NO
704 #endif
705 #if CC_NV_Increment == YES
706 #define  TPM_CC_NV_Increment                  (TPM_CC)(0x00000134)
707 #endif
708 #ifndef CC_NV_SetBits
709 #   define CC_NV_SetBits NO
710 #endif
711 #if CC_NV_SetBits == YES
712 #define  TPM_CC_NV_SetBits                    (TPM_CC)(0x00000135)
713 #endif
714 #ifndef CC_NV_Extend
715 #   define CC_NV_Extend NO
716 #endif
717 #if CC_NV_Extend == YES
718 #define  TPM_CC_NV_Extend                     (TPM_CC)(0x00000136)
719 #endif
720 #ifndef CC_NV_Write
721 #   define CC_NV_Write NO
722 #endif
723 #if CC_NV_Write == YES
724 #define  TPM_CC_NV_Write                      (TPM_CC)(0x00000137)
725 #endif
726 #ifndef CC_NV_WriteLock
727 #   define CC_NV_WriteLock NO
728 #endif
729 #if CC_NV_WriteLock == YES
730 #define  TPM_CC_NV_WriteLock                  (TPM_CC)(0x00000138)
731 #endif
732 #ifndef CC_DictionaryAttackLockReset
733 #   define CC_DictionaryAttackLockReset NO
734 #endif
735 #if CC_DictionaryAttackLockReset == YES
736 #define  TPM_CC_DictionaryAttackLockReset     (TPM_CC)(0x00000139)
737 #endif
738 #ifndef CC_DictionaryAttackParameters
739 #   define CC_DictionaryAttackParameters NO
740 #endif
741 #if CC_DictionaryAttackParameters == YES
742 #define  TPM_CC_DictionaryAttackParameters    (TPM_CC)(0x0000013a)
743 #endif
744 #ifndef CC_NV_ChangeAuth
745 #   define CC_NV_ChangeAuth NO
746 #endif
747 #if CC_NV_ChangeAuth == YES
748 #define  TPM_CC_NV_ChangeAuth                 (TPM_CC)(0x0000013b)
749 #endif
750 #ifndef CC_PCR_Event
751 #   define CC_PCR_Event NO
752 #endif
753 #if CC_PCR_Event == YES
754 #define  TPM_CC_PCR_Event                     (TPM_CC)(0x0000013c)
755 #endif
756 #ifndef CC_PCR_Reset
757 #   define CC_PCR_Reset NO
758 #endif
759 #if CC_PCR_Reset == YES
760 #define  TPM_CC_PCR_Reset                     (TPM_CC)(0x0000013d)
761 #endif
762 #ifndef CC_SequenceComplete
763 #   define CC_SequenceComplete NO
764 #endif
765 #if CC_SequenceComplete == YES
766 #define  TPM_CC_SequenceComplete              (TPM_CC)(0x0000013e)
767 #endif
768 #ifndef CC_SetAlgorithmSet
769 #   define CC_SetAlgorithmSet NO
770 #endif
771 #if CC_SetAlgorithmSet == YES
772 #define  TPM_CC_SetAlgorithmSet               (TPM_CC)(0x0000013f)
773 #endif
774 #ifndef CC_SetCommandCodeAuditStatus
775 #   define CC_SetCommandCodeAuditStatus NO
776 #endif
777 #if CC_SetCommandCodeAuditStatus == YES
778 #define  TPM_CC_SetCommandCodeAuditStatus     (TPM_CC)(0x00000140)
779 #endif
780 #ifndef CC_FieldUpgradeData
781 #   define CC_FieldUpgradeData NO
782 #endif
783 #if CC_FieldUpgradeData == YES
784 #define  TPM_CC_FieldUpgradeData              (TPM_CC)(0x00000141)
785 #endif
786 #ifndef CC_IncrementalSelfTest
787 #   define CC_IncrementalSelfTest NO
788 #endif
789 #if CC_IncrementalSelfTest == YES
790 #define  TPM_CC_IncrementalSelfTest           (TPM_CC)(0x00000142)
791 #endif
792 #ifndef CC_SelfTest
793 #   define CC_SelfTest NO
794 #endif
795 #if CC_SelfTest == YES
796 #define  TPM_CC_SelfTest                      (TPM_CC)(0x00000143)
797 #endif
798 #ifndef CC_Startup
799 #   define CC_Startup NO
800 #endif
801 #if CC_Startup == YES
802 #define  TPM_CC_Startup                       (TPM_CC)(0x00000144)
803 #endif
804 #ifndef CC_Shutdown
805 #   define CC_Shutdown NO
806 #endif
807 #if CC_Shutdown == YES
808 #define  TPM_CC_Shutdown                      (TPM_CC)(0x00000145)
809 #endif
810 #ifndef CC_StirRandom
811 #   define CC_StirRandom NO
812 #endif
813 #if CC_StirRandom == YES
814 #define  TPM_CC_StirRandom                    (TPM_CC)(0x00000146)
815 #endif
816 #ifndef CC_ActivateCredential
817 #   define CC_ActivateCredential NO
818 #endif
819 #if CC_ActivateCredential == YES
820 #define  TPM_CC_ActivateCredential            (TPM_CC)(0x00000147)
821 #endif
822 #ifndef CC_Certify
823 #   define CC_Certify NO
824 #endif
825 #if CC_Certify == YES
826 #define  TPM_CC_Certify                       (TPM_CC)(0x00000148)
827 #endif
828 #ifndef CC_PolicyNV
829 #   define CC_PolicyNV NO
830 #endif
831 #if CC_PolicyNV == YES
832 #define  TPM_CC_PolicyNV                      (TPM_CC)(0x00000149)
833 #endif
834 #ifndef CC_CertifyCreation
835 #   define CC_CertifyCreation NO
836 #endif
837 #if CC_CertifyCreation == YES
838 #define  TPM_CC_CertifyCreation               (TPM_CC)(0x0000014a)
839 #endif
840 #ifndef CC_Duplicate
841 #   define CC_Duplicate NO
842 #endif
843 #if CC_Duplicate == YES
844 #define  TPM_CC_Duplicate                     (TPM_CC)(0x0000014b)
845 #endif
846 #ifndef CC_GetTime
847 #   define CC_GetTime NO
848 #endif
849 #if CC_GetTime == YES
850 #define  TPM_CC_GetTime                       (TPM_CC)(0x0000014c)
851 #endif
852 #ifndef CC_GetSessionAuditDigest
853 #   define CC_GetSessionAuditDigest NO
854 #endif
855 #if CC_GetSessionAuditDigest == YES
856 #define  TPM_CC_GetSessionAuditDigest         (TPM_CC)(0x0000014d)
857 #endif
858 #ifndef CC_NV_Read
859 #   define CC_NV_Read NO
860 #endif
861 #if CC_NV_Read == YES
862 #define  TPM_CC_NV_Read                       (TPM_CC)(0x0000014e)
863 #endif
864 #ifndef CC_NV_ReadLock
865 #   define CC_NV_ReadLock NO
866 #endif
867 #if CC_NV_ReadLock == YES
868 #define  TPM_CC_NV_ReadLock                   (TPM_CC)(0x0000014f)
869 #endif
870 #ifndef CC_ObjectChangeAuth
871 #   define CC_ObjectChangeAuth NO
872 #endif
873 #if CC_ObjectChangeAuth == YES
874 #define  TPM_CC_ObjectChangeAuth              (TPM_CC)(0x00000150)
875 #endif
876 #ifndef CC_PolicySecret
877 #   define CC_PolicySecret NO
878 #endif
879 #if CC_PolicySecret == YES
880 #define  TPM_CC_PolicySecret                  (TPM_CC)(0x00000151)
881 #endif
882 #ifndef CC_Rewrap
883 #   define CC_Rewrap NO
884 #endif
885 #if CC_Rewrap == YES
886 #define  TPM_CC_Rewrap                        (TPM_CC)(0x00000152)
887 #endif
888 #ifndef CC_Create
889 #   define CC_Create NO
890 #endif
891 #if CC_Create == YES
892 #define  TPM_CC_Create                        (TPM_CC)(0x00000153)
893 #endif
894 #ifndef CC_ECDH_ZGen
895 #   define CC_ECDH_ZGen NO
896 #endif
897 #if CC_ECDH_ZGen == YES
898 #define  TPM_CC_ECDH_ZGen                     (TPM_CC)(0x00000154)
899 #endif
900 #ifndef CC_HMAC
901 #   define CC_HMAC NO
902 #endif
903 #if CC_HMAC == YES
904 #define  TPM_CC_HMAC                          (TPM_CC)(0x00000155)
905 #endif
906 #ifndef CC_Import
907 #   define CC_Import NO
908 #endif
909 #if CC_Import == YES
910 #define  TPM_CC_Import                        (TPM_CC)(0x00000156)
911 #endif
912 #ifndef CC_Load
913 #   define CC_Load NO
914 #endif
915 #if CC_Load == YES
916 #define  TPM_CC_Load                          (TPM_CC)(0x00000157)
917 #endif
918 #ifndef CC_Quote
919 #   define CC_Quote NO
920 #endif
921 #if CC_Quote == YES
922 #define  TPM_CC_Quote                         (TPM_CC)(0x00000158)
923 #endif
924 #ifndef CC_RSA_Decrypt
925 #   define CC_RSA_Decrypt NO
926 #endif
927 #if CC_RSA_Decrypt == YES
928 #define  TPM_CC_RSA_Decrypt                   (TPM_CC)(0x00000159)
929 #endif
930 #ifndef CC_HMAC_Start
931 #   define CC_HMAC_Start NO
932 #endif
933 #if CC_HMAC_Start == YES
934 #define  TPM_CC_HMAC_Start                    (TPM_CC)(0x0000015b)
935 #endif
936 #ifndef CC_SequenceUpdate
937 #   define CC_SequenceUpdate NO
938 #endif
939 #if CC_SequenceUpdate == YES
940 #define  TPM_CC_SequenceUpdate                (TPM_CC)(0x0000015c)
941 #endif
942 #ifndef CC_Sign
943 #   define CC_Sign NO
944 #endif
945 #if CC_Sign == YES
946 #define  TPM_CC_Sign                          (TPM_CC)(0x0000015d)
947 #endif
948 #ifndef CC_Unseal
949 #   define CC_Unseal NO
950 #endif
951 #if CC_Unseal == YES
952 #define  TPM_CC_Unseal                        (TPM_CC)(0x0000015e)
953 #endif
954 #ifndef CC_PolicySigned
955 #   define CC_PolicySigned NO
956 #endif
957 #if CC_PolicySigned == YES
958 #define  TPM_CC_PolicySigned                  (TPM_CC)(0x00000160)
959 #endif
960 #ifndef CC_ContextLoad
961 #   define CC_ContextLoad NO
962 #endif
963 #if CC_ContextLoad == YES
964 #define  TPM_CC_ContextLoad                   (TPM_CC)(0x00000161)
965 #endif
966 #ifndef CC_ContextSave
967 #   define CC_ContextSave NO
968 #endif
969 #if CC_ContextSave == YES
970 #define  TPM_CC_ContextSave                   (TPM_CC)(0x00000162)
971 #endif
972 #ifndef CC_ECDH_KeyGen
973 #   define CC_ECDH_KeyGen NO
974 #endif
975 #if CC_ECDH_KeyGen == YES
976 #define  TPM_CC_ECDH_KeyGen                   (TPM_CC)(0x00000163)
977 #endif
978 #ifndef CC_EncryptDecrypt
979 #   define CC_EncryptDecrypt NO
980 #endif
981 #if CC_EncryptDecrypt == YES
982 #define  TPM_CC_EncryptDecrypt                (TPM_CC)(0x00000164)
983 #endif
984 #ifndef CC_FlushContext
985 #   define CC_FlushContext NO
986 #endif
987 #if CC_FlushContext == YES
988 #define  TPM_CC_FlushContext                  (TPM_CC)(0x00000165)
989 #endif
990 #ifndef CC_LoadExternal
991 #   define CC_LoadExternal NO
992 #endif
993 #if CC_LoadExternal == YES
994 #define  TPM_CC_LoadExternal                  (TPM_CC)(0x00000167)
995 #endif
996 #ifndef CC_MakeCredential
997 #   define CC_MakeCredential NO
998 #endif
999 #if CC_MakeCredential == YES
1000 #define  TPM_CC_MakeCredential                (TPM_CC)(0x00000168)
1001 #endif
1002 #ifndef CC_NV_ReadPublic
1003 #   define CC_NV_ReadPublic NO
1004 #endif
1005 #if CC_NV_ReadPublic == YES
1006 #define  TPM_CC_NV_ReadPublic                 (TPM_CC)(0x00000169)
1007 #endif
1008 #ifndef CC_PolicyAuthorize
1009 #   define CC_PolicyAuthorize NO
1010 #endif
1011 #if CC_PolicyAuthorize == YES
1012 #define  TPM_CC_PolicyAuthorize               (TPM_CC)(0x0000016a)
1013 #endif
1014 #ifndef CC_PolicyAuthValue
1015 #   define CC_PolicyAuthValue NO
1016 #endif
1017 #if CC_PolicyAuthValue == YES
1018 #define  TPM_CC_PolicyAuthValue               (TPM_CC)(0x0000016b)
1019 #endif
1020 #ifndef CC_PolicyCommandCode
1021 #   define CC_PolicyCommandCode NO
1022 #endif
1023 #if CC_PolicyCommandCode == YES
1024 #define  TPM_CC_PolicyCommandCode             (TPM_CC)(0x0000016c)
1025 #endif
1026 #ifndef CC_PolicyCounterTimer
1027 #   define CC_PolicyCounterTimer NO
1028 #endif
1029 #if CC_PolicyCounterTimer == YES
1030 #define  TPM_CC_PolicyCounterTimer            (TPM_CC)(0x0000016d)
1031 #endif
1032 #ifndef CC_PolicyCpHash
1033 #   define CC_PolicyCpHash NO
1034 #endif
1035 #if CC_PolicyCpHash == YES
1036 #define  TPM_CC_PolicyCpHash                  (TPM_CC)(0x0000016e)
1037 #endif
1038 #ifndef CC_PolicyLocality
1039 #   define CC_PolicyLocality NO
1040 #endif
1041 #if CC_PolicyLocality == YES
1042 #define  TPM_CC_PolicyLocality                (TPM_CC)(0x0000016f)
1043 #endif
1044 #ifndef CC_PolicyNameHash
1045 #   define CC_PolicyNameHash NO
1046 #endif
1047 #if CC_PolicyNameHash == YES
1048 #define  TPM_CC_PolicyNameHash                (TPM_CC)(0x00000170)
1049 #endif
1050 #ifndef CC_PolicyOR
1051 #   define CC_PolicyOR NO
1052 #endif
1053 #if CC_PolicyOR == YES
1054 #define  TPM_CC_PolicyOR                      (TPM_CC)(0x00000171)
1055 #endif
1056 #ifndef CC_PolicyTicket
1057 #   define CC_PolicyTicket NO
1058 #endif
1059 #if CC_PolicyTicket == YES
1060 #define  TPM_CC_PolicyTicket                  (TPM_CC)(0x00000172)
1061 #endif
1062 #ifndef CC_ReadPublic
1063 #   define CC_ReadPublic NO
1064 #endif
1065 #if CC_ReadPublic == YES
1066 #define  TPM_CC_ReadPublic                    (TPM_CC)(0x00000173)
1067 #endif
1068 #ifndef CC_RSA_Encrypt
1069 #   define CC_RSA_Encrypt NO
1070 #endif
1071 #if CC_RSA_Encrypt == YES
1072 #define  TPM_CC_RSA_Encrypt                   (TPM_CC)(0x00000174)
1073 #endif
1074 #ifndef CC_StartAuthSession
1075 #   define CC_StartAuthSession NO
1076 #endif
1077 #if CC_StartAuthSession == YES
1078 #define  TPM_CC_StartAuthSession              (TPM_CC)(0x00000176)
1079 #endif
1080 #ifndef CC_VerifySignature
1081 #   define CC_VerifySignature NO
1082 #endif
1083 #if CC_VerifySignature == YES
1084 #define  TPM_CC_VerifySignature               (TPM_CC)(0x00000177)
1085 #endif
1086 #ifndef CC_ECC_Parameters
1087 #   define CC_ECC_Parameters NO
1088 #endif
1089 #if CC_ECC_Parameters == YES
1090 #define  TPM_CC_ECC_Parameters                (TPM_CC)(0x00000178)
1091 #endif
1092 #ifndef CC_FirmwareRead
1093 #   define CC_FirmwareRead NO
1094 #endif
1095 #if CC_FirmwareRead == YES
1096 #define  TPM_CC_FirmwareRead                  (TPM_CC)(0x00000179)
1097 #endif
1098 #ifndef CC_GetCapability
1099 #   define CC_GetCapability NO
1100 #endif
1101 #if CC_GetCapability == YES
1102 #define  TPM_CC_GetCapability                 (TPM_CC)(0x0000017a)
1103 #endif
1104 #ifndef CC_GetRandom
1105 #   define CC_GetRandom NO
1106 #endif
1107 #if CC_GetRandom == YES
1108 #define  TPM_CC_GetRandom                     (TPM_CC)(0x0000017b)
1109 #endif
1110 #ifndef CC_GetTestResult
1111 #   define CC_GetTestResult NO
1112 #endif
1113 #if CC_GetTestResult == YES
1114 #define  TPM_CC_GetTestResult                 (TPM_CC)(0x0000017c)
1115 #endif
1116 #ifndef CC_Hash
1117 #   define CC_Hash NO
1118 #endif
1119 #if CC_Hash == YES
1120 #define  TPM_CC_Hash                          (TPM_CC)(0x0000017d)
1121 #endif
1122 #ifndef CC_PCR_Read
1123 #   define CC_PCR_Read NO
1124 #endif
1125 #if CC_PCR_Read == YES
1126 #define  TPM_CC_PCR_Read                      (TPM_CC)(0x0000017e)
1127 #endif
1128 #ifndef CC_PolicyPCR
1129 #   define CC_PolicyPCR NO
1130 #endif
1131 #if CC_PolicyPCR == YES
1132 #define  TPM_CC_PolicyPCR                     (TPM_CC)(0x0000017f)
1133 #endif
1134 #ifndef CC_PolicyRestart
1135 #   define CC_PolicyRestart NO
1136 #endif
1137 #if CC_PolicyRestart == YES
1138 #define  TPM_CC_PolicyRestart                 (TPM_CC)(0x00000180)
1139 #endif
1140 #ifndef CC_ReadClock
1141 #   define CC_ReadClock NO
1142 #endif
1143 #if CC_ReadClock == YES
1144 #define  TPM_CC_ReadClock                     (TPM_CC)(0x00000181)
1145 #endif
1146 #ifndef CC_PCR_Extend
1147 #   define CC_PCR_Extend NO
1148 #endif
1149 #if CC_PCR_Extend == YES
1150 #define  TPM_CC_PCR_Extend                    (TPM_CC)(0x00000182)
1151 #endif
1152 #ifndef CC_PCR_SetAuthValue
1153 #   define CC_PCR_SetAuthValue NO
1154 #endif
1155 #if CC_PCR_SetAuthValue == YES
1156 #define  TPM_CC_PCR_SetAuthValue              (TPM_CC)(0x00000183)
1157 #endif
1158 #ifndef CC_NV_Certify
1159 #   define CC_NV_Certify NO
1160 #endif
1161 #if CC_NV_Certify == YES
1162 #define  TPM_CC_NV_Certify                    (TPM_CC)(0x00000184)
1163 #endif
1164 #ifndef CC_EventSequenceComplete
1165 #   define CC_EventSequenceComplete NO
1166 #endif
1167 #if CC_EventSequenceComplete == YES
1168 #define  TPM_CC_EventSequenceComplete         (TPM_CC)(0x00000185)
1169 #endif
1170 #ifndef CC_HashSequenceStart
1171 #   define CC_HashSequenceStart NO
1172 #endif
1173 #if CC_HashSequenceStart == YES
1174 #define  TPM_CC_HashSequenceStart             (TPM_CC)(0x00000186)
1175 #endif
1176 #ifndef CC_PolicyPhysicalPresence
1177 #   define CC_PolicyPhysicalPresence NO
1178 #endif
1179 #if CC_PolicyPhysicalPresence == YES
1180 #define  TPM_CC_PolicyPhysicalPresence        (TPM_CC)(0x00000187)
1181 #endif
1182 #ifndef CC_PolicyDuplicationSelect
1183 #   define CC_PolicyDuplicationSelect NO
1184 #endif
1185 #if CC_PolicyDuplicationSelect == YES
1186 #define  TPM_CC_PolicyDuplicationSelect       (TPM_CC)(0x00000188)
1187 #endif
1188 #ifndef CC_PolicyGetDigest
1189 #   define CC_PolicyGetDigest NO
1190 #endif
1191 #if CC_PolicyGetDigest == YES
1192 #define  TPM_CC_PolicyGetDigest               (TPM_CC)(0x00000189)
1193 #endif
1194 #ifndef CC_TestParms
1195 #   define CC_TestParms NO
1196 #endif
1197 #if CC_TestParms == YES
1198 #define  TPM_CC_TestParms                     (TPM_CC)(0x0000018a)
1199 #endif
1200 #ifndef CC_Commit
1201 #   define CC_Commit NO
1202 #endif
1203 #if CC_Commit == YES
1204 #define  TPM_CC_Commit                        (TPM_CC)(0x0000018b)
1205 #endif
1206 #ifndef CC_PolicyPassword
1207 #   define CC_PolicyPassword NO
1208 #endif
1209 #if CC_PolicyPassword == YES
1210 #define  TPM_CC_PolicyPassword                (TPM_CC)(0x0000018c)
1211 #endif
1212 #ifndef CC_ZGen_2Phase
1213 #   define CC_ZGen_2Phase NO
1214 #endif
1215 #if CC_ZGen_2Phase == YES
1216 #define  TPM_CC_ZGen_2Phase                   (TPM_CC)(0x0000018d)
1217 #endif
1218 #ifndef CC_EC_Ephemeral
1219 #   define CC_EC_Ephemeral NO
1220 #endif
1221 #if CC_EC_Ephemeral == YES
1222 #define  TPM_CC_EC_Ephemeral                  (TPM_CC)(0x0000018e)
1223 #endif
1224 #ifndef CC_PolicyNvWritten
1225 #   define CC_PolicyNvWritten NO
1226 #endif
1227 #if CC_PolicyNvWritten == YES
1228 #define  TPM_CC_PolicyNvWritten               (TPM_CC)(0x0000018f)
1229 #endif
1230 #ifndef CC_PolicyTemplate
1231 #   define CC_PolicyTemplate NO
1232 #endif
1233 #if CC_PolicyTemplate == YES
1234 #define  TPM_CC_PolicyTemplate                (TPM_CC)(0x00000190)
1235 #endif
1236 #ifndef CC_CreateLoaded
1237 #   define CC_CreateLoaded NO
1238 #endif
1239 #if CC_CreateLoaded == YES
1240 #define  TPM_CC_CreateLoaded                  (TPM_CC)(0x00000191)
1241 #endif
1242 #ifndef CC_PolicyAuthorizeNV
1243 #   define CC_PolicyAuthorizeNV NO
1244 #endif
1245 #if CC_PolicyAuthorizeNV == YES
1246 #define  TPM_CC_PolicyAuthorizeNV             (TPM_CC)(0x00000192)
1247 #endif
1248 #ifndef CC_EncryptDecrypt2
1249 #   define CC_EncryptDecrypt2 NO
1250 #endif
1251 #if CC_EncryptDecrypt2 == YES
1252 #define  TPM_CC_EncryptDecrypt2               (TPM_CC)(0x00000193)
1253 #endif
1254 #define  TPM_CC_AC_GetCapability	      (TPM_CC)(0x00000194)
1255 #define  TPM_CC_AC_Send			      (TPM_CC)(0x00000195)
1256 #define  TPM_CC_Policy_AC_SendSelect	      (TPM_CC)(0x00000196)
1257 #ifndef CC_CertifyX509
1258 #   define CC_CertifyX509 NO
1259 #endif
1260 #if CC_CertifyX509 == YES
1261 #define  TPM_CC_CertifyX509 		      (TPM_CC)(0x00000197)
1262 #endif
1263 
1264 /* Compile variable. May increase based on implementation. */
1265 #define  TPM_CC_LAST			      (TPM_CC)(0x00000197)
1266 
1267 #ifndef CC_Vendor_TCG_Test
1268 #   define CC_Vendor_TCG_Test NO
1269 #endif
1270 #if CC_Vendor_TCG_Test == YES
1271 #define  TPM_CC_Vendor_TCG_Test               (TPM_CC)(0x20000000)
1272 #endif
1273 
1274 #ifndef CC_NTC2_PreConfig
1275 #   define CC_NTC2_PreConfig NO
1276 #endif
1277 #if CC_NTC2_PreConfig == YES
1278 #define NTC2_CC_PreConfig		      (TPM_CC)(0x20000211)
1279 #endif
1280 #ifndef CC_NTC2_LockPreConfig
1281 #   define CC_NTC2_LockPreConfig NO
1282 #endif
1283 #if CC_NTC2_LockPreConfig == YES
1284 #define  NTC2_CC_LockPreConfig                (TPM_CC)(0x20000212)
1285 #endif
1286 #ifndef CC_NTC2_GetConfig
1287 #   define CC_NTC2_GetConfig NO
1288 #endif
1289 #if CC_NTC2_GetConfig == YES
1290 #define  NTC2_CC_GetConfig                    (TPM_CC)(0x20000213)
1291 #endif
1292 
1293 #ifndef  COMPRESSED_LISTS
1294 #define ADD_FILL    1
1295 #else
1296 #define ADD_FILL   0
1297 #endif
1298 
1299 // Size the array of library commands based on whether or not the array is packed (only defined
1300 // commands) or dense (having entries for unimplemented commands)
1301 
1302 #define LIBRARY_COMMAND_ARRAY_SIZE       (0				\
1303 					  + (ADD_FILL || CC_NV_UndefineSpaceSpecial)    /* 0x0000011f */ \
1304 					  + (ADD_FILL || CC_EvictControl)               /* 0x00000120 */ \
1305 					  + (ADD_FILL || CC_HierarchyControl)           /* 0x00000121 */ \
1306 					  + (ADD_FILL || CC_NV_UndefineSpace)           /* 0x00000122 */ \
1307 					  + ADD_FILL                                    /* 0x00000123 */ \
1308 					  + (ADD_FILL || CC_ChangeEPS)                  /* 0x00000124 */ \
1309 					  + (ADD_FILL || CC_ChangePPS)                  /* 0x00000125 */ \
1310 					  + (ADD_FILL || CC_Clear)                      /* 0x00000126 */ \
1311 					  + (ADD_FILL || CC_ClearControl)               /* 0x00000127 */ \
1312 					  + (ADD_FILL || CC_ClockSet)                   /* 0x00000128 */ \
1313 					  + (ADD_FILL || CC_HierarchyChangeAuth)        /* 0x00000129 */ \
1314 					  + (ADD_FILL || CC_NV_DefineSpace)             /* 0x0000012a */ \
1315 					  + (ADD_FILL || CC_PCR_Allocate)               /* 0x0000012b */ \
1316 					  + (ADD_FILL || CC_PCR_SetAuthPolicy)          /* 0x0000012c */ \
1317 					  + (ADD_FILL || CC_PP_Commands)                /* 0x0000012d */ \
1318 					  + (ADD_FILL || CC_SetPrimaryPolicy)           /* 0x0000012e */ \
1319 					  + (ADD_FILL || CC_FieldUpgradeStart)          /* 0x0000012f */ \
1320 					  + (ADD_FILL || CC_ClockRateAdjust)            /* 0x00000130 */ \
1321 					  + (ADD_FILL || CC_CreatePrimary)              /* 0x00000131 */ \
1322 					  + (ADD_FILL || CC_NV_GlobalWriteLock)         /* 0x00000132 */ \
1323 					  + (ADD_FILL || CC_GetCommandAuditDigest)      /* 0x00000133 */ \
1324 					  + (ADD_FILL || CC_NV_Increment)               /* 0x00000134 */ \
1325 					  + (ADD_FILL || CC_NV_SetBits)                 /* 0x00000135 */ \
1326 					  + (ADD_FILL || CC_NV_Extend)                  /* 0x00000136 */ \
1327 					  + (ADD_FILL || CC_NV_Write)                   /* 0x00000137 */ \
1328 					  + (ADD_FILL || CC_NV_WriteLock)               /* 0x00000138 */ \
1329 					  + (ADD_FILL || CC_DictionaryAttackLockReset)  /* 0x00000139 */ \
1330 					  + (ADD_FILL || CC_DictionaryAttackParameters) /* 0x0000013a */ \
1331 					  + (ADD_FILL || CC_NV_ChangeAuth)              /* 0x0000013b */ \
1332 					  + (ADD_FILL || CC_PCR_Event)                  /* 0x0000013c */ \
1333 					  + (ADD_FILL || CC_PCR_Reset)                  /* 0x0000013d */ \
1334 					  + (ADD_FILL || CC_SequenceComplete)           /* 0x0000013e */ \
1335 					  + (ADD_FILL || CC_SetAlgorithmSet)            /* 0x0000013f */ \
1336 					  + (ADD_FILL || CC_SetCommandCodeAuditStatus)  /* 0x00000140 */ \
1337 					  + (ADD_FILL || CC_FieldUpgradeData)           /* 0x00000141 */ \
1338 					  + (ADD_FILL || CC_IncrementalSelfTest)        /* 0x00000142 */ \
1339 					  + (ADD_FILL || CC_SelfTest)                   /* 0x00000143 */ \
1340 					  + (ADD_FILL || CC_Startup)                    /* 0x00000144 */ \
1341 					  + (ADD_FILL || CC_Shutdown)                   /* 0x00000145 */ \
1342 					  + (ADD_FILL || CC_StirRandom)                 /* 0x00000146 */ \
1343 					  + (ADD_FILL || CC_ActivateCredential)         /* 0x00000147 */ \
1344 					  + (ADD_FILL || CC_Certify)                    /* 0x00000148 */ \
1345 					  + (ADD_FILL || CC_PolicyNV)                   /* 0x00000149 */ \
1346 					  + (ADD_FILL || CC_CertifyCreation)            /* 0x0000014a */ \
1347 					  + (ADD_FILL || CC_Duplicate)                  /* 0x0000014b */ \
1348 					  + (ADD_FILL || CC_GetTime)                    /* 0x0000014c */ \
1349 					  + (ADD_FILL || CC_GetSessionAuditDigest)      /* 0x0000014d */ \
1350 					  + (ADD_FILL || CC_NV_Read)                    /* 0x0000014e */ \
1351 					  + (ADD_FILL || CC_NV_ReadLock)                /* 0x0000014f */ \
1352 					  + (ADD_FILL || CC_ObjectChangeAuth)           /* 0x00000150 */ \
1353 					  + (ADD_FILL || CC_PolicySecret)               /* 0x00000151 */ \
1354 					  + (ADD_FILL || CC_Rewrap)                     /* 0x00000152 */ \
1355 					  + (ADD_FILL || CC_Create)                     /* 0x00000153 */ \
1356 					  + (ADD_FILL || CC_ECDH_ZGen)                  /* 0x00000154 */ \
1357 					  + (ADD_FILL || CC_HMAC)                       /* 0x00000155 */ \
1358 					  + (ADD_FILL || CC_Import)                     /* 0x00000156 */ \
1359 					  + (ADD_FILL || CC_Load)                       /* 0x00000157 */ \
1360 					  + (ADD_FILL || CC_Quote)                      /* 0x00000158 */ \
1361 					  + (ADD_FILL || CC_RSA_Decrypt)                /* 0x00000159 */ \
1362 					  + ADD_FILL                                    /* 0x0000015a */ \
1363 					  + (ADD_FILL || CC_HMAC_Start)                 /* 0x0000015b */ \
1364 					  + (ADD_FILL || CC_SequenceUpdate)             /* 0x0000015c */ \
1365 					  + (ADD_FILL || CC_Sign)                       /* 0x0000015d */ \
1366 					  + (ADD_FILL || CC_Unseal)                     /* 0x0000015e */ \
1367 					  + ADD_FILL                                    /* 0x0000015f */ \
1368 					  + (ADD_FILL || CC_PolicySigned)               /* 0x00000160 */ \
1369 					  + (ADD_FILL || CC_ContextLoad)                /* 0x00000161 */ \
1370 					  + (ADD_FILL || CC_ContextSave)                /* 0x00000162 */ \
1371 					  + (ADD_FILL || CC_ECDH_KeyGen)                /* 0x00000163 */ \
1372 					  + (ADD_FILL || CC_EncryptDecrypt)             /* 0x00000164 */ \
1373 					  + (ADD_FILL || CC_FlushContext)               /* 0x00000165 */ \
1374 					  + ADD_FILL                                    /* 0x00000166 */ \
1375 					  + (ADD_FILL || CC_LoadExternal)               /* 0x00000167 */ \
1376 					  + (ADD_FILL || CC_MakeCredential)             /* 0x00000168 */ \
1377 					  + (ADD_FILL || CC_NV_ReadPublic)              /* 0x00000169 */ \
1378 					  + (ADD_FILL || CC_PolicyAuthorize)            /* 0x0000016a */ \
1379 					  + (ADD_FILL || CC_PolicyAuthValue)            /* 0x0000016b */ \
1380 					  + (ADD_FILL || CC_PolicyCommandCode)          /* 0x0000016c */ \
1381 					  + (ADD_FILL || CC_PolicyCounterTimer)         /* 0x0000016d */ \
1382 					  + (ADD_FILL || CC_PolicyCpHash)               /* 0x0000016e */ \
1383 					  + (ADD_FILL || CC_PolicyLocality)             /* 0x0000016f */ \
1384 					  + (ADD_FILL || CC_PolicyNameHash)             /* 0x00000170 */ \
1385 					  + (ADD_FILL || CC_PolicyOR)                   /* 0x00000171 */ \
1386 					  + (ADD_FILL || CC_PolicyTicket)               /* 0x00000172 */ \
1387 					  + (ADD_FILL || CC_ReadPublic)                 /* 0x00000173 */ \
1388 					  + (ADD_FILL || CC_RSA_Encrypt)                /* 0x00000174 */ \
1389 					  + ADD_FILL                                    /* 0x00000175 */ \
1390 					  + (ADD_FILL || CC_StartAuthSession)           /* 0x00000176 */ \
1391 					  + (ADD_FILL || CC_VerifySignature)            /* 0x00000177 */ \
1392 					  + (ADD_FILL || CC_ECC_Parameters)             /* 0x00000178 */ \
1393 					  + (ADD_FILL || CC_FirmwareRead)               /* 0x00000179 */ \
1394 					  + (ADD_FILL || CC_GetCapability)              /* 0x0000017a */ \
1395 					  + (ADD_FILL || CC_GetRandom)                  /* 0x0000017b */ \
1396 					  + (ADD_FILL || CC_GetTestResult)              /* 0x0000017c */ \
1397 					  + (ADD_FILL || CC_Hash)                       /* 0x0000017d */ \
1398 					  + (ADD_FILL || CC_PCR_Read)                   /* 0x0000017e */ \
1399 					  + (ADD_FILL || CC_PolicyPCR)                  /* 0x0000017f */ \
1400 					  + (ADD_FILL || CC_PolicyRestart)              /* 0x00000180 */ \
1401 					  + (ADD_FILL || CC_ReadClock)                  /* 0x00000181 */ \
1402 					  + (ADD_FILL || CC_PCR_Extend)                 /* 0x00000182 */ \
1403 					  + (ADD_FILL || CC_PCR_SetAuthValue)           /* 0x00000183 */ \
1404 					  + (ADD_FILL || CC_NV_Certify)                 /* 0x00000184 */ \
1405 					  + (ADD_FILL || CC_EventSequenceComplete)      /* 0x00000185 */ \
1406 					  + (ADD_FILL || CC_HashSequenceStart)          /* 0x00000186 */ \
1407 					  + (ADD_FILL || CC_PolicyPhysicalPresence)     /* 0x00000187 */ \
1408 					  + (ADD_FILL || CC_PolicyDuplicationSelect)    /* 0x00000188 */ \
1409 					  + (ADD_FILL || CC_PolicyGetDigest)            /* 0x00000189 */ \
1410 					  + (ADD_FILL || CC_TestParms)                  /* 0x0000018a */ \
1411 					  + (ADD_FILL || CC_Commit)                     /* 0x0000018b */ \
1412 					  + (ADD_FILL || CC_PolicyPassword)             /* 0x0000018c */ \
1413 					  + (ADD_FILL || CC_ZGen_2Phase)                /* 0x0000018d */ \
1414 					  + (ADD_FILL || CC_EC_Ephemeral)               /* 0x0000018e */ \
1415 					  + (ADD_FILL || CC_PolicyTemplate)             /* 0x00000190 */ \
1416 					  + (ADD_FILL || CC_CreateLoaded)               /* 0x00000191 */ \
1417 					  + (ADD_FILL || CC_PolicyAuthorizeNV)          /* 0x00000192 */ \
1418 					  + (ADD_FILL || CC_EncryptDecrypt2)            /* 0x00000193 */ \
1419 					  + (ADD_FILL || CC_PolicyNvWritten)            /* 0x0000018f */ \
1420 					  + (ADD_FILL || CC_CertifyX509)                /* 0x00000197 */ \
1421 					  )
1422 #define VENDOR_COMMAND_ARRAY_SIZE   ( 0				\
1423 				      + CC_Vendor_TCG_Test	\
1424 				      + CC_NTC2_PreConfig	\
1425 				      + CC_NTC2_LockPreConfig	\
1426 				      + CC_NTC2_GetConfig	\
1427 				      )
1428 
1429 #define COMMAND_COUNT							\
1430     (LIBRARY_COMMAND_ARRAY_SIZE + VENDOR_COMMAND_ARRAY_SIZE)
1431 
1432 // Following typedef is for some old code
1433 
1434 #ifndef ALG_CAMELLIA
1435 #   define ALG_CAMELLIA         NO
1436 #endif
1437 
1438 #ifndef ALG_SM4
1439 #   define ALG_SM4         NO
1440 #endif
1441 
1442 #ifndef ALG_AES
1443 #   define ALG_AES         NO
1444 #endif
1445 
1446 #endif  // _IMPLEMENTATION_H_
1447