tpm2_protocol/message/
mod.rs

1// SPDX-License-Identifier: MIT OR Apache-2.0
2// Copyright (c) 2025 Opinsys Oy
3// Copyright (c) 2024-2025 Jarkko Sakkinen
4
5use crate::{
6    data::{
7        Tpm2b, Tpm2bAttest, Tpm2bAuth, Tpm2bCreationData, Tpm2bData, Tpm2bDigest,
8        Tpm2bEncryptedSecret, Tpm2bMaxBuffer, Tpm2bName, Tpm2bPrivate, Tpm2bPublic,
9        Tpm2bSensitiveCreate, Tpm2bSensitiveData, TpmAlgId, TpmCap, TpmCc, TpmRc, TpmRh, TpmSe,
10        TpmiYesNo, TpmlAlg, TpmlPcrSelection, TpmsAuthCommand, TpmsAuthResponse,
11        TpmsCapabilityData, TpmsContext, TpmtSignature, TpmtSymDef, TpmtSymDefObject,
12        TpmtTkCreation, TpmtTkHashcheck, TpmtTkVerified,
13    },
14    tpm_dispatch, tpm_response, tpm_struct, TpmBuild, TpmList, TpmParse, TpmPersistent, TpmSession,
15    TpmSized, TpmTransient,
16};
17use core::fmt::Debug;
18
19pub mod asymmetric;
20pub mod attestation;
21pub mod build;
22pub mod enhanced_authorization;
23pub mod integrity;
24pub mod non_volatile;
25pub mod object;
26pub mod parse;
27pub mod sequence;
28pub mod startup;
29
30pub use asymmetric::*;
31pub use attestation::*;
32pub use build::*;
33pub use enhanced_authorization::*;
34pub use integrity::*;
35pub use non_volatile::*;
36pub use object::*;
37pub use parse::*;
38pub use sequence::*;
39pub use startup::*;
40
41/// The maximum number of handles a command can have.
42pub const MAX_HANDLES: usize = 8;
43/// The maximum number of sessions a command can have.
44pub const MAX_SESSIONS: usize = 8;
45
46/// A fixed-capacity list for TPM handles.
47pub type TpmHandles = TpmList<u32, MAX_HANDLES>;
48/// A fixed-capacity list for command authorization sessions.
49pub type TpmAuthCommands = TpmList<TpmsAuthCommand, MAX_SESSIONS>;
50/// A fixed-capacity list for response authorization sessions.
51pub type TpmAuthResponses = TpmList<TpmsAuthResponse, MAX_SESSIONS>;
52
53/// A trait for TPM commands and responses that provides header information.
54pub trait TpmHeader: TpmBuild + TpmParse + Debug {
55    const COMMAND: TpmCc;
56    const NO_SESSIONS: bool;
57    const WITH_SESSIONS: bool;
58    const HANDLES: usize;
59}
60
61pub const TPM_HEADER_SIZE: usize = 10;
62
63tpm_struct! {
64    #[derive(Debug, PartialEq, Eq, Clone)]
65    TpmContextLoadCommand,
66    TpmCc::ContextLoad,
67    true,
68    false,
69    0,
70    {
71        pub context: TpmsContext,
72    }
73}
74
75tpm_struct! {
76    #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
77    TpmContextSaveCommand,
78    TpmCc::ContextSave,
79    true,
80    false,
81    1,
82    {}
83}
84
85tpm_struct! {
86    #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
87    TpmDictionaryAttackLockResetCommand,
88    TpmCc::DictionaryAttackLockReset,
89    false,
90    true,
91    1,
92    {}
93}
94
95tpm_struct! {
96    #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
97    TpmFlushContextCommand,
98    TpmCc::FlushContext,
99    true,
100    false,
101    0,
102    {
103        pub flush_handle: u32,
104    }
105}
106
107tpm_struct! {
108    #[derive(Debug, Default, PartialEq, Eq, Clone)]
109    TpmCreatePrimaryCommand,
110    TpmCc::CreatePrimary,
111    false,
112    true,
113    1,
114    {
115        pub in_sensitive: Tpm2bSensitiveCreate,
116        pub in_public: Tpm2bPublic,
117        pub outside_info: Tpm2b,
118        pub creation_pcr: TpmlPcrSelection,
119    }
120}
121
122tpm_struct! {
123    #[derive(Debug, PartialEq, Eq, Clone)]
124    TpmEvictControlCommand,
125    TpmCc::EvictControl,
126    false,
127    true,
128    2,
129    {
130        pub persistent_handle: TpmPersistent,
131    }
132}
133
134tpm_struct! {
135    #[derive(Debug, PartialEq, Eq, Clone)]
136    TpmGetCapabilityCommand,
137    TpmCc::GetCapability,
138    true,
139    true,
140    0,
141    {
142        pub cap: TpmCap,
143        pub property: u32,
144        pub property_count: u32,
145    }
146}
147
148tpm_struct! {
149    #[derive(Debug, PartialEq, Eq, Clone)]
150    TpmHashCommand,
151    TpmCc::Hash,
152    true,
153    false,
154    0,
155    {
156        pub data: Tpm2bMaxBuffer,
157        pub hash_alg: TpmAlgId,
158        pub hierarchy: TpmRh,
159    }
160}
161
162tpm_struct! {
163    #[derive(Debug, PartialEq, Eq, Clone)]
164    TpmImportCommand,
165    TpmCc::Import,
166    false,
167    true,
168    1,
169    {
170        pub encryption_key: Tpm2b,
171        pub object_public: Tpm2bPublic,
172        pub duplicate: Tpm2bPrivate,
173        pub in_sym_seed: Tpm2bEncryptedSecret,
174        pub symmetric_alg: TpmtSymDef,
175    }
176}
177
178#[derive(Debug, Default, PartialEq, Eq, Clone)]
179pub struct TpmPolicyGetDigestResponse {
180    pub policy_digest: Tpm2bDigest,
181}
182
183impl TpmHeader for TpmPolicyGetDigestResponse {
184    const COMMAND: TpmCc = TpmCc::PolicyGetDigest;
185    const NO_SESSIONS: bool = false;
186    const WITH_SESSIONS: bool = true;
187    const HANDLES: usize = 0;
188}
189
190impl crate::TpmSized for TpmPolicyGetDigestResponse {
191    const SIZE: usize = <Tpm2bDigest>::SIZE;
192    fn len(&self) -> usize {
193        TpmSized::len(&self.policy_digest)
194    }
195}
196
197impl crate::TpmBuild for TpmPolicyGetDigestResponse {
198    fn build(&self, writer: &mut crate::TpmWriter) -> crate::TpmResult<()> {
199        TpmBuild::build(&self.policy_digest, writer)
200    }
201}
202
203impl crate::TpmParse for TpmPolicyGetDigestResponse {
204    fn parse(buf: &[u8]) -> crate::TpmResult<(Self, &[u8])> {
205        if buf.is_empty() {
206            return Ok((Self::default(), buf));
207        }
208        let (policy_digest, buf) = Tpm2bDigest::parse(buf)?;
209        Ok((Self { policy_digest }, buf))
210    }
211}
212
213tpm_struct! {
214    #[derive(Debug, Default, PartialEq, Eq, Clone)]
215    TpmStartAuthSessionCommand,
216    TpmCc::StartAuthSession,
217    true,
218    true,
219    2,
220    {
221        pub nonce_caller: Tpm2b,
222        pub encrypted_salt: Tpm2b,
223        pub session_type: TpmSe,
224        pub symmetric: TpmtSymDefObject,
225        pub auth_hash: TpmAlgId,
226    }
227}
228
229tpm_struct! {
230    #[derive(Debug, PartialEq, Eq, Clone)]
231    TpmVendorTcgTestCommand,
232    TpmCc::VendorTcgTest,
233    true,
234    false,
235    0,
236    {
237        pub input_data: Tpm2bData,
238    }
239}
240
241tpm_struct! {
242    #[derive(Debug, PartialEq, Eq, Clone)]
243    TpmContextLoadResponse,
244    TpmCc::ContextLoad,
245    true,
246    false,
247    0,
248    {
249        pub loaded_handle: TpmTransient,
250    }
251}
252
253tpm_struct! {
254    #[derive(Debug, PartialEq, Eq, Clone)]
255    TpmContextSaveResponse,
256    TpmCc::ContextSave,
257    true,
258    false,
259    0,
260    {
261        pub context: TpmsContext,
262    }
263}
264
265tpm_struct! {
266    #[derive(Debug, PartialEq, Eq, Clone)]
267    TpmHashResponse,
268    TpmCc::Hash,
269    true,
270    false,
271    0,
272    {
273        pub out_hash: Tpm2bDigest,
274        pub validation: TpmtTkHashcheck,
275    }
276}
277
278tpm_struct! {
279    #[derive(Debug, Default, PartialEq, Eq, Clone)]
280    TpmImportResponse,
281    TpmCc::Import,
282    false,
283    true,
284    0,
285    {
286        pub out_private: Tpm2bPrivate,
287    }
288}
289
290tpm_struct! {
291    #[derive(Debug, Default, PartialEq, Eq, Clone)]
292    TpmStartAuthSessionResponse,
293    TpmCc::StartAuthSession,
294    true,
295    false,
296    0,
297    {
298        pub session_handle: TpmSession,
299        pub nonce_tpm: Tpm2b,
300    }
301}
302
303tpm_struct! {
304    #[derive(Debug, PartialEq, Eq, Clone)]
305    TpmVendorTcgTestResponse,
306    TpmCc::VendorTcgTest,
307    true,
308    false,
309    0,
310    {
311        pub output_data: Tpm2bData,
312    }
313}
314
315tpm_response! {
316    #[derive(Debug, PartialEq, Eq, Clone)]
317    TpmCreatePrimaryResponse,
318    TpmCc::CreatePrimary,
319    false,
320    true,
321    pub object_handle: TpmTransient,
322    {
323        pub out_public: Tpm2bPublic,
324        pub creation_data: Tpm2bCreationData,
325        pub creation_hash: Tpm2bDigest,
326        pub creation_ticket: TpmtTkCreation,
327        pub name: Tpm2bName,
328    }
329}
330
331tpm_struct! {
332    #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
333    TpmDictionaryAttackLockResetResponse,
334    TpmCc::DictionaryAttackLockReset,
335    false,
336    true,
337    0,
338    {}
339}
340
341tpm_struct! {
342    #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
343    TpmEvictControlResponse,
344    TpmCc::EvictControl,
345    false,
346    true,
347    0,
348    {}
349}
350
351tpm_struct! {
352    #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
353    TpmFlushContextResponse,
354    TpmCc::FlushContext,
355    true,
356    false,
357    0,
358    {}
359}
360
361tpm_struct! {
362    #[derive(Debug, PartialEq, Eq, Clone)]
363    TpmGetCapabilityResponse,
364    TpmCc::GetCapability,
365    true,
366    false,
367    0,
368    {
369        pub more_data: TpmiYesNo,
370        pub capability_data: TpmsCapabilityData,
371    }
372}
373
374tpm_struct! {
375    #[derive(Debug, PartialEq, Eq, Clone)]
376    TpmQuoteCommand,
377    TpmCc::Quote,
378    false,
379    true,
380    1,
381    {
382        pub qualifying_data: Tpm2bData,
383        pub in_scheme: TpmtSignature,
384        pub pcr_select: TpmlPcrSelection,
385    }
386}
387
388tpm_response! {
389    #[derive(Debug, PartialEq, Eq, Clone)]
390    TpmQuoteResponse,
391    TpmCc::Quote,
392    false,
393    true,
394    {
395        pub quoted: Tpm2bAttest,
396        pub signature: TpmtSignature,
397    }
398}
399
400tpm_struct! {
401    #[derive(Debug, PartialEq, Eq, Clone)]
402    TpmSignCommand,
403    TpmCc::Sign,
404    false,
405    true,
406    1,
407    {
408        pub digest: Tpm2bDigest,
409        pub in_scheme: TpmtSignature,
410        pub validation: TpmtTkHashcheck,
411    }
412}
413
414tpm_response! {
415    #[derive(Debug, PartialEq, Eq, Clone)]
416    TpmSignResponse,
417    TpmCc::Sign,
418    false,
419    true,
420    {
421        pub signature: TpmtSignature,
422    }
423}
424
425tpm_struct! {
426    #[derive(Debug, PartialEq, Eq, Clone)]
427    TpmVerifySignatureCommand,
428    TpmCc::VerifySignature,
429    true,
430    false,
431    1,
432    {
433        pub digest: Tpm2bDigest,
434        pub signature: TpmtSignature,
435    }
436}
437
438tpm_response! {
439    #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
440    TpmVerifySignatureResponse,
441    TpmCc::VerifySignature,
442    true,
443    false,
444    {
445        pub validation: TpmtTkVerified,
446    }
447}
448
449tpm_struct! {
450    #[derive(Debug, PartialEq, Eq, Clone)]
451    TpmSelfTestCommand,
452    TpmCc::SelfTest,
453    true,
454    true,
455    0,
456    {
457        pub full_test: TpmiYesNo,
458    }
459}
460
461tpm_response! {
462    #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
463    TpmSelfTestResponse,
464    TpmCc::SelfTest,
465    true,
466    true,
467    {}
468}
469
470tpm_struct! {
471    #[derive(Debug, PartialEq, Eq, Clone)]
472    TpmIncrementalSelfTestCommand,
473    TpmCc::IncrementalSelfTest,
474    true,
475    true,
476    0,
477    {
478        pub to_test: TpmlAlg,
479    }
480}
481
482tpm_response! {
483    #[derive(Debug, Default, PartialEq, Eq, Clone)]
484    TpmIncrementalSelfTestResponse,
485    TpmCc::IncrementalSelfTest,
486    true,
487    true,
488    {
489        pub to_do_list: TpmlAlg,
490    }
491}
492
493tpm_struct! {
494    #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
495    TpmGetTestResultCommand,
496    TpmCc::GetTestResult,
497    true,
498    true,
499    0,
500    {}
501}
502
503tpm_response! {
504    #[derive(Debug, PartialEq, Eq, Clone)]
505    TpmGetTestResultResponse,
506    TpmCc::GetTestResult,
507    true,
508    true,
509    {
510        pub out_data: Tpm2bMaxBuffer,
511        pub test_result: TpmRc,
512    }
513}
514
515tpm_struct! {
516    #[derive(Debug, PartialEq, Eq, Clone)]
517    TpmDuplicateCommand,
518    TpmCc::Duplicate,
519    false,
520    true,
521    2,
522    {
523        pub encryption_key_in: Tpm2bData,
524        pub symmetric_alg: TpmtSymDefObject,
525    }
526}
527
528tpm_response! {
529    #[derive(Debug, PartialEq, Eq, Clone)]
530    TpmDuplicateResponse,
531    TpmCc::Duplicate,
532    false,
533    true,
534    {
535        pub encryption_key_out: Tpm2bData,
536        pub duplicate: Tpm2bPrivate,
537        pub out_sym_seed: Tpm2bEncryptedSecret,
538    }
539}
540
541tpm_struct! {
542    #[derive(Debug, PartialEq, Eq, Clone)]
543    TpmRewrapCommand,
544    TpmCc::Rewrap,
545    false,
546    true,
547    2,
548    {
549        pub in_duplicate: Tpm2bPrivate,
550        pub name: Tpm2bName,
551        pub in_sym_seed: Tpm2bEncryptedSecret,
552    }
553}
554
555tpm_response! {
556    #[derive(Debug, PartialEq, Eq, Clone)]
557    TpmRewrapResponse,
558    TpmCc::Rewrap,
559    false,
560    true,
561    {
562        pub out_duplicate: Tpm2bPrivate,
563        pub out_sym_seed: Tpm2bEncryptedSecret,
564    }
565}
566
567tpm_struct! {
568    #[derive(Debug, PartialEq, Eq, Clone)]
569    TpmEncryptDecrypt2Command,
570    TpmCc::EncryptDecrypt2,
571    false,
572    true,
573    1,
574    {
575        pub in_data: Tpm2bMaxBuffer,
576        pub decrypt: TpmiYesNo,
577        pub mode: TpmAlgId,
578        pub iv_in: Tpm2b,
579    }
580}
581
582tpm_response! {
583    #[derive(Debug, PartialEq, Eq, Clone)]
584    TpmEncryptDecrypt2Response,
585    TpmCc::EncryptDecrypt2,
586    false,
587    true,
588    {
589        pub out_data: Tpm2bMaxBuffer,
590        pub iv_out: Tpm2b,
591    }
592}
593
594tpm_struct! {
595    #[derive(Debug, PartialEq, Eq, Clone, Copy)]
596    TpmGetRandomCommand,
597    TpmCc::GetRandom,
598    true,
599    true,
600    0,
601    {
602        pub bytes_requested: u16,
603    }
604}
605
606tpm_response! {
607    #[derive(Debug, Default, PartialEq, Eq, Clone)]
608    TpmGetRandomResponse,
609    TpmCc::GetRandom,
610    true,
611    true,
612    {
613        pub random_bytes: Tpm2bDigest,
614    }
615}
616
617tpm_struct! {
618    #[derive(Debug, PartialEq, Eq, Clone)]
619    TpmStirRandomCommand,
620    TpmCc::StirRandom,
621    true,
622    true,
623    0,
624    {
625        pub in_data: Tpm2bSensitiveData,
626    }
627}
628
629tpm_response! {
630    #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
631    TpmStirRandomResponse,
632    TpmCc::StirRandom,
633    true,
634    true,
635    {}
636}
637
638tpm_struct! {
639    #[derive(Debug, PartialEq, Eq, Clone)]
640    TpmHierarchyControlCommand,
641    TpmCc::HierarchyControl,
642    false,
643    true,
644    1,
645    {
646        pub enable: TpmRh,
647        pub state: TpmiYesNo,
648    }
649}
650
651tpm_response! {
652    #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
653    TpmHierarchyControlResponse,
654    TpmCc::HierarchyControl,
655    false,
656    true,
657    {}
658}
659
660tpm_struct! {
661    #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
662    TpmChangePpsCommand,
663    TpmCc::ChangePps,
664    false,
665    true,
666    1,
667    {}
668}
669
670tpm_response! {
671    #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
672    TpmChangePpsResponse,
673    TpmCc::ChangePps,
674    false,
675    true,
676    {}
677}
678
679tpm_struct! {
680    #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
681    TpmChangeEpsCommand,
682    TpmCc::ChangeEps,
683    false,
684    true,
685    1,
686    {}
687}
688
689tpm_response! {
690    #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
691    TpmChangeEpsResponse,
692    TpmCc::ChangeEps,
693    false,
694    true,
695    {}
696}
697
698tpm_struct! {
699    #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
700    TpmClearCommand,
701    TpmCc::Clear,
702    false,
703    true,
704    1,
705    {}
706}
707
708tpm_response! {
709    #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
710    TpmClearResponse,
711    TpmCc::Clear,
712    false,
713    true,
714    {}
715}
716
717tpm_struct! {
718    #[derive(Debug, PartialEq, Eq, Clone)]
719    TpmClearControlCommand,
720    TpmCc::ClearControl,
721    false,
722    true,
723    1,
724    {
725        pub disable: TpmiYesNo,
726    }
727}
728
729tpm_response! {
730    #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
731    TpmClearControlResponse,
732    TpmCc::ClearControl,
733    false,
734    true,
735    {}
736}
737
738tpm_struct! {
739    #[derive(Debug, PartialEq, Eq, Clone)]
740    TpmHierarchyChangeAuthCommand,
741    TpmCc::HierarchyChangeAuth,
742    false,
743    true,
744    1,
745    {
746        pub new_auth: Tpm2bAuth,
747    }
748}
749
750tpm_response! {
751    #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
752    TpmHierarchyChangeAuthResponse,
753    TpmCc::HierarchyChangeAuth,
754    false,
755    true,
756    {}
757}
758
759tpm_dispatch! {
760    (TpmNvUndefineSpaceSpecialCommand, TpmNvUndefineSpaceSpecialResponse, NvUndefineSpaceSpecial),
761    (TpmEvictControlCommand, TpmEvictControlResponse, EvictControl),
762    (TpmHierarchyControlCommand, TpmHierarchyControlResponse, HierarchyControl),
763    (TpmNvUndefineSpaceCommand, TpmNvUndefineSpaceResponse, NvUndefineSpace),
764    (TpmChangeEpsCommand, TpmChangeEpsResponse, ChangeEps),
765    (TpmChangePpsCommand, TpmChangePpsResponse, ChangePps),
766    (TpmClearCommand, TpmClearResponse, Clear),
767    (TpmClearControlCommand, TpmClearControlResponse, ClearControl),
768    (TpmHierarchyChangeAuthCommand, TpmHierarchyChangeAuthResponse, HierarchyChangeAuth),
769    (TpmNvDefineSpaceCommand, TpmNvDefineSpaceResponse, NvDefineSpace),
770    (TpmPcrAllocateCommand, TpmPcrAllocateResponse, PcrAllocate),
771    (TpmPcrSetAuthPolicyCommand, TpmPcrSetAuthPolicyResponse, PcrSetAuthPolicy),
772    (TpmSetPrimaryPolicyCommand, TpmSetPrimaryPolicyResponse, SetPrimaryPolicy),
773    (TpmCreatePrimaryCommand, TpmCreatePrimaryResponse, CreatePrimary),
774    (TpmNvGlobalWriteLockCommand, TpmNvGlobalWriteLockResponse, NvGlobalWriteLock),
775    (TpmGetCommandAuditDigestCommand, TpmGetCommandAuditDigestResponse, GetCommandAuditDigest),
776    (TpmNvIncrementCommand, TpmNvIncrementResponse, NvIncrement),
777    (TpmNvSetBitsCommand, TpmNvSetBitsResponse, NvSetBits),
778    (TpmNvExtendCommand, TpmNvExtendResponse, NvExtend),
779    (TpmNvWriteCommand, TpmNvWriteResponse, NvWrite),
780    (TpmNvWriteLockCommand, TpmNvWriteLockResponse, NvWriteLock),
781    (TpmDictionaryAttackLockResetCommand, TpmDictionaryAttackLockResetResponse, DictionaryAttackLockReset),
782    (TpmNvChangeAuthCommand, TpmNvChangeAuthResponse, NvChangeAuth),
783    (TpmPcrEventCommand, TpmPcrEventResponse, PcrEvent),
784    (TpmPcrResetCommand, TpmPcrResetResponse, PcrReset),
785    (TpmSequenceCompleteCommand, TpmSequenceCompleteResponse, SequenceComplete),
786    (TpmIncrementalSelfTestCommand, TpmIncrementalSelfTestResponse, IncrementalSelfTest),
787    (TpmSelfTestCommand, TpmSelfTestResponse, SelfTest),
788    (TpmStartupCommand, TpmStartupResponse, Startup),
789    (TpmShutdownCommand, TpmShutdownResponse, Shutdown),
790    (TpmStirRandomCommand, TpmStirRandomResponse, StirRandom),
791    (TpmActivateCredentialCommand, TpmActivateCredentialResponse, ActivateCredential),
792    (TpmCertifyCommand, TpmCertifyResponse, Certify),
793    (TpmCertifyCreationCommand, TpmCertifyCreationResponse, CertifyCreation),
794    (TpmDuplicateCommand, TpmDuplicateResponse, Duplicate),
795    (TpmGetTimeCommand, TpmGetTimeResponse, GetTime),
796    (TpmGetSessionAuditDigestCommand, TpmGetSessionAuditDigestResponse, GetSessionAuditDigest),
797    (TpmNvReadCommand, TpmNvReadResponse, NvRead),
798    (TpmNvReadLockCommand, TpmNvReadLockResponse, NvReadLock),
799    (TpmObjectChangeAuthCommand, TpmObjectChangeAuthResponse, ObjectChangeAuth),
800    (TpmPolicySecretCommand, TpmPolicySecretResponse, PolicySecret),
801    (TpmRewrapCommand, TpmRewrapResponse, Rewrap),
802    (TpmCreateCommand, TpmCreateResponse, Create),
803    (TpmEcdhZGenCommand, TpmEcdhZGenResponse, EcdhZGen),
804    (TpmZGen2PhaseCommand, TpmZGen2PhaseResponse, ZGen2Phase),
805    (TpmImportCommand, TpmImportResponse, Import),
806    (TpmLoadCommand, TpmLoadResponse, Load),
807    (TpmQuoteCommand, TpmQuoteResponse, Quote),
808    (TpmRsaDecryptCommand, TpmRsaDecryptResponse, RsaDecrypt),
809    (TpmEccEncryptCommand, TpmEccEncryptResponse, EccEncrypt),
810    (TpmEccDecryptCommand, TpmEccDecryptResponse, EccDecrypt),
811    (TpmSequenceUpdateCommand, TpmSequenceUpdateResponse, SequenceUpdate),
812    (TpmSignCommand, TpmSignResponse, Sign),
813    (TpmUnsealCommand, TpmUnsealResponse, Unseal),
814    (TpmPolicySignedCommand, TpmPolicySignedResponse, PolicySigned),
815    (TpmContextLoadCommand, TpmContextLoadResponse, ContextLoad),
816    (TpmContextSaveCommand, TpmContextSaveResponse, ContextSave),
817    (TpmEcdhKeyGenCommand, TpmEcdhKeyGenResponse, EcdhKeyGen),
818    (TpmFlushContextCommand, TpmFlushContextResponse, FlushContext),
819    (TpmLoadExternalCommand, TpmLoadExternalResponse, LoadExternal),
820    (TpmMakeCredentialCommand, TpmMakeCredentialResponse, MakeCredential),
821    (TpmNvReadPublicCommand, TpmNvReadPublicResponse, NvReadPublic),
822    (TpmPolicyAuthValueCommand, TpmPolicyAuthValueResponse, PolicyAuthValue),
823    (TpmPolicyCommandCodeCommand, TpmPolicyCommandCodeResponse, PolicyCommandCode),
824    (TpmPolicyCpHashCommand, TpmPolicyCpHashResponse, PolicyCpHash),
825    (TpmPolicyLocalityCommand, TpmPolicyLocalityResponse, PolicyLocality),
826    (TpmPolicyOrCommand, TpmPolicyOrResponse, PolicyOr),
827    (TpmPolicyTicketCommand, TpmPolicyTicketResponse, PolicyTicket),
828    (TpmReadPublicCommand, TpmReadPublicResponse, ReadPublic),
829    (TpmRsaEncryptCommand, TpmRsaEncryptResponse, RsaEncrypt),
830    (TpmStartAuthSessionCommand, TpmStartAuthSessionResponse, StartAuthSession),
831    (TpmVerifySignatureCommand, TpmVerifySignatureResponse, VerifySignature),
832    (TpmEccParametersCommand, TpmEccParametersResponse, EccParameters),
833    (TpmGetCapabilityCommand, TpmGetCapabilityResponse, GetCapability),
834    (TpmGetRandomCommand, TpmGetRandomResponse, GetRandom),
835    (TpmGetTestResultCommand, TpmGetTestResultResponse, GetTestResult),
836    (TpmHashCommand, TpmHashResponse, Hash),
837    (TpmPcrReadCommand, TpmPcrReadResponse, PcrRead),
838    (TpmPolicyPcrCommand, TpmPolicyPcrResponse, PolicyPcr),
839    (TpmPolicyRestartCommand, TpmPolicyRestartResponse, PolicyRestart),
840    (TpmPcrExtendCommand, TpmPcrExtendResponse, PcrExtend),
841    (TpmPcrSetAuthValueCommand, TpmPcrSetAuthValueResponse, PcrSetAuthValue),
842    (TpmNvCertifyCommand, TpmNvCertifyResponse, NvCertify),
843    (TpmEventSequenceCompleteCommand, TpmEventSequenceCompleteResponse, EventSequenceComplete),
844    (TpmHashSequenceStartCommand, TpmHashSequenceStartResponse, HashSequenceStart),
845    (TpmPolicyPhysicalPresenceCommand, TpmPolicyPhysicalPresenceResponse, PolicyPhysicalPresence),
846    (TpmPolicyGetDigestCommand, TpmPolicyGetDigestResponse, PolicyGetDigest),
847    (TpmPolicyPasswordCommand, TpmPolicyPasswordResponse, PolicyPassword),
848    (TpmEncryptDecrypt2Command, TpmEncryptDecrypt2Response, EncryptDecrypt2),
849    (TpmVendorTcgTestCommand, TpmVendorTcgTestResponse, VendorTcgTest),
850}