tpm2_protocol/message/
testing.rs

1// SPDX-License-Identifier: MIT OR Apache-2.0
2// Copyright (c) 2025 Opinsys Oy
3
4//! 10.2 `TPM2_SelfTest`
5//! 10.3 `TPM2_IncrementalSelfTest`
6//! 10.4 `TPM2_GetTestResult`
7
8use crate::{
9    data::{Tpm2bMaxBuffer, TpmCc, TpmRc, TpmiYesNo, TpmlAlg},
10    tpm_struct,
11};
12use core::fmt::Debug;
13
14tpm_struct! {
15    #[derive(Debug, PartialEq, Eq, Clone, Copy)]
16    kind: Command,
17    name: TpmSelfTestCommand,
18    cc: TpmCc::SelfTest,
19    no_sessions: true,
20    with_sessions: true,
21    handles: {},
22    parameters: {
23        pub full_test: TpmiYesNo,
24    }
25}
26
27tpm_struct! {
28    #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
29    kind: Response,
30    name: TpmSelfTestResponse,
31    cc: TpmCc::SelfTest,
32    no_sessions: true,
33    with_sessions: true,
34    handles: {},
35    parameters: {}
36}
37
38tpm_struct! {
39    #[derive(Debug, PartialEq, Eq, Clone)]
40    kind: Command,
41    name: TpmIncrementalSelfTestCommand,
42    cc: TpmCc::IncrementalSelfTest,
43    no_sessions: true,
44    with_sessions: true,
45    handles: {},
46    parameters: {
47        pub to_test: TpmlAlg,
48    }
49}
50
51tpm_struct! {
52    #[derive(Debug, Default, PartialEq, Eq, Clone)]
53    kind: Response,
54    name: TpmIncrementalSelfTestResponse,
55    cc: TpmCc::IncrementalSelfTest,
56    no_sessions: true,
57    with_sessions: true,
58    handles: {},
59    parameters: {
60        pub to_do_list: TpmlAlg,
61    }
62}
63
64tpm_struct! {
65    #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
66    kind: Command,
67    name: TpmGetTestResultCommand,
68    cc: TpmCc::GetTestResult,
69    no_sessions: true,
70    with_sessions: true,
71    handles: {},
72    parameters: {}
73}
74
75tpm_struct! {
76    #[derive(Debug, PartialEq, Eq, Clone)]
77    kind: Response,
78    name: TpmGetTestResultResponse,
79    cc: TpmCc::GetTestResult,
80    no_sessions: true,
81    with_sessions: true,
82    handles: {},
83    parameters: {
84        pub out_data: Tpm2bMaxBuffer,
85        pub test_result: TpmRc,
86    }
87}