1mod r#enum;
6mod tpma;
7mod tpmi;
8mod tpms;
9mod tpmt;
10mod tpmu;
11
12pub use self::{r#enum::*, tpma::*, tpmi::*, tpms::*, tpmt::*, tpmu::*};
13
14use crate::{
15 constant::{
16 MAX_BUFFER_SIZE, MAX_DIGEST_SIZE, MAX_ECC_KEY_BYTES, MAX_EVENT_SIZE, MAX_NV_BUFFER_SIZE,
17 MAX_PRIVATE_SIZE, MAX_RSA_KEY_BYTES, MAX_SENSITIVE_DATA, MAX_SYM_KEY_BYTES,
18 TPM_MAX_COMMAND_SIZE,
19 },
20 tpm2b, tpm2b_struct, tpml,
21};
22use core::{convert::TryFrom, fmt::Debug};
23
24tpm2b!(Tpm2b, { TPM_MAX_COMMAND_SIZE });
25tpm2b!(Tpm2bAuth, MAX_DIGEST_SIZE);
26tpm2b!(Tpm2bDigest, MAX_DIGEST_SIZE);
27tpm2b!(Tpm2bEccParameter, MAX_ECC_KEY_BYTES);
28tpm2b!(Tpm2bEncryptedSecret, MAX_RSA_KEY_BYTES);
29tpm2b!(Tpm2bEvent, MAX_EVENT_SIZE);
30tpm2b!(Tpm2bMaxBuffer, MAX_BUFFER_SIZE);
31tpm2b!(Tpm2bMaxNvBuffer, MAX_NV_BUFFER_SIZE);
32tpm2b!(Tpm2bName, { MAX_DIGEST_SIZE + 2 });
33tpm2b!(Tpm2bNonce, MAX_DIGEST_SIZE);
34tpm2b!(Tpm2bOperand, MAX_DIGEST_SIZE);
35tpm2b!(Tpm2bPrivate, MAX_PRIVATE_SIZE);
36tpm2b!(Tpm2bPrivateKeyRsa, { MAX_RSA_KEY_BYTES / 2 });
37tpm2b!(Tpm2bPublicKeyRsa, MAX_RSA_KEY_BYTES);
38tpm2b!(Tpm2bSensitiveData, MAX_SENSITIVE_DATA);
39tpm2b!(Tpm2bSymKey, MAX_SYM_KEY_BYTES);
40tpm2b!(Tpm2bData, MAX_SENSITIVE_DATA);
41tpm2b!(Tpm2bTimeout, 8);
42tpm2b!(Tpm2bIv, 16);
43
44tpm2b_struct! {
45 #[derive(Debug, PartialEq, Eq, Clone, Default)]
46 wire: Tpm2bPublicWire,
47 Tpm2bPublic,
48 TpmtPublic
49}
50
51pub type Tpm2bTemplate = Tpm2bPublic;
52
53tpm2b_struct! {
54 #[derive(Debug, PartialEq, Eq, Clone, Default)]
55 wire: Tpm2bSensitiveCreateWire,
56 Tpm2bSensitiveCreate,
57 TpmsSensitiveCreate
58}
59
60tpm2b_struct! {
61 #[derive(Debug, PartialEq, Eq, Clone)]
62 wire: Tpm2bSensitiveWire,
63 Tpm2bSensitive,
64 TpmtSensitive
65}
66
67tpm2b_struct! {
68 #[derive(Debug, PartialEq, Eq, Clone, Default)]
69 wire: Tpm2bCreationDataWire,
70 Tpm2bCreationData,
71 TpmsCreationData
72}
73
74tpm2b_struct! {
75 #[derive(Debug, PartialEq, Eq, Clone)]
76 wire: Tpm2bAttestWire,
77 Tpm2bAttest,
78 TpmsAttest
79}
80
81tpm2b_struct! {
82 #[derive(Debug, PartialEq, Eq, Clone)]
83 wire: Tpm2bNvPublicWire,
84 Tpm2bNvPublic,
85 TpmsNvPublic
86}
87
88tpm2b_struct! {
89 #[derive(Debug, PartialEq, Eq, Clone, Default)]
90 wire: Tpm2bIdObjectWire,
91 Tpm2bIdObject,
92 TpmsIdObject
93}
94
95tpm2b_struct! {
96 #[derive(Debug, PartialEq, Eq, Clone, Copy)]
97 wire: Tpm2bEccPointWire,
98 Tpm2bEccPoint,
99 TpmsEccPoint
100}
101
102tpm2b_struct! {
103 #[derive(Debug, PartialEq, Eq, Clone, Copy)]
104 wire: Tpm2bNvPublic2Wire,
105 Tpm2bNvPublic2,
106 TpmtNvPublic2
107}
108
109tpml!(TpmlAcCapabilities, TpmsAcOutput, 64);
110tpml!(TpmlAlgProperty, TpmsAlgProperty, 64);
111tpml!(TpmlAlg, TpmAlgId, 64);
112tpml!(TpmlCc, TpmCc, 256);
113tpml!(TpmlCca, TpmaCc, 256);
114tpml!(TpmlDigest, Tpm2bDigest, 8);
115tpml!(TpmlDigestValues, TpmtHa, 8);
116tpml!(TpmlHandle, crate::basic::TpmUint32, 128);
117tpml!(TpmlPcrSelection, TpmsPcrSelection, 8);
118tpml!(TpmlEccCurve, TpmEccCurve, 64);
119tpml!(TpmlTaggedTpmProperty, TpmsTaggedProperty, 64);