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