tpm2_protocol/message/
attestation.rs

1// SPDX-License-Identifier: MIT OR Apache-2.0
2// Copyright (c) 2025 Opinsys Oy
3// Copyright (c) 2024-2025 Jarkko Sakkinen
4
5//! 18 Attestation Commands
6
7use crate::{
8    data::{
9        Tpm2bAttest, Tpm2bData, Tpm2bDigest, TpmCc, TpmlPcrSelection, TpmtSignature, TpmtTkCreation,
10    },
11    tpm_struct,
12};
13use core::fmt::Debug;
14
15tpm_struct! {
16    #[derive(Debug, PartialEq, Eq, Clone)]
17    kind: Command,
18    name: TpmCertifyCommand,
19    cc: TpmCc::Certify,
20    handles: {
21        pub object_handle: crate::data::TpmiDhObject,
22        pub sign_handle: crate::data::TpmiDhObject,
23    },
24    parameters: {
25        pub qualifying_data: Tpm2bData,
26        pub in_scheme: TpmtSignature,
27    }
28}
29
30tpm_struct! {
31    #[derive(Debug, PartialEq, Eq, Clone)]
32    kind: Response,
33    name: TpmCertifyResponse,
34    cc: TpmCc::Certify,
35    handles: {},
36    parameters: {
37        pub certify_info: Tpm2bAttest,
38        pub signature: TpmtSignature,
39    }
40}
41
42tpm_struct! {
43    #[derive(Debug, PartialEq, Eq, Clone)]
44    kind: Command,
45    name: TpmCertifyCreationCommand,
46    cc: TpmCc::CertifyCreation,
47    handles: {
48        pub sign_handle: crate::data::TpmiDhObject,
49        pub object_handle: crate::data::TpmiDhObject,
50    },
51    parameters: {
52        pub qualifying_data: Tpm2bData,
53        pub creation_hash: Tpm2bDigest,
54        pub in_scheme: TpmtSignature,
55        pub creation_ticket: TpmtTkCreation,
56    }
57}
58
59tpm_struct! {
60    #[derive(Debug, PartialEq, Eq, Clone)]
61    kind: Response,
62    name: TpmCertifyCreationResponse,
63    cc: TpmCc::CertifyCreation,
64    handles: {},
65    parameters: {
66        pub certify_info: Tpm2bAttest,
67        pub signature: TpmtSignature,
68    }
69}
70
71tpm_struct! {
72    #[derive(Debug, PartialEq, Eq, Clone)]
73    kind: Command,
74    name: TpmQuoteCommand,
75    cc: TpmCc::Quote,
76    handles: {
77        pub sign_handle: crate::data::TpmiDhObject,
78    },
79    parameters: {
80        pub qualifying_data: Tpm2bData,
81        pub in_scheme: TpmtSignature,
82        pub pcr_select: TpmlPcrSelection,
83    }
84}
85
86tpm_struct! {
87    #[derive(Debug, PartialEq, Eq, Clone)]
88    kind: Response,
89    name: TpmQuoteResponse,
90    cc: TpmCc::Quote,
91    handles: {},
92    parameters: {
93        pub quoted: Tpm2bAttest,
94        pub signature: TpmtSignature,
95    }
96}
97
98tpm_struct! {
99    #[derive(Debug, PartialEq, Eq, Clone)]
100    kind: Command,
101    name: TpmGetSessionAuditDigestCommand,
102    cc: TpmCc::GetSessionAuditDigest,
103    handles: {
104        pub privacy_admin_handle: crate::data::TpmiRhHierarchy,
105        pub sign_handle: crate::data::TpmiDhObject,
106        pub session_handle: crate::data::TpmiShAuthSession,
107    },
108    parameters: {
109        pub qualifying_data: Tpm2bData,
110        pub in_scheme: TpmtSignature,
111    }
112}
113
114tpm_struct! {
115    #[derive(Debug, PartialEq, Eq, Clone)]
116    kind: Response,
117    name: TpmGetSessionAuditDigestResponse,
118    cc: TpmCc::GetSessionAuditDigest,
119    handles: {},
120    parameters: {
121        pub audit_info: Tpm2bAttest,
122        pub signature: TpmtSignature,
123    }
124}
125
126tpm_struct! {
127    #[derive(Debug, PartialEq, Eq, Clone)]
128    kind: Command,
129    name: TpmGetCommandAuditDigestCommand,
130    cc: TpmCc::GetCommandAuditDigest,
131    handles: {
132        pub privacy_admin_handle: crate::data::TpmiRhHierarchy,
133        pub sign_handle: crate::data::TpmiDhObject,
134    },
135    parameters: {
136        pub qualifying_data: Tpm2bData,
137        pub in_scheme: TpmtSignature,
138    }
139}
140
141tpm_struct! {
142    #[derive(Debug, PartialEq, Eq, Clone)]
143    kind: Response,
144    name: TpmGetCommandAuditDigestResponse,
145    cc: TpmCc::GetCommandAuditDigest,
146    handles: {},
147    parameters: {
148        pub audit_info: Tpm2bAttest,
149        pub signature: TpmtSignature,
150    }
151}
152
153tpm_struct! {
154    #[derive(Debug, PartialEq, Eq, Clone)]
155    kind: Command,
156    name: TpmGetTimeCommand,
157    cc: TpmCc::GetTime,
158    handles: {
159        pub privacy_admin_handle: crate::data::TpmiRhHierarchy,
160        pub sign_handle: crate::data::TpmiDhObject,
161    },
162    parameters: {
163        pub qualifying_data: Tpm2bData,
164        pub in_scheme: TpmtSignature,
165    }
166}
167
168tpm_struct! {
169    #[derive(Debug, PartialEq, Eq, Clone)]
170    kind: Response,
171    name: TpmGetTimeResponse,
172    cc: TpmCc::GetTime,
173    handles: {},
174    parameters: {
175        pub time_info: Tpm2bAttest,
176        pub signature: TpmtSignature,
177    }
178}