1use crate::{
11 data::{
12 Tpm2bDigest, Tpm2bIv, Tpm2bMaxBuffer, TpmAlgId, TpmCc, TpmRh, TpmiAlgHash, TpmiYesNo,
13 TpmtTkHashcheck,
14 },
15 tpm_struct,
16};
17use core::fmt::Debug;
18
19pub type TpmiAlgCipherMode = TpmAlgId;
20
21tpm_struct! {
22 #[derive(Debug, PartialEq, Eq, Clone)]
23 kind: Command,
24 name: TpmEncryptDecryptCommand,
25 cc: TpmCc::EncryptDecrypt,
26 handles: {
27 pub key_handle: crate::data::TpmiDhObject,
28 },
29 parameters: {
30 pub decrypt: TpmiYesNo,
31 pub mode: TpmiAlgCipherMode,
32 pub iv_in: Tpm2bIv,
33 pub in_data: Tpm2bMaxBuffer,
34 }
35}
36
37tpm_struct! {
38 #[derive(Debug, PartialEq, Eq, Clone)]
39 kind: Response,
40 name: TpmEncryptDecryptResponse,
41 cc: TpmCc::EncryptDecrypt,
42 handles: {},
43 parameters: {
44 pub out_data: Tpm2bMaxBuffer,
45 pub iv_out: Tpm2bIv,
46 }
47}
48
49tpm_struct! {
50 #[derive(Debug, PartialEq, Eq, Clone)]
51 kind: Command,
52 name: TpmEncryptDecrypt2Command,
53 cc: TpmCc::EncryptDecrypt2,
54 handles: {
55 pub key_handle: crate::data::TpmiDhObject,
56 },
57 parameters: {
58 pub in_data: Tpm2bMaxBuffer,
59 pub decrypt: TpmiYesNo,
60 pub mode: TpmAlgId,
61 pub iv_in: Tpm2bIv,
62 }
63}
64
65tpm_struct! {
66 #[derive(Debug, PartialEq, Eq, Clone)]
67 kind: Response,
68 name: TpmEncryptDecrypt2Response,
69 cc: TpmCc::EncryptDecrypt2,
70 handles: {},
71 parameters: {
72 pub out_data: Tpm2bMaxBuffer,
73 pub iv_out: Tpm2bIv,
74 }
75}
76
77tpm_struct! {
78 #[derive(Debug, PartialEq, Eq, Clone)]
79 kind: Command,
80 name: TpmHashCommand,
81 cc: TpmCc::Hash,
82 handles: {},
83 parameters: {
84 pub data: Tpm2bMaxBuffer,
85 pub hash_alg: TpmAlgId,
86 pub hierarchy: TpmRh,
87 }
88}
89
90tpm_struct! {
91 #[derive(Debug, PartialEq, Eq, Clone)]
92 kind: Response,
93 name: TpmHashResponse,
94 cc: TpmCc::Hash,
95 handles: {},
96 parameters: {
97 pub out_hash: Tpm2bDigest,
98 pub validation: TpmtTkHashcheck,
99 }
100}
101
102tpm_struct! {
103 #[derive(Debug, PartialEq, Eq, Clone)]
104 kind: Command,
105 name: TpmHmacCommand,
106 cc: TpmCc::Hmac,
107 handles: {
108 pub handle: crate::data::TpmiDhObject,
109 },
110 parameters: {
111 pub buffer: Tpm2bMaxBuffer,
112 pub hash_alg: TpmiAlgHash,
113 }
114}
115
116tpm_struct! {
117 #[derive(Debug, PartialEq, Eq, Clone)]
118 kind: Response,
119 name: TpmHmacResponse,
120 cc: TpmCc::Hmac,
121 handles: {},
122 parameters: {
123 pub out_hmac: Tpm2bDigest,
124 }
125}