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}
56tpm2b_struct! {
57 #[derive(Debug, PartialEq, Eq, Clone, Default)]
58 Tpm2bSensitiveCreate,
59 TpmsSensitiveCreate
60}
61tpm2b_struct! {
62 #[derive(Debug, PartialEq, Eq, Clone)]
63 Tpm2bSensitive,
64 TpmtSensitive
65}
66tpm2b_struct! {
67 #[derive(Debug, PartialEq, Eq, Clone, Default)]
68 Tpm2bCreationData,
69 TpmsCreationData
70}
71tpm2b_struct! {
72 #[derive(Debug, PartialEq, Eq, Clone)]
73 Tpm2bAttest,
74 TpmsAttest
75}
76tpm2b_struct! {
77 #[derive(Debug, PartialEq, Eq, Clone)]
78 Tpm2bNvPublic,
79 TpmsNvPublic
80}
81tpm2b_struct! {
82 #[derive(Debug, PartialEq, Eq, Clone, Default)]
83 Tpm2bIdObject,
84 TpmsIdObject
85}
86
87tpm2b_struct! {
88 #[derive(Debug, PartialEq, Eq, Clone, Copy)]
89 Tpm2bEccPoint,
90 TpmsEccPoint
91}
92
93tpm2b_struct! {
94 #[derive(Debug, PartialEq, Eq, Clone, Copy)]
95 Tpm2bNvPublic2,
96 TpmtNvPublic2
97}
98
99tpml!(TpmlAcCapabilities, TpmsAcOutput, 64);
100tpml!(TpmlAlgProperty, TpmsAlgProperty, 64);
101tpml!(TpmlAlg, TpmAlgId, 64);
102tpml!(TpmlCc, TpmCc, 256);
103tpml!(TpmlCca, TpmaCc, 256);
104tpml!(TpmlDigest, Tpm2bDigest, 8);
105tpml!(TpmlDigestValues, TpmtHa, 8);
106tpml!(TpmlHandle, u32, 128);
107tpml!(TpmlPcrSelection, TpmsPcrSelection, 8);
108tpml!(TpmlEccCurve, TpmEccCurve, 64);
109tpml!(TpmlTaggedTpmProperty, TpmsTaggedProperty, 64);