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    no_sessions: false,
21    with_sessions: true,
22    handles: {
23        pub object_handle: crate::data::TpmiDhObject,
24        pub sign_handle: crate::data::TpmiDhObject,
25    },
26    parameters: {
27        pub qualifying_data: Tpm2bData,
28        pub in_scheme: TpmtSignature,
29    }
30}
31
32tpm_struct! {
33    #[derive(Debug, PartialEq, Eq, Clone)]
34    kind: Response,
35    name: TpmCertifyResponse,
36    cc: TpmCc::Certify,
37    no_sessions: false,
38    with_sessions: true,
39    handles: {},
40    parameters: {
41        pub certify_info: Tpm2bAttest,
42        pub signature: TpmtSignature,
43    }
44}
45
46tpm_struct! {
47    #[derive(Debug, PartialEq, Eq, Clone)]
48    kind: Command,
49    name: TpmCertifyCreationCommand,
50    cc: TpmCc::CertifyCreation,
51    no_sessions: false,
52    with_sessions: true,
53    handles: {
54        pub sign_handle: crate::data::TpmiDhObject,
55        pub object_handle: crate::data::TpmiDhObject,
56    },
57    parameters: {
58        pub qualifying_data: Tpm2bData,
59        pub creation_hash: Tpm2bDigest,
60        pub in_scheme: TpmtSignature,
61        pub creation_ticket: TpmtTkCreation,
62    }
63}
64
65tpm_struct! {
66    #[derive(Debug, PartialEq, Eq, Clone)]
67    kind: Response,
68    name: TpmCertifyCreationResponse,
69    cc: TpmCc::CertifyCreation,
70    no_sessions: false,
71    with_sessions: true,
72    handles: {},
73    parameters: {
74        pub certify_info: Tpm2bAttest,
75        pub signature: TpmtSignature,
76    }
77}
78
79tpm_struct! {
80    #[derive(Debug, PartialEq, Eq, Clone)]
81    kind: Command,
82    name: TpmQuoteCommand,
83    cc: TpmCc::Quote,
84    no_sessions: false,
85    with_sessions: true,
86    handles: {
87        pub sign_handle: crate::data::TpmiDhObject,
88    },
89    parameters: {
90        pub qualifying_data: Tpm2bData,
91        pub in_scheme: TpmtSignature,
92        pub pcr_select: TpmlPcrSelection,
93    }
94}
95
96tpm_struct! {
97    #[derive(Debug, PartialEq, Eq, Clone)]
98    kind: Response,
99    name: TpmQuoteResponse,
100    cc: TpmCc::Quote,
101    no_sessions: false,
102    with_sessions: true,
103    handles: {},
104    parameters: {
105        pub quoted: Tpm2bAttest,
106        pub signature: TpmtSignature,
107    }
108}
109
110tpm_struct! {
111    #[derive(Debug, PartialEq, Eq, Clone)]
112    kind: Command,
113    name: TpmGetSessionAuditDigestCommand,
114    cc: TpmCc::GetSessionAuditDigest,
115    no_sessions: false,
116    with_sessions: true,
117    handles: {
118        pub privacy_admin_handle: crate::data::TpmiRhHierarchy,
119        pub sign_handle: crate::data::TpmiDhObject,
120        pub session_handle: crate::data::TpmiShAuthSession,
121    },
122    parameters: {
123        pub qualifying_data: Tpm2bData,
124        pub in_scheme: TpmtSignature,
125    }
126}
127
128tpm_struct! {
129    #[derive(Debug, PartialEq, Eq, Clone)]
130    kind: Response,
131    name: TpmGetSessionAuditDigestResponse,
132    cc: TpmCc::GetSessionAuditDigest,
133    no_sessions: false,
134    with_sessions: true,
135    handles: {},
136    parameters: {
137        pub audit_info: Tpm2bAttest,
138        pub signature: TpmtSignature,
139    }
140}
141
142tpm_struct! {
143    #[derive(Debug, PartialEq, Eq, Clone)]
144    kind: Command,
145    name: TpmGetCommandAuditDigestCommand,
146    cc: TpmCc::GetCommandAuditDigest,
147    no_sessions: false,
148    with_sessions: true,
149    handles: {
150        pub privacy_admin_handle: crate::data::TpmiRhHierarchy,
151        pub sign_handle: crate::data::TpmiDhObject,
152    },
153    parameters: {
154        pub qualifying_data: Tpm2bData,
155        pub in_scheme: TpmtSignature,
156    }
157}
158
159tpm_struct! {
160    #[derive(Debug, PartialEq, Eq, Clone)]
161    kind: Response,
162    name: TpmGetCommandAuditDigestResponse,
163    cc: TpmCc::GetCommandAuditDigest,
164    no_sessions: false,
165    with_sessions: true,
166    handles: {},
167    parameters: {
168        pub audit_info: Tpm2bAttest,
169        pub signature: TpmtSignature,
170    }
171}
172
173tpm_struct! {
174    #[derive(Debug, PartialEq, Eq, Clone)]
175    kind: Command,
176    name: TpmGetTimeCommand,
177    cc: TpmCc::GetTime,
178    no_sessions: false,
179    with_sessions: true,
180    handles: {
181        pub privacy_admin_handle: crate::data::TpmiRhHierarchy,
182        pub sign_handle: crate::data::TpmiDhObject,
183    },
184    parameters: {
185        pub qualifying_data: Tpm2bData,
186        pub in_scheme: TpmtSignature,
187    }
188}
189
190tpm_struct! {
191    #[derive(Debug, PartialEq, Eq, Clone)]
192    kind: Response,
193    name: TpmGetTimeResponse,
194    cc: TpmCc::GetTime,
195    no_sessions: false,
196    with_sessions: true,
197    handles: {},
198    parameters: {
199        pub time_info: Tpm2bAttest,
200        pub signature: TpmtSignature,
201    }
202}