tpm2_protocol/message/
capability.rs

1// SPDX-License-Identifier: MIT OR Apache-2.0
2// Copyright (c) 2025 Opinsys Oy
3
4//! 30.2 `TPM2_GetCapability`
5//! 30.3 `TPM2_TestParms`
6//! 30.4 `TPM2_SetCapability` (TODO)
7
8use crate::{
9    data::{TpmCap, TpmCc, TpmiYesNo, TpmsCapabilityData, TpmtPublicParms},
10    tpm_struct,
11};
12use core::fmt::Debug;
13
14tpm_struct! {
15    #[derive(Debug, PartialEq, Eq, Clone)]
16    kind: Command,
17    name: TpmTestParmsCommand,
18    cc: TpmCc::TestParms,
19    no_sessions: true,
20    with_sessions: false,
21    handles: {},
22    parameters: {
23        pub parameters: TpmtPublicParms,
24    }
25}
26
27tpm_struct! {
28    #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
29    kind: Response,
30    name: TpmTestParmsResponse,
31    cc: TpmCc::TestParms,
32    no_sessions: true,
33    with_sessions: false,
34    handles: {},
35    parameters: {}
36}
37
38tpm_struct! {
39    #[derive(Debug, PartialEq, Eq, Clone)]
40    kind: Command,
41    name: TpmGetCapabilityCommand,
42    cc: TpmCc::GetCapability,
43    no_sessions: true,
44    with_sessions: true,
45    handles: {},
46    parameters: {
47        pub cap: TpmCap,
48        pub property: u32,
49        pub property_count: u32,
50    }
51}
52
53tpm_struct! {
54    #[derive(Debug, PartialEq, Eq, Clone)]
55    kind: Response,
56    name: TpmGetCapabilityResponse,
57    cc: TpmCc::GetCapability,
58    no_sessions: true,
59    with_sessions: false,
60    handles: {},
61    parameters: {
62        pub more_data: TpmiYesNo,
63        pub capability_data: TpmsCapabilityData,
64    }
65}