1use crate::{
8 data::{
9 Tpm2bData, Tpm2bEccPoint, Tpm2bMaxBuffer, Tpm2bPublicKeyRsa, TpmCc, TpmEccCurve,
10 TpmiEccKeyExchange, TpmsAlgorithmDetailEcc, TpmtKdfScheme, TpmtRsaDecrypt,
11 },
12 tpm_response, tpm_struct,
13};
14use core::fmt::Debug;
15
16tpm_struct! {
17 #[derive(Debug, PartialEq, Eq, Clone)]
18 TpmRsaEncryptCommand,
19 TpmCc::RsaEncrypt,
20 true,
21 true,
22 1,
23 {
24 pub message: Tpm2bPublicKeyRsa,
25 pub in_scheme: TpmtRsaDecrypt,
26 pub label: Tpm2bData,
27 }
28}
29
30tpm_response! {
31 #[derive(Debug, PartialEq, Eq, Clone)]
32 TpmRsaEncryptResponse,
33 TpmCc::RsaEncrypt,
34 true,
35 true,
36 {
37 pub out_data: Tpm2bPublicKeyRsa,
38 }
39}
40
41tpm_struct! {
42 #[derive(Debug, PartialEq, Eq, Clone)]
43 TpmRsaDecryptCommand,
44 TpmCc::RsaDecrypt,
45 false,
46 true,
47 1,
48 {
49 pub cipher_text: Tpm2bPublicKeyRsa,
50 pub in_scheme: TpmtRsaDecrypt,
51 pub label: Tpm2bData,
52 }
53}
54
55tpm_response! {
56 #[derive(Debug, PartialEq, Eq, Clone)]
57 TpmRsaDecryptResponse,
58 TpmCc::RsaDecrypt,
59 false,
60 true,
61 {
62 pub message: Tpm2bPublicKeyRsa,
63 }
64}
65
66tpm_struct! {
67 #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
68 TpmEcdhKeyGenCommand,
69 TpmCc::EcdhKeyGen,
70 true,
71 true,
72 1,
73 {}
74}
75
76tpm_response! {
77 #[derive(Debug, PartialEq, Eq, Clone)]
78 TpmEcdhKeyGenResponse,
79 TpmCc::EcdhKeyGen,
80 true,
81 true,
82 {
83 pub z_point: Tpm2bEccPoint,
84 pub pub_point: Tpm2bEccPoint,
85 }
86}
87
88tpm_struct! {
89 #[derive(Debug, PartialEq, Eq, Clone, Copy)]
90 TpmEcdhZGenCommand,
91 TpmCc::EcdhZGen,
92 false,
93 true,
94 1,
95 {
96 pub in_point: Tpm2bEccPoint,
97 }
98}
99
100tpm_response! {
101 #[derive(Debug, PartialEq, Eq, Clone)]
102 TpmEcdhZGenResponse,
103 TpmCc::EcdhZGen,
104 false,
105 true,
106 {
107 pub out_point: Tpm2bEccPoint,
108 }
109}
110
111tpm_struct! {
112 #[derive(Debug, PartialEq, Eq, Copy, Clone)]
113 TpmEccParametersCommand,
114 TpmCc::EccParameters,
115 true,
116 true,
117 0,
118 {
119 pub curve_id: TpmEccCurve,
120 }
121}
122
123tpm_response! {
124 #[derive(Debug, PartialEq, Eq, Clone)]
125 TpmEccParametersResponse,
126 TpmCc::EccParameters,
127 true,
128 true,
129 {
130 pub parameters: TpmsAlgorithmDetailEcc,
131 }
132}
133
134tpm_struct! {
135 #[derive(Debug, PartialEq, Eq, Clone)]
136 TpmZGen2PhaseCommand,
137 TpmCc::ZGen2Phase,
138 false,
139 true,
140 1,
141 {
142 pub in_qsb: Tpm2bEccPoint,
143 pub in_qeb: Tpm2bEccPoint,
144 pub in_scheme: TpmiEccKeyExchange,
145 pub counter: u16,
146 }
147}
148
149tpm_response! {
150 #[derive(Debug, PartialEq, Eq, Clone)]
151 TpmZGen2PhaseResponse,
152 TpmCc::ZGen2Phase,
153 false,
154 true,
155 {
156 pub out_z1: Tpm2bEccPoint,
157 pub out_z2: Tpm2bEccPoint,
158 }
159}
160
161tpm_struct! {
162 #[derive(Debug, PartialEq, Eq, Clone)]
163 TpmEccEncryptCommand,
164 TpmCc::EccEncrypt,
165 true,
166 true,
167 1,
168 {
169 pub plaintext: Tpm2bMaxBuffer,
170 pub in_scheme: TpmtKdfScheme,
171 }
172}
173
174tpm_response! {
175 #[derive(Debug, PartialEq, Eq, Clone)]
176 TpmEccEncryptResponse,
177 TpmCc::EccEncrypt,
178 true,
179 true,
180 {
181 pub c1: Tpm2bEccPoint,
182 pub c2: crate::data::Tpm2bMaxBuffer,
183 pub c3: crate::data::Tpm2bDigest,
184 }
185}
186
187tpm_struct! {
188 #[derive(Debug, PartialEq, Eq, Clone)]
189 TpmEccDecryptCommand,
190 TpmCc::EccDecrypt,
191 false,
192 true,
193 1,
194 {
195 pub c1: Tpm2bEccPoint,
196 pub c2: crate::data::Tpm2bMaxBuffer,
197 pub c3: crate::data::Tpm2bDigest,
198 pub in_scheme: TpmtKdfScheme,
199 }
200}
201
202tpm_response! {
203 #[derive(Debug, PartialEq, Eq, Clone)]
204 TpmEccDecryptResponse,
205 TpmCc::EccDecrypt,
206 false,
207 true,
208 {
209 pub plaintext: crate::data::Tpm2bMaxBuffer,
210 }
211}