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