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_DATA_SIZE, MAX_DIGEST_SIZE, MAX_ECC_KEY_BYTES, MAX_EVENT_SIZE,
17 MAX_NV_BUFFER_SIZE, MAX_PRIVATE_SIZE, MAX_RSA_KEY_BYTES, MAX_SENSITIVE_DATA,
18 MAX_SYM_KEY_BYTES, 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_DATA_SIZE);
41tpm2b!(Tpm2bTimeout, 8);
42tpm2b!(Tpm2bIv, 16);
43tpm2b!(Tpm2bIdObject, { 2 * (MAX_DIGEST_SIZE + 2) });
44
45tpm2b_struct! {
46 #[derive(Debug, PartialEq, Eq, Clone, Default)]
47 wire: Tpm2bPublicWire,
48 Tpm2bPublic,
49 TpmtPublic
50}
51
52pub type Tpm2bTemplate = Tpm2bPublic;
53
54tpm2b_struct! {
55 #[derive(Debug, PartialEq, Eq, Clone, Default)]
56 wire: Tpm2bSensitiveCreateWire,
57 Tpm2bSensitiveCreate,
58 TpmsSensitiveCreate
59}
60
61tpm2b_struct! {
62 #[derive(Debug, PartialEq, Eq, Clone)]
63 wire: Tpm2bSensitiveWire,
64 Tpm2bSensitive,
65 TpmtSensitive
66}
67
68tpm2b_struct! {
69 #[derive(Debug, PartialEq, Eq, Clone, Default)]
70 wire: Tpm2bCreationDataWire,
71 Tpm2bCreationData,
72 TpmsCreationData
73}
74
75tpm2b_struct! {
76 #[derive(Debug, PartialEq, Eq, Clone)]
77 wire: Tpm2bAttestWire,
78 Tpm2bAttest,
79 TpmsAttest
80}
81
82tpm2b_struct! {
83 #[derive(Debug, PartialEq, Eq, Clone)]
84 wire: Tpm2bNvPublicWire,
85 Tpm2bNvPublic,
86 TpmsNvPublic
87}
88
89tpm2b_struct! {
90 #[derive(Debug, PartialEq, Eq, Clone, Copy)]
91 wire: Tpm2bEccPointWire,
92 Tpm2bEccPoint,
93 TpmsEccPoint
94}
95
96tpm2b_struct! {
97 #[derive(Debug, PartialEq, Eq, Clone, Copy)]
98 wire: Tpm2bNvPublic2Wire,
99 Tpm2bNvPublic2,
100 TpmtNvPublic2
101}
102
103tpml!(TpmlAcCapabilities, TpmsAcOutput, 64);
104tpml!(TpmlAlgProperty, TpmsAlgProperty, 64);
105tpml!(TpmlAlg, TpmAlgId, 64);
106tpml!(TpmlCc, TpmCc, 256);
107tpml!(TpmlCca, TpmaCc, 256);
108tpml!(TpmlDigest, Tpm2bDigest, 8);
109tpml!(TpmlDigestValues, TpmtHa, 8);
110tpml!(TpmlHandle, crate::basic::TpmUint32, 128);
111tpml!(TpmlPcrSelection, TpmsPcrSelection, 8);
112tpml!(TpmlEccCurve, TpmEccCurve, 64);
113tpml!(TpmlTaggedTpmProperty, TpmsTaggedProperty, 64);
114tpml!(TpmlTaggedPolicy, TpmsTaggedPolicy, 8);
115tpml!(TpmlActData, TpmsActData, 8);